I used cUrl to perform the ProductVariant update by referring to the official example, and it worked.
curl -X POST \
https://xxxx.myshopify.com/admin/api/2021-10/graphql.json \
-H 'Content-Type: application/graphql' \
-H 'X-Shopify-Access-Token: xxxxx' \
-d '
mutation updateVariants {
f1: productVariantUpdate(input: {
id: "gid://shopify/ProductVariant/xxxxx",
price: 120
}) {
userErrors { field, message }
},
f2: productVariantUpdate(input: {
id: "gid://shopify/ProductVariant/xxxxx",
price: 130
}) {
userErrors { field, message }
}
}
'
After that I send http request inside java using unirest tool, but it returns me 406.
// This value is the same as the parameter submitted by cUrl
String mutation = new String(Files.readAllBytes(Paths.get("hql.txt")));
String url = "https://mystore.myshopify.com/admin/api/2021-10/graphql.json";
HttpResponse
This is hql.txt
```css
mutation updateVariants {
f1: productVariantUpdate(input: {
id: "gid://shopify/ProductVariant/xxxxx",
price: 120
}) {
userErrors { field, message }
},
f2: productVariantUpdate(input: {
id: "gid://shopify/ProductVariant/xxxx",
price: 130
}) {
userErrors { field, message }
}
}