API responses do not return a cursor value in VCF Operations for Networks
search cancel

API responses do not return a cursor value in VCF Operations for Networks

book

Article ID: 433676

calendar_today

Updated On:

Products

VCF Operations for Networks

Issue/Introduction

When querying the VCF Operations for Networks API, the response may not contain a cursor value.

For example, submitting a request using a size parameter of 10,000 returns a total_count of less entities then 10,000 without a cursor field. This behavior can cause issues if an API client expects a cursor to be present in every response.

Environment

VCF Operations for Networks

Cause

The cursor field is part of the PagedListResponseWithTime schema. It serves as a pointer to the next chunk of data during pagination and is only included when there are additional pages of results to retrieve.

When the total number of results fits entirely within the requested page size, or when the end of the result set is reached, the API correctly returns the results without a cursor.

Resolution

The absence of a cursor indicates that all available entities have been returned and there are no further pages to retrieve. To properly handle API pagination, account for the dynamic presence of the cursor field:

  1. Evaluate the API response payload for the cursor key.

  2. If a cursor is present, append it to the subsequent request to fetch the next page of results.

  3. If no cursor is present, all available entities have been retrieved. Treat the current response as the final page and terminate the pagination loop. Do not attempt to query for a subsequent page.