Getting parse error on "query" mutation

Topic summary

Parse error occurs when executing a GraphQL mutation for orderEditBegin in a .NET app: the API returns “Parse error on “query” (STRING) at [1, 2]”. The request payload includes JSON keys “query” and “variables”.

Root cause: the Content-Type header is likely set to application/graphql instead of application/json. With application/graphql, Shopify expects only the raw GraphQL query string (no JSON wrapper), so sending a JSON object causes the parser to choke on the “query” key.

Action/fix:

  • If sending a JSON body with { query, variables }, set Content-Type: application/json.
  • If using Content-Type: application/graphql, send only the raw query string and do not include “variables” (you’d embed values directly in the query).

Status: Guidance provided; issue appears resolvable by correcting the Content-Type header.

Summarized with AI on January 24. AI used: gpt-5.

I am using the following mutation query in my .net application.

{“query”:“mutation orderEditBegin($id: ID!) { orderEditBegin(id: $id) { calculatedOrder { id originalOrder{ id lineItems(first:100){ edges{ node{ id sku } } } } lineItems(first:100){ edges{ node{ id sku } } } } userErrors { field message } }}”,“variables”: {“id”:“gid://shopify/Order/xxxxxxx”}}

while executing I am getting the folowing error message.

{“errors”:[{“message”:“Parse error on "query" (STRING) at [1, 2]”,“locations”:[{“line”:1,“column”:2}]}]}

Make sure you have your Content-Type set to application/json and NOT application/graphql.

If set to graphql, the api expects ONLY the query part of the request.