Hello,
I am trying to send GraphQL mutations and variables on a URLConnection with a Json format but
keep on getting “Bad Request” responses.
An example looks like this:
sQuery = “mutation fulfillmentCreateV2($fulfillment: FulfillmentV2Input!){”
sQuery = sQuery + “fulfillmentCreateV2(fulfillment: $fulfillment){fulfillment{id}userErrors{”
sQuery = sQuery + “field message}}}”
sVars is:
{“variables”:“{“fulfillment”: {“lineItemsByFulfillmentOrder”:[{“fulfillmentOrderId”: “gid://shopify/FulfillmentOrder/nnnn”,“fulfillmentOrderLineItems”: {“id”: “gid://shopify/FulfillmentOrderLineItem/mmmm”,“quantity”: 1}}],“notifyCustomer”: true,“originAddress”: {“address1”: 123 Main Street”“,“address2”: Box 225"”,“city”: Escondido"“,“countryCode”: “USA”,“provinceCode”: Orange”“,“zip”: 95111"”},“trackingInfo”: {“company”: “abc company”,“number”: “2223333”,“numbers”: [“4445555”],“url”: “https://blahblah.com”,“urls”: [“https://blahblah.com”]}},“message”: “Hello world”}"}
myURLConnection.SetRequestContent(sQuery + sVars, “application/json”)
sResult = myURLConnection.SendSync(“POST”, “https://{mystore}.myshopify.com/admin/api/2022-07/graphql.json?access_token=nnnnn”)
I’ve tried omitting “variables” (of course in correct Json format), but no help.
What is being missed here?