使用 GraphQL API 内容式获取所有标签
目前,我正在尝试使用 Contentful GraphQL API,尽管我似乎找不到立即获取所有标签的选项。在文档中我找到这篇文章(https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/content-tags/tag-collection/get-all-tags/console/js )表明有一个选项可以做到这一点。
不幸的是,这似乎只适用于 REST API,而不适用于 GraphQL API?或者我忽略/误解了什么?当我使用 GraphQL 探索功能时,我也找不到查询标签的选项。有什么提示吗?
Currently I'm trying to work with the Contentful GraphQL API, although I can't seem to find the option to fetch all tags at once. In the docs I find this article (https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/content-tags/tag-collection/get-all-tags/console/js) suggesting there is an option to do this.
Unfortunately this only seems to apply for the REST API and not for the GraphQL API? Or am I overlooking / misunderstanding something? When I use the GraphQL explore function, I also can't find an option to query the tags.. Any tips?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是来自未来的事情,但如果我理解正确的话,您正在尝试在内容丰富的环境中获取所有标签。
对于 Graphql,与其他 API 方法不同,没有直接获取标签的选项。如果您坚持使用 Graphql,则需要查询内容类型,然后添加要随其返回的元数据。您的查询应如下所示:
检查 docs 有关于此的更多信息。
要使用其余 API 方法获取所有标签:
注意:只会检索公共标签。
This is from the future but If I get you correctly, you are trying to get all tags in a Contentful environment.
For Graphql, there is no option to get the tags directly unlike the rest API approach. If you insist on Graphql, you will be required to query a content type and then add the metadata to be returned with it. Your query should look like the following:
Check docs for more info on this.
To get all tags with the rest API approach:
Note: Only public tags will be retrieved.