Linked blocks within field are coming in out of order in API call

How do I fetch the content of a field in exactly the order I added them in Contentful, without using the order param?

I have a field in my Content Model called “Content Blocks”. Each time I use this model, I add multiple blocks within it that link to other content (an article) also hosted in my space.

So, ContentBlocks is essentially an object that contains other objects: contentBlock1, contentBlock2, contentBlock3, etc.

When I make the API call to fetch this fields, however, the contentBlocks come in out of order from the way I added them on Contentful. So, on Contentful it looks like this:


  • contentBlock1
  • contentBlock2
  • contentBlock3
  • contentBlock4

but when I get the fetch results, it comes in randomly as


My fetch code is:

  fetchNewsletter (publishDate) {
    try {
      return this.instance
        .set({ Authorization: `Bearer ${MAGAZINE_ACCESS_TOKEN}`, Accept: 'application.json' })
        .then(response => response.body)
        .catch(error => console.error(error))    
    } catch (error) {
      console.error('fetch newsletter error', error)

The sub-blocks are not based on any property ( id , createdAt ) other than the order in which they are added in, so using the order param will not help.

This issue is similar to what I am experiencing.

How do I fetch the array of contentBlocks in exactly the order I added them in Contentful, without using the order param?

Hi @gmarraro,

First of all, the issue that you refer to was actually one where the user had misnamed his items and so the IDs were referring to different entries. Do you think that could also be the case with you?

In general, if you’re using the order parameter with it, you should indeed expect that the order that you created through the UI is properly retrieved in the API. If this issue persists, could you try requesting this entry through the API directly, without the SDK, and let us know if the order is retrieved?