I am trying to get my first 3 products with Admin API.
I tested with cURL and Postman and I can get the products with REST but not with GraphQL query.
I tested the query in the Shopify GraphiQL App, and it works fine. So it should not be a problem with the query syntax. It should not be a problem with the API Key; otherwise REST will not work either.
What can it be??
cURL return “Bad Request 443” weather Postman return
"errors": "[API] Invalid API key or access token (unrecognized login or wrong password)"
Here is my working REST cURL
curl -X GET \
-H "Content-Type: application/json" \
-H "X-Shopify-Access-Token: MY_ADMIN_API_KEY" \
"https://my-store-name.myshopify.com/admin/api/2023-10/products.json?limit=3"
and here the NOT working GraphQL cURL:
curl -X POST https://my-shop-name.myshopify.com/admin/api/2023-10/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: MY_API_KEY' \
-d '{
"query": "{
products(first: 3) {
edges {
node {
id
title
}
}
},
}"
}'
I have seen other similar issues in this forum and in Stackoverflow, but nothing that can help me.
Any tips would be highly appreciated!