Reputation: 1
When I send a request like below:
{"mutation":"{ fulfillmentCreateV2 ( fulfillment: {lineItemsByFulfillmentOrder: { fulfillmentOrderId: \"gid://shopify/FulfillmentOrder/4895903678719\"}} ) { fulfillment { id } userErrors {message}}"}
I get an error:
{"errors":{"query":"Required parameter missing or invalid"}}
(I'm coding in Java, in the query I got it successfully)
Is there anything missing in the JSON I passed?
My code:
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
HttpPost http = new HttpPost(urlStr);
http.addHeader("x-shopify-access-token", access_token);
http.addHeader("Accept", "application/json");
http.addHeader("Content-Type", "application/json");
http.setEntity(new StringEntity(myJson));
HttpResponse response = httpClient.execute(http);
Upvotes: 0
Views: 1289
Reputation: 1324
I am not a Java specialist but this is not a valid GraphQL query. Most likely you are missing mutation fulfillmentCreateV2($fulfillment: FulfillmentV2Input!) {
part
Here's what it should look like based on documentation:
mutation fulfillmentCreateV2($fulfillment: FulfillmentV2Input!) {
fulfillmentCreateV2(fulfillment: $fulfillment) {
fulfillment {
# Fulfillment fields
}
userErrors {
field
message
}
}
}
Upvotes: 1