I’m just trying to follow the basic example of the Storefront API, and it seems if I set Content-Type to application/graphql (see screenshots) it gives me this error:
Now if I set Content-Type to application/json it seems to work, but then I can’t get it to return any product or collection data. Is this a documentation error or am I doing something something basic wrong here?
For the most part with any HTTP client or library you would use application/json. Setting the header to application/graphql means to explicitly treat the HTTP POST body as the contents of a GraphQL query string, so the format you are passing is invalid. See https://graphql.org/learn/serving-over-http/ for a little more explanation.
To get more collection or product data you would need to add more query parameters to the query you are making. All you are requesting is the id and handle. Check our documentation for all the possible parameters.
@MozzoERP It needs to be application/graphql for CURL like the example says. I will mention to the docs team that we can add a note about HTTP clients requiring application/json.