Paginated queries

In this section, you'll see how to paginate queries:

You can try this directly in our alphanet indexer's playground or our mainnet indexer's playground

You can paginate all the requests using regular “first” and “offset” parameters. Here is an example with the first basic query:

Query paginated NFTs (first page)

query {
	nftEntities(
		filter: { listedForSale: { equalTo: true } }
		first: 10
		offset: 0
	) {
		totalCount
		nodes {
			nftId
			owner
			collectionId
			offchainData
		}
	}
}

This request fetches the first page with 10 items. For the next page you need to put an offset. For example in our case, we add an offset of 10 to get the next 10 NFTs listed.

Query paginated NFTs (second page)

query {
	nftEntities(
		filter: { listedForSale: { equalTo: true } }
		first: 10
		offset: 10
	) {
		totalCount
		nodes {
			nftId
			owner
			collectionId
			offchainData
		}
	}
}

Query paginated NFTs (third page)

Again to get the third page, you need to increase the offset. Here we increase by 10 (20 in total) to get the next 10 NFTs listed.

query {
	nftEntities(
		filter: { listedForSale: { equalTo: true } }
		first: 10
		offset: 20
	) {
		totalCount
		nodes {
			nftId
			owner
			collectionId
			offchainData
		}
	}
}

Last updated