I am trying to create & update product metafields using shopify admin APIs using postman but the apis not creating and updating the results in postman.
if i am trying the same thing with code script using cURL it is working fine there.
I am using X-Shopify-Access-Token in Header of postman POST and PUT request and there is no cookies sending in the request as well.
Please check the attahced screenshot for the request i am trying with postman.
Solved! Go to the solution
This is an accepted solution.
I was able to dig up both your cURL and Postman requests in our logs, and it seems that the issue is that the nested values you are passing in for the value parameter are not being parsed correctly.
Specifically, the value parameter of the metafield key is being joined with the value of the id you're passing in as a nested array for the value key. ie: we're seeing "value_24638787485796_h" as the key and not just "value" and therefore you are receiving a 422 error because the required "value" property is not present in the metafield body.
In order to avoid this error for Postman requests, you will have to ensure that the nested array you are passing in for the value is a string (which means all other quotation marks within this string are escaped). During my own testing, I've also found that the presence of newline characters will also cause the value to not be parsed as a string within Postman. You should therefore try to leave the entire value on a single line, without spaces (an odd issue within Postman/Insomnia, but something to be aware of none the less).
Making these changes should allow you to successfully make the request to create new metafields on the product.
I have checked the value parameter which is a nested array and corrected the format in a proper string (i.e. quotation marks within this string are escaped) and now the request is successfully made and update the metafields on the product.
Below is the attached request in which the value parameter is being parsed correctly.
Thanks for the reply.
I have a metafield on Shop resource which I am trying to update using Postman. the field type is Integer and I am making the request as below however I am not able to do it and getting the 404 error.
I have retrieved the metafield as -