REST API does not return all documents

Hi everyone,

We're seeing a weird issue with REST API, as it does not return all the documents from a specific type.

Here's the endpoint we're calling (a bit cryptic because of encoding): https://e-potek.cdn.prismic.io/api/v2/documents/search?ref=&access_token=OUR_TOKEN&q=[[at(document.type%2C+"post")]]&graphQuery={ posts+{ edges+{ node+{ _meta+{ id uid tags type lang alternateLanguages+{ id uid type lang } } title date body+{ ...+on+hero+%7B%0A%09%09%09%09%09%09type%0A%09%09%09%09%09%09primary+%7B%0A%09%09%09%09%09%09%09section_id%0A%09%09%09%09%09%09%09image_layout%0A%09%09%09%09%09%09%09images%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%7D&pageSize=100&orderings=%5Bmy.post.date+desc%5D

Here's the query before encoding it:

{
	posts {
		edges {
			node {
				_meta {
					id
					uid
					tags
					type
					lang
					alternateLanguages {
						id
						uid
						type
						lang
					}
				}
				title
				date
				body {
					... on hero {
						type
						primary {
							section_id
							image_layout
							images
						}
					}
				}
			}
		}
	}
}

I have no idea why it would not return everything, since we're not filtering anything out.

When we query the same data through the graphQL API, it works fine, without issues.

Hey Florian, welcome to the Community forum!

The Prismic API returns a maximum of 20 documents per request

I did a quick check in your repo endpoint and I could saw you have more than 20 documents of the type Post that's why you're not seeing the total of documents.

You need to implement pagination in your queries so you can retrieve more than this initial 20 documents.

Let me know if you have questions about this or anything else

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.