Sending a translation array through graphql api

Sending a translation array through graphql api

randomstream
Tourist
11 0 3

I'm slowly inching towards translation of a bilingual store via the graphql api. I have the calls I need to translate each metafield but I'd like to translate all of them in one go. Individually the structure works but when I try to pull the calls together I get the error {"errors":{"variables":"expected Array to be a Hash"}}. I have a feeling I need to change 'variables' to 'variablesArray' or similar. Can anyone suggest how to properly formulate this call?

 

{
"query":"mutation CreateTranslation($id: ID!, $translations: [TranslationInput!]!) { translationsRegister(resourceId: $id, translations: $translations) { userErrors {message field} translations {locale key value} } }",
"variables":[
{
"id":"gid://shopify/Metafield/123",
"translations":[
{
"key":"value",
"locale":"ja",
"translatableContentDigest":"c2327b138436f13e8e272dcbd790de4899b6c8b87187cef04d2d35a39e18cb59",
"value":"有機ココナッツ "
}
]
},
{
"id":"gid://shopify/Metafield/456",
"translations":[
{
"key":"value",
"locale":"ja",
"translatableContentDigest":"e6e14c42f452bddef120c8e3b8435e9adb887a96c49faa68a368d88ce9534615",
"value":"本品製造工場では、小麦、そば、乳成分、落花生を含む製品を製造しております。"
}
]
}
]
}

Replies 0 (0)