0

Can we get all entries by providing multiple content_types:

I have the following code which can only get all entries by one content_type:

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

});

But can we do like getting multiple entries by providing comma separated entryIds:

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

I need to get all entries of each content_type.

Any help is appreciated.

Thanks

maverickosama92
  • 2,685
  • 2
  • 21
  • 35

2 Answers2

2

Nope, this is not possible. You'll have to do two separate requests.

trodrigues
  • 1,428
  • 1
  • 9
  • 7
  • there is a problem in that if i have more than 20 content_types and i want to get entries of each content_type.. then there is too many requests error occurs. – maverickosama92 Mar 22 '16 at 10:43
  • @maverickosama92 Did you found any solution for this? I am facing the same issue. – dup.titung Apr 21 '21 at 12:31
  • @dup.titung no I had to call one by one to get entries back then. Haven't checked since then maybe they had added some solution in the latest contentful js SDK. – maverickosama92 Apr 21 '21 at 14:39
1

This is possible by using the following.

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

See https://www.contentfulcommunity.com/t/how-to-query-on-multiple-content-types/473 for details.

Russ Back
  • 87
  • 6