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

MartinSteffensen
MartinSteffensen Member Posts: 2
edited August 2023 in Developer APIs

We're using https://api.cloudinary.com/v1_1/{{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?

Tagged:

Best Answer

Answers

  • MartinSteffensen
    MartinSteffensen Member Posts: 2

    Thanks for the quick reply Stephen!

    We're using the Java library described at https://cloudinary.com/documentation/java_integration, and calling the resourcesByTag method of the Api class as returned by the Cloudinary class. I assume this is the same as using the https://api.cloudinary.com/v1_1/{{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?