Hi Shopify Community,
I would like to add Metaobject entries using GraphQL Admin API, but I’m currently facing an issue of making API queries directly from cmd (on Windows 11).
Could anyone help me with this problem? What am I doing wrong? Any input is appreciated!
Here’s the test command I entered:
# In cmd
curl -X POST https://shop-name.myshopify.com/admin/api/2023-04/graphql.json -H 'Content-Type: application/graphql' -H 'X-Shopify-Access-Token: my-access-token' -d '{products(first:3){edges{node{id}}}}'
Which is the example I got from GraphQL Admin API reference.
Here’s the errors I got:
{"errors":{"query":"Required parameter missing or invalid"}}
curl: (6) Could not resolve host: application
curl: (3) URL using bad/illegal format or missing URL
Some other things I’ve tried are:
-
Make sure that the URL and the access token are correct and all the access scopes are selected.
-
Change the format of the query
Instead of this:
-d '{products(first:3){edges{node{id}}}}'
I did this:
-d '{"query":"{products(first:3){edges{node{id}}}}"}'
However, it is still giving me the same errors.
Everything above is only a simple command that I wanted to try out before I actually perform the mutation.
Here’s my actual query for adding a Metaobject entry:
#Everything here should be in one single line. Showing multiple lines are only for higher readability
curl -X POST https://shop-name.myshopify.com/admin/api/2023-04/graphql.json
-H 'Content-Type: application/graphql'
-H 'X-Shopify-Access-Token: my-access-token'
-d '{
"query":"mutation {
metaobjectCreate(metaobject:{
type:\"metaobject-type\",
capabilities:{
publishable:{
status:ACTIVE
}
}
fields:[
{
key:\"display_name\",
value:\"Test Entry\"
},
{
key:\"color\",
value:\"White\"
}
]
}) {
metaobject{
id
}
}
}"
}
'
This gives me the same exact error, but I’m not sure what I did wrong here.
Any help is appreciated!
Thank you for spending time reading this.

