Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
Hello again,
I've created a few whitelisted metafields and now I'd like to retrieve the whitelist to know what was added.
- admin/api/2019-10/graphql.json returns "Not Found"
- admin/api/2019-10/metafields.json only shows the metafields365 app information
- admin/products/#{id}/metafields.json only shows the applied metafields
My goal is to have a set of metafields, `app-settings`, that will assign some default values to the app functionality so I need to create the metafields, query for them, and utilize the result within the app.
Any guidance is much appreciated!
Solved! Go to the solution
This is an accepted solution.
Hey @jenn11 ,
To learn more visit the Shopify Help Center or the Community Blog.
This is an accepted solution.
Hey @jenn11 ,
When sending a POST request to create a new resource, you do not pass in the values of the required fields through Query String Parameters but instead you pass them in as a JSON object in the "body" of the request.
So if you are using Postman to make this request, you do not need to add any params. Instead all you need is to include the appropriate Shopify Access Token credential and Content-Type in your header like so, and then add the JSON object with all the required fields in the body like this.
Hope that helps.
To learn more visit the Shopify Help Center or the Community Blog.
This is an accepted solution.
Hey @jenn11 ,
To learn more visit the Shopify Help Center or the Community Blog.
Thank you for the clarification, @hassain!
Following the API instructions you sent for creating a metafield on the Shop resource I'm encountering a new issue (does this require a new post? If so I'll amend) where I sent a POST request to /admin/metafields.json with the params:
namespace=testMetafield&key=testKey&value=testValue&value_type=json_string //also tried value_type=string
and receive the following error:
"metafield": "Required parameter missing or invalid"
I'm using Postman and have verified authorization and removed all cookies on each request per @Jason in another thread regarding POSTs to the API.
This is an accepted solution.
Hey @jenn11 ,
When sending a POST request to create a new resource, you do not pass in the values of the required fields through Query String Parameters but instead you pass them in as a JSON object in the "body" of the request.
So if you are using Postman to make this request, you do not need to add any params. Instead all you need is to include the appropriate Shopify Access Token credential and Content-Type in your header like so, and then add the JSON object with all the required fields in the body like this.
Hope that helps.
To learn more visit the Shopify Help Center or the Community Blog.
...I am le dumb and don't know how to use Postman. Thank you once again, @hassain!