Re: Trying to update product metafield gives (406) Not acceptable

Trying to update product metafield gives (406) Not acceptable

samiam0906
Shopify Partner
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!

 

Replies 4 (4)

Busfox
Shopify Staff (Retired)
628 49 110

 

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!

To learn more visit the Shopify Help Center or the Community Blog.

samiam0906
Shopify Partner
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"
      }
    ]
  }
}

 

 

truemoroz
Shopify Partner
3 0 0

Did you get solution?

TerraIncognita
Shopify Partner
3 0 0

Try to run this with a POST request instead of a PUT request.