类型“ QueryRoot”上不存在字段“ translatableResources”

时间:2019-08-29 07:55:52

标签: graphql shopify

我在Shopify商店中安装了Shopify GraphiQL App,以测试一些GraphQL查询。

我想通过其API翻译内容。 这是它的文档:https://help.shopify.com/en/api/guides/multi-language/translating-content-api#retrieve-a-list-of-translatable-resource-types

现在,我要查询文档中的第一个示例:Retrieve a list of translatable resource types

{
  __type(name: "TranslatableResourceType") {
    enumValues {
      name
    }
  }
}

并收到此回复:

{
  "data": {
    "__type": null
  }
}

第二个查询也不起作用:Retrieve a list of translatable resources by their type

{
  translatableResources(first: 1, resourceType: PRODUCT) {
    edges {
      node {
        resourceId
        translatableContent {
          key
          value
          digest
          locale
        }
      }
    }
  }
}

第二个查询的错误:

{
  "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"
      }
    }
  ]
}

在安装Shopify GraphiQL App时,我选择了所有权限(包括read_translationswrite_translations权限)。 而且我的商店中确实有产品。

缺少哪个设置或我在做什么错?

1 个答案:

答案 0 :(得分:3)

我认为您正在使用2019-07或2019-10,因此您需要使用shopify添加了translatableResources Queryroot的不稳定版本。请检查下图:

enter image description here

相关问题