I installed the Shopify GraphiQL App in my Shopify store to test some GraphQL queries.
I want to translate content via their API.
Here is the documentation for it: https://help.shopify.com/en/api/guides/multi-language/translating-content-api#retrieve-a-list-of-translatable-resource-types
Now, I want to query their first example in the documentation: Retrieve a list of translatable resource types
{
__type(name: "TranslatableResourceType") {
enumValues {
name
}
}
}
And received this response:
{
"data": {
"__type": null
}
}
Also the second query isn’t working: Retrieve a list of translatable resources by their type
{
translatableResources(first: 1, resourceType: PRODUCT) {
edges {
node {
resourceId
translatableContent {
key
value
digest
locale
}
}
}
}
}
The error of the second query:
{
"errors": [
{
"message": "Field 'translatableResources' doesn't exist on type 'QueryRoot'",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"query",
"translatableResources"
],
"extensions": {
"code": "undefinedField",
"typeName": "QueryRoot",
"fieldName": "translatableResources"
}
}
]
}
When I installed the Shopify GraphiQL App, I picked all permissions (incl. read_translations
and write_translations
permissions).
And I do have products in my store.
Which setting is missing or what am I doing wrong?
2
Answers
I think you are using either 2019-07 or 2019-10, you need to use unstable version where shopify added translatableResources Queryroot. Please check below image:
If you are using POSTMAN or INSOMNIA for testing then the URL will be:
https://{{store}}.myshopify.com/admin/api/unstable/graphql.json
Before using the unstable version, you need to change the private app version to Unstable.