GraphQL Over HTTP
The handling of GraphQL requests via HTTP will evolve slightly as of 2025-01
API versions in accordance with the GraphQL over HTTP spec. These changes refine how a request's Content-Type
and Accept
headers work, and offer additional granularity in response status codes.
New response format
A new response format is available. Requests may select this format using the
Accept
header, for example:
The above favors receiving a response by listing it first. This new format is the same as JSON aside from its status codes:
- For
, this status indicates that the JSON payload was valid and that the submitted GraphQL document attempted execution on the server. Note that the response payload may still contain errors encountered during execution along with partial data.
- For
, this status only indicates that the JSON payload was valid.
400 Bad Request
- For
, this status indicates that the JSON payload was invalid, or that the submitted GraphQL parameters failed static validation and were not executed.
- For
, this status only indicates that the JSON payload was invalid.
Usage summary
For requests to 2025-01
versions and after:
- Use the
/graphql
endpoint. Using/graphql.json
will automatically respond withas it does now.
- The request body must contain a spec JSON encoding.
- The
Content-Type
header must specify. The legacy
request format is no longer supported. Requests with no supported content type will receive a
415 Unsupported Media Type
response. - The
Accept
header now supportsand/or
response formats. Requests with no supported accept types will receive a
406 Not Acceptable
response. - Accepting
*/*
will default to aresponse.
These changes do NOT affect unstable
versions at this time, or Storefront API. A breaking change announcement with migration timeline will be announced prior to any unstable transition.