Contentful getEntries by multiple content_types

Contentful getEntries by multiple content_types

本文关键字:types content multiple getEntries by Contentful      更新时间:2023-09-26

我们可以通过提供多种内容类型来获得所有条目吗:

我有以下代码,只能通过一个content_type获取所有条目:

cf_space.getEntries({content_type: "contentTypeId"}).then(function(contentTypes){
});

但是,我们可以通过提供逗号分隔的entryIds:来获得多个条目吗

var entryIds = "id1,id2";
cf_space.getEntries({'sys.id[in]': entryIds}).then(function(entries) {              
});

我需要获取每个content_type的所有条目。

感谢您的帮助。

感谢

不,这是不可能的。您将不得不处理两个单独的请求。

这可以通过使用以下内容来实现。

sys.contentType.sys.id[in]=[content_type1],[content_type2],...

请参阅https://www.contentfulcommunity.com/t/how-to-query-on-multiple-content-types/473详细信息。