Can we trust that next_cursor = null means that there aren't any more resources?

MartinSteffensen Member Posts: 2
edited August 2023 in Developer APIs

We're using{{cloud_name}}/resources/:resource_type/tags/:tag to retrieve resources by a single tag. We wish to retrieve every resource with a particular tag.

We're keeping track of next_cursor in the response and if it is present, we make another API request with next_cursor from the response as offset to get the next page of resources.

Our assumption is that next_cursor = null means that we've retrieved everything, but our testing seems to be indicating that this might not be the case.

Can we trust that when next_cursor is null, we've retrieved every single resource with this tag?


Best Answer

  • Stephen
    Stephen Member, Cloudinary Staff Posts: 25
    Answer ✓

    Hi Martin,

    Yes, if you're using a paginated API method, the final page of the results will contain no next_cursor:

    If you find otherwise, please open a support request with reproduction instructions and we can check it for you




  • MartinSteffensen
    MartinSteffensen Member Posts: 2

    Thanks for the quick reply Stephen!

    We're using the Java library described at, and calling the resourcesByTag method of the Api class as returned by the Cloudinary class. I assume this is the same as using the{{cloud_name}}/resources/:resource_type/tags/:tag endpoint.

    The options we pass to the cloudinary().api().resourcesByTag() methods are as follows:

    var tag = "some tag"

    var options = {"type": "upload", "tags": true, "context": true, "next_cursor":{{next_cursor}}, "max_results": 500, "resource_type": "document"}

    From what I understand this is a paginated API method and therefore we can trust that next_cursor = null means that we've arrived at the last page and there are no more resources to collect, correct?