Search code examples
azurechartsazure-data-factoryazure-resource-graph

Azure Resource Graph API skiptoken not getting next results


I am doing a Post call to the Microsoft Graph API from Azure Data Factory

Authentication is working, I am also getting back results, however I cant get the pagination to work, I keep getting the same results.

I fetch the skiptoken from the first result and then use it in the second call, but I am getting the exact same resulst

Example url: https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2022-10-01&$skipToken=ew0KICAiJGlkIjogIjEiLA0KICAiTWF4Um93cyI6IDEwMDAsDQogICJSb3dzVG9Ta2lwIjogMTAwMCwNCiAgIkt1c3RvQ2x1c3RlclVybCI6ICJodHRwczovL2FyZy1uZXUtb25lLXNmLmFyZy5jb3JlLndpbmRvd3MubmV0Ig0KfQ==

Even if i try to do top = 5 then I am still getting the same 1000 results: https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2022-10-01&$top=5

THere is a query in the body of the request.

Tried to add the shiptoken manually hardcoded as a test to see whether I would get different results


Solution

  • I believe you are using these parameters incorrectly. They should be the part of your request body and not query string based on the documentation provided here.

    Please try with the following:

    {
        query: 'your query',
        options: {
            '$top': 5
        }
    }
    

    OR

    {
        options: {
            '$skipToken': 'ew0KICAiJGlkIjogIjEiLA0KICAiTWF4Um93cyI6IDEwMDAsDQogICJSb3dzVG9Ta2lwIjogMTAwMCwNCiAgIkt1c3RvQ2x1c3RlclVybCI6ICJodHRwczovL2FyZy1uZXUtb25lLXNmLmFyZy5jb3JlLndpbmRvd3MubmV0Ig0KfQ=='
        }
    }
    

    Please see the Examples section as well for examples on how to use these parameters.