I like to know, under what circumstances that List vaults API will return empty array for value field and a nextLink?

Manivannan Sivaraj 0 Reputation points
2023-07-13T21:38:47.9833333+00:00

I'm using this API: GET https://management.azure.com/subscriptions/{subscriptionId}/resources?$filter=resourceType eq 'Microsoft.KeyVault/vaults'&api-version=2016-09-01, to get the list of key vaults under a subscription.

In the response, instead of returning all the vault resources in the value[], I'm getting the response as follows:

body:

{

"value": [],

 "nextLink": a http link to get the next set of vault resources.

}

If the response doesn't contain any vault resources in the first response, why there is a nextLink?

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,368 questions
{count} votes

1 answer

Sort by: Most helpful
  1. James Hamil 26,981 Reputation points Microsoft Employee
    2023-07-17T21:16:56.8+00:00

    Hi @Manivannan Sivaraj , the API may return an empty array for the value field and a nextLink under certain circumstances, such as when the API is paginating the results and there are no vault resources in the current page but there are more resources in the subsequent pages. In this case, the nextLink is provided to fetch the next set of vault resources. This could also be an error with an edge case that hasn't been documented, but it's hard to tell without seeing the data. What happens if you follow all the nextLinks? Are they all null? I would try tweaking the query to see if the results change or manually reviewing the data to make sure there are no errors.

    Please let me know if you have any questions and I can help you further.

    If this answer helps you please mark "Accept Answer" so other users can reference it.

    Thank you,

    James

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.