Trying to update product metafield gives (406) Not acceptable

Highlighted
New Member
4 0 0

I am trying to add a metafield as a test to one of our products but am met with a 406 error code when running the request through Postman. I am able to run a GET request successfully for the same product. The request I am trying is a PUT to: https://closettedevelopment.myshopify.com/admin/api/2019-07/products/4190148296797/metafields.json

 

the body is:

 

{
  "metafields": {
    "namespace": "inventory",
    "key": "warehouse",
    "value": 25,
    "value_type": "integer"
  }
}

I am using Basic Auth with our API key and password


Any help would be greatly appreciated. Thank you!

 

0 Likes
Community Manager
Community Manager
618 45 79

 

Hi @samiam0906,

 

Can you share the full request with headers you are sending? 406 often means we can't return the results in the format you are requesting. Chances are it's an easy fix, but I'll need some more info. Thanks!

0 Likes
New Member
4 0 0

Hi @Busfox. Thank you for the reply. Below is the full request

 

PUT /admin/api/2019-07/products/4190148296797/metafields.json HTTP/1.1
Host: closettedevelopment.myshopify.com
X-Shopify-Storefront-Access-Token: <STOREFRONT-ACCESS-TOKEN>
Authorization: Basic <APIKEY + PW>
cache-control: no-cache
Postman-Token: <TOKEN>

{
  "product": {
    "id": 4190148296797,
    "metafields": [
      {
        "key": "new",
        "value": "newvalue",
        "value_type": "string",
        "namespace": "global"
      }
    ]
  }
}

 

 

0 Likes