多个content_types的内容getEntries

时间:2016-03-22 08:54:48

标签: javascript contentful contentful-management

我们可以通过提供多个content_types来获取所有条目:

我有以下代码,只能通过一个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的所有条目。

感谢任何帮助。

由于

2 个答案:

答案 0 :(得分:2)

不,这是不可能的。您必须做两个单独的请求。

答案 1 :(得分:1)

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

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

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