Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
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!
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.
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" } ] } }
Did you get solution?
Try to run this with a POST request instead of a PUT request.