我有一个矩阵字段,里面有一个“标签”字段:
我正在使用 CraftQL 来获取此条目中的所有字段,并且通常它工作得非常好,除了那个标签字段。
当我在管理面板的 CraftQL 控制台中运行以下查询时,theBasicsIndustries按预期返回标签数组。
query StoryQuery($slug: String!) {
entry(siteId: 2, slug: $slug) {
... on StoriesStory {
id
contentBlock {
... on ContentBlockTheBasics {
__typename
id
theBasicsName
theBasicsIndustries {
id
title
}
}
}
}
}
}
产生:
{
"data": {
"entry": {
"id": 26,
"contentBlock": [
{
"__typename": "ContentBlockTheBasics",
"id": "112",
"theBasicsName": "Some name",
"theBasicsIndustries": [
{
"id": 108,
"title": "Hospitality"
},
{
"id": 109,
"title": "Technology"
}
]
}
]
}
}
}
但是,当我通过 API 运行相同的确切查询时,它会返回
无法查询类型“ContentBlockTheBasics”的字段“theBasicsIndustries”。
- 是否有特殊的查询标签?我尝试通过 Postman 运行相同的查询,但出现了相同的错误。
- 为什么它在管理控制台中起作用,而不是在 API 中?
谢谢!