Query using multiple IDs

Hi guys,

I have a JavaScript application that is trying to get 3 bits of content using their entry ID as the search param. As per the documentation here (https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/array-with-multiple-values) I have tried this:

      content_type: 'questions',
      'sys.id[all]': '3Lxm3zFmkMe0qAuougiEIC,2pZvONhDmy0saKgqqi4E0W,5E26wo72fYcWqwYEoGcwUq'
    .then((response) => {

But this seems to cause the client to crash and stop working.

Obviously I could just make 3 requests but this seems a little wasteful if I could do it in one. Any idea how I can achieve this?



Hi Alex!

I believe you could just change your query to use the [in] operator instead.

'sys.id[in]': '3Lxm3zFmkMe0qAuougiEIC,2pZvONhDmy0saKgqqi4E0W,5E26wo72fYcWqwYEoGcwUq'

You are correct in saying that all was the wrong choice, apologies I misread the docs. Having tried that it only returns one result (the first ID in the list).

Any other suggestions?

That sounds weird, are all of the entries of the questions content type? Otherwise, just remove that constraint and it should retrieve all the entries.

Another thing to check is that all the entries are published. The CDA will only return published entries.

Just confirmed that they are all published (they were already) and attempted removing the content_type prop but I still only get one response, the first ID in the list.

Any further suggestions?

hmm there’s nothing wrong with the syntax. I would test making a manual call to the CDN to try to figure out what’s going on.

Something like http://cdn.contentful.com/spaces/SPACEID/entries/?access_token=ACCESSTOKEN&sys.id[in]=3Lxm3zFmkMe0qAuougiEIC,2pZvONhDmy0saKgqqi4E0W,5E26wo72fYcWqwYEoGcwUq

The above is the call to the CDN your javascript code eventually results in. Does that also just give you a single entry back?

If it does, are the other entries included in the Includes object?

The CDN link also returns a single entry and the other fields are not in the includes prop. The includes has information about a linked file but not the other questions.

Do you want me to send you the link via some sort of private message so you can have a look yourself?

Sure, there seems to be no great way to do that on the forum, but feel free to reach out to me on our community slack, username Robban and we’ll get to the bottom of this.



I was wondering if there was a solution found for this issue?
I’m countering the same problem at the moment…

Thank you,

Hey @arnevankauter,
Could you tell us what exactly is missing from your response?
I was able to perform this query and here’s a working example from our example CDA:


I was having the same issue using the Client on Javascript. I was adding spaces when separating with commas. If you add spaces it breaks and you’ll get only the first result.

1 Like

This is the answer right here when using getEntries in JavaScript/TypeScript! Spaces break the query and give you the first result only.