Sui.

Post

Share your knowledge.

McMMoKing.
Jan 25, 2025
Expert Q&A

How to query more than 50 NFTs using getObjects API?

I'm trying to retrieve a large number of NFTs from a blockchain address but ran into a limit in the getObjects API, which restricts the number of objects I can fetch at a time to 50. What's the correct way to handle this limitation and obtain more results? Is there any specific method or example code for handling pagination?

  • Sui
  • Architecture
1
2
Share
Comments
.

Answers

2
mssoni.
Jan 25 2025, 08:07

To overcome the 50-object limit in the getObjects API, you should utilize pagination. This involves using the cursor provided by the API to fetch the next set of results. Start by making an initial API call, then check the response for pagination details like 'nextCursor' and 'hasNextPage'. Use the 'nextCursor' as a parameter in your subsequent API calls until 'hasNextPage' is false, indicating there are no more objects to fetch.

1
Comments
.
Tawhid.
Jan 25 2025, 12:14

For implementation, refer to the Sui API documentation about pagination and querying objects. This typically involves making a series of requests using the cursor until you have retrieved all desired data. Each response will provide a cursor for the next set of objects, allowing you to handle larger datasets effectively .

1
Comments
.

Do you know the answer?

Please log in and share it.

We use cookies to ensure you get the best experience on our website.
More info