Hello
I’ve this mutation
mutation UpdateProductWithNewMedia($input: ProductInput!, $media: [CreateMediaInput!]) {
productUpdate(input: $input, media: $media) {
userErrors {
field
message
}
}
}
With this variables
{
"input": {
"id": "gid://shopify/Product/2022520586310",
"descriptionHtml": "\n\nCaratteristiche Principali:\nNew 20% extra power**\n3x* Capture\n*Cattura 3 tipi di residui: polvere, peli/capelli e allergeni (provenienti da acari, ma anche da cani e gatti)\n**blocca il 20% in più di polvere rispetto allo Swiffer duster precedente\n\nPreparazione e Uso\nNon utilizzare su superfici calde.\n\nAvvertenze di sicurezza:\nTenere lontano dai bambini.\nA.I.S.E.\nwww.cleanright.eu\n\n\nAssistenza clienti:\n Indirizzo produttore : Procter & Gamble S.r.l.\nViale Giorgio Ribotta, 11\n00144 Roma\nRestituire a : www.swiffer.it\n800 420 430\nProcter & Gamble S.r.l.\nViale Giorgio Ribotta, 11\n00144 Roma\n",
"metafields": [
{
"id": "gid://shopify/Metafield/36423331447107",
"key": "updatedate",
"namespace": "custom",
"value": "2023-05-10",
"type": "date"
}
],
"productType": "Piumino Spolvero",
"title": "Swiffer Duster XXL Starter Kit Catturapolvere (1 Manico + 2 Piumini per spolverare)",
"vendor": "Procter & Gamble srl",
"variants": [
{
"barcode": "5410076291106",
"sku": "10384",
"weight": 167,
"weightUnit": "GRAMS",
"compareAtPrice": 0
}
]
},
"media": [
{
"alt": "Swiffer Duster XXL Starter Kit Catturapolvere (1 Manico + 2 Piumini per spolverare)",
"originalSource": "URL",
"mediaContentType": "IMAGE"
},
{
"alt": "Swiffer Duster XXL Starter Kit Catturapolvere (1 Manico + 2 Piumini per spolverare)",
"originalSource": "URL",
"mediaContentType": "IMAGE"
}
]
}
Both the mutation and Variable are the Query and Variable Fields in a very simple c# routine
var graphQLClient = new GraphQLHttpClient(graphQLEndpoint, new NewtonsoftJsonSerializer());
graphQLClient.HttpClient.DefaultRequestHeaders.Add("X-Shopify-Access-Token", accessToken);
var mutation = new GraphQLRequest();
mutation.Query = "THE QUERY ABOVE";
mutation.Variables= "THE VARIABLE ABOVE";
var response = graphQLClient.SendMutationAsync<dynamic>(mutation).Result;
If I execute the GraphQl mutation with the shopify interface using the exact value returned by debuging every field, it works, but If I execute the c# routine return me some errors:
Field ‘productUpdate’ doesn’t accept argument ‘media’
and
Variable $media is declared by UpdateProductWithNewMedia but not used
But I’ve take the mutation from shopify official documentation
https://shopify.dev/docs/api/admin-graphql/2023-10/mutations/productUpdate#examples-Add_new_media_to_an_existing_product
It’s make me crazy