Graph Security Alerts API (Legacy alerts) - pagination doesn't work anymore

Nadav Lavy 6 Reputation points
2024-07-02T05:48:42.09+00:00

We use the Microsoft Graph API to fetch V1 Legacy Alerts: https://learn.microsoft.com/en-us/graph/api/alert-list?view=graph-rest-1.0&tabs=http

Pagination with the "@odata.nextLink" used to work fine until now.

Here is the REST API workflow:

  1. curl --location 'https://graph.microsoft.com/v1.0/security/alerts?%24orderBy=createdDateTime+asc&%24filter=(vendorInformation%2fprovider+eq+%27Office+365+Security+and+Compliance%27+and+createdDateTime+gt+2024-06-01T11%3a39%3a51.170126645Z)' \ --header 'Authorization: Bearer token'
  2. The above API returns about 200 events. It also provides me the 'nextLink' in the HTTP response.
       {
           "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#security/alerts",
           "@odata.nextLink": "https://graph.microsoft.com/v1.0/security/alerts?$orderBy=createdDateTime+asc&$filter=(vendorInformation%2fprovider+eq+%27Office+365+Security+and+Compliance%27+and+createdDateTime+gt+2024-06-01T11%3a39%3a51.170126645Z)&$skiptoken=d36415d2-4a5c-486a-8901-9beb6570ff38",
           "value": [...]
       }
    
  3. Using the nextLink URL to make the following request:
    curl --location 'https://graph.microsoft.com/v1.0/security/alerts?%24orderBy=createdDateTime+asc&%24filter=(vendorInformation%2fprovider+eq+%27Office+365+Security+and+Compliance%27+and+createdDateTime+gt+2024-06-01T11%3a39%3a51.170126645Z)&%24skiptoken=d36415d2-4a5c-486a-8901-9beb6570ff38' \ --header 'Authorization: Bearer token
  4. HTTP Response we receive:
       {
           "error": {
               "code": "",
               "message": "The query specified in the URI is not valid. Query option 'SkipToken' is not allowed. To allow it, set the 'AllowedQueryOptions' property on EnableQueryAttribute or QueryValidationSettings.",
               "innerError": {
                   "message": "Query option 'SkipToken' is not allowed. To allow it, set the 'AllowedQueryOptions' property on EnableQueryAttribute or QueryValidationSettings.",
                   "date": "2024-07-02T05:43:34",
                   "request-id": "fc79e3a9-1f0c-485f-9696-9d84181ff378",
                   "client-request-id": "fc79e3a9-1f0c-485f-9696-9d84181ff378"
               }
           }
       }
    
  5. This used to work fine, it seems like the API behaviour has changed.

Please help take a look at this issue.

Thanks!

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,382 questions
{count} vote