SpreadsheetUrlDownload mit Shopify GraphQL - Error 400

Hallöchen zusammen!

Ich versuche aktuell mich in die GraphQL für Shopify einzulesen.
Wir wollen per Request Katalog-Preise aktualisieren.
Dazu nutzen wir die Mutation “quantityPricingByVariantUpdate”, welche wir über den SpreadsheetUrlDownload dynamisch mit unseren Preisen füllen.

Die Konfiguration des Steps sieht dabei so aus:

Der fertige requestBody sieht dann z.B. so aus:

mutation{ quantityPricingByVariantUpdate( priceListId: “gid://shopify/PriceList/XXX“ input: { pricesToDeleteByVariantId: [“gid://shopify/ProductVariant/XXX“] quantityRulesToDeleteByVariantId: [“gid://shopify/ProductVariant/XXX“] quantityPriceBreaksToDeleteByVariantId: [“gid://shopify/ProductVariant/XXX“] quantityPriceBreaksToDelete: pricesToAdd: [ { variantId: “gid://shopify/ProductVariant/XXX“, price: { amount: 4.29, currencyCode: EUR } } ] quantityRulesToAdd: [ { variantId: “gid://shopify/ProductVariant/XXX“, minimum: 6, increment: 6 } ] quantityPriceBreaksToAdd: [ { variantId: “gid://shopify/ProductVariant/46521348161874“, price: { amount: 3.95, currencyCode: EUR }, minimumQuantity: 60 } { variantId: “gid://shopify/ProductVariant/XXX“, price: { amount: 3.79, currencyCode: EUR }, minimumQuantity: 120 } ] } ) { productVariants { id sku } userErrors { message code field } } }

Die X sind natürlich die richtigen IDs.

Wenn ich mir das Ganze nun per Vorschau anschaue, erhalte ich für jede Request einen Error 400 “Bad Request”.

Was mache ich noch falsch bzw. muss anders konfiguriert werden?

Besten Dank für euer Feedback! :slight_smile:

Hallo @luchs,

der requestBody passt vermutlich noch nicht ganz. Der vollständige GraphQL body sollte mit

{"query":"mutation{...}", ... beginnen.


(siehe Serving over HTTP | GraphQL)

VG Torsten

Hallo @luchs,

was mir noch auffällt, ist das deine JSON nicht korrekt ist. Die GraphQL-Query ist ein valides JSON-Objekt, dass sieht mir nicht danach aus. Da fehlen mindestens einige Kommas.

Am besten mal irgendeinem JSON-Validator drüber laufen lassen.

Gruß
Gustav

Hallo @synesty-Torsten und @gustavfriedeheim,

vielen Dank für eure Antworten!
Das hat sehr geholfen und die Mutation läuft jetzt wie gewünscht durch :slight_smile:

1 „Gefällt mir“