What is skipToken in QueryRequestOptions

Rufeng Xu-Friedman 21 Reputation points
2021-09-09T20:40:32.267+00:00

Hi I am using ResourceGraphClient, the default returns 1000 records.

The document says it could return up to 5000, and it can be controlled by options with top, skip and skipToken.

How do I get skipToken ?

Here is the link I am referring to ?
https://learn.microsoft.com/en-us/javascript/api/@azure/arm-resourcegraph/queryrequestoptions?view=azure-node-latest#skipToken

With az graph, I can get default 5000 records. But I do not know how to get 5000 records with sdk ResourceGraphClient ?

Could someone please give me an example ?

Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

Accepted answer
  1. Diana Wanjuhi 1,376 Reputation points
    2021-09-15T13:34:40.54+00:00

    Hello @Rufeng Xu-Friedman Thank you for reaching out. When a result set spans multiple pages, Microsoft Graph returns an@odata.nextLink property in the response that contains a URL to the next page of results . This will look like this:

    132377-skiptokenquery.png

    You can retrieve the next page of results by sending the URL value of the @odata.nextLink property to Microsoft Graph. Depending on the API that the query is being performed against, the @odata.nextLink URL value will contain either a $skiptoken or a $skip query parameter. The URL also contains all the other query parameters present in the original request. Do not try to extract the $skiptoken or $skip value and use it in a different request.

    From the documentation you shared, the Query Response contains the skiptoken property which can be passed on to subsequent requests. In your case, the response containing the first 1000 records will contain this value that you can use to get the next page of results.

    Let me know whether this helps and if you have further questions,

    Diana.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Rufeng Xu-Friedman 21 Reputation points
    2021-09-15T16:55:34.497+00:00

    Thank you so much !
    I understand now. The value $skiptoken is the response. I wish the document says something about it, as I could not understand what $skiptoken means. The doc only says "str". It would be better if it mentions that this is one the parameter from the return response.

    Thanks for your response.

    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.