title: Shopify. Problems updating Metafields with shopify-node-api
body: <p>I'm having difficulty in updating an existing metafield with Shopify API. Each time I receive an error, advising me that the variant already exists... so it must be thinking I'm trying to create a new one (and not update).</p>
  
  <p>I thought this may be an issue with 'put' and 'post' - so changed my method to put, however the error persists. I've hardwired in all my variables to make it easier to test.</p>
  
  <p>I'm working with Cloudinary. I'm using <a href="https://github.com/sinechris/shopify-node-api" rel="nofollow">https://github.com/sinechris/shopify-node-api</a> with Express.js</p>
  
  <pre><code>app.post('/upload', function(req, res){
    // upload page... assume we have uploaded our image - but have hard-wired a local file in for now
    cloudinary.uploader.upload('/Users/Rob/Pictures/testimg.jpg', function(savedImg) { 
      var imageURL = savedImg.url;
      console.log(imageURL)
    },
    {
      public_id: "testimg"
    });
  
  
    // the saved image is returned - so we add it to our updateMetafieldData json object
        var updateMetafieldData = {
         "variant": {
            "id": '253818949',
            "metafields": [
              {
                "key": "variant_image_0",
                "value": 'testimg', // whatever the public id of our image is.
                "value_type": "string",
                "namespace": "variant_image"
              }
            ]
          }
        }
    // and post the result to shopify - then redirect to /getvariants
    Shopify.put('/admin/variants/253818949.json', updateMetafieldData, function(data){
      // res.redirect('/getvariants')
    });
  
  
  
  });
  </code></pre>