Microsoft Graph API pagination with Infinity Data Source

I am using Microsoft Graph API with Grafana and data source I am using is Infinity Data Source

I want to ask I am fetching direct routing calls with https://graph.microsoft.com/v1.0/communications/callRecords/getDirectRoutingCalls(fromDateTime=2019-11-01,toDateTime=2019-12-01) api

when the record is above 1000 it is give an
"@odata.nextLink": "https://graph.microsoft.com/v1.0/communications/callRecords/getDirectRoutingCalls(fromDateTime=2022-11-17,toDateTime=2022-12-14)?$top=10&$skip=1000",
to get the record of after 1000 records so is there any thing I can do in the plugin to automatically call nextLink when data is above 1000 rows

Welcome

What visualization will you be using for the data returned by that api? Could you please post some sample json (obfuscated) from that api?

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.callRecords.directRoutingLogRow)",
    "@odata.count": 1000,
    "@odata.nextLink": "https://graph.microsoft.com/v1.0/communications/callRecords/getDirectRoutingCalls(fromDateTime=2022-11-17,toDateTime=2022-12-14)?$top=10&$skip=1000",
    "value": [
        {
            "id": "0863932e----096075467111",
            "correlationId": "5c4a66ec-e644--2554c4bfe083",
            "userId": "45d09dce-5e5a-4c90-a3d4-",
            "userPrincipalName": "-@.onmicrosoft.com",
            "userDisplayName": "",
            "startDateTime": "2022-11-17T10:29:07.159Z",
            "inviteDateTime": "2022-11-17T10:29:05.386Z",
            "failureDateTime": null,
            "endDateTime": "2022-11-17T10:34:01.159Z",
            "duration": 294,
            "callType": "ByotInUcap",
            "successfulCall": true,
            "callerNumber": "+",
            "calleeNumber": "+",
            "mediaPathLocation": "EUNO",
            "signalingLocation": "EUWE",
            "finalSipCode": 0,
            "callEndSubReason": 540000,
            "finalSipCodePhrase": "Q.;text=\"60a56d9d---9b29-5c266ce4f626;LocalUserInitiated\"",
            "trunkFullyQualifiedDomainName": "",
            "mediaBypassEnabled": false
        },

this is my json I am getting 1000 values with dates can I group dates with how many dates in same row to show in graph? like this data represent calls so I want to show like at 16 dec there are 50 calls in the array

I see 4 dates. Which one is the one you want to group by?

I want to use inviteDateTime

Choose UQL

image

parse-json
| scope "value"
| extend "inviteDateTime"=todatetime("inviteDateTime")
| extend "inviteDateTime"=startofday("inviteDateTime")
| summarize "number of tickets"=count() by "inviteDateTime"
| extend "inviteDateTime"=todatetime("inviteDateTime")
| extend "inviteDateTime"=format_datetime("inviteDateTime",'YYYY-MM-DD')

thank you for your solution and it works like a charm but the thing is I cant see data above 1000 because there is a limit of 1000 only by the ms graph api see in the teams graph data is above 1000 and in grafana it is showing only 1000 is there a way to get other data by the next link to call automatically see this url for better understanding callRecord: getDirectRoutingCalls - Microsoft Graph v1.0 | Microsoft Learn

If there are more than 1000 entries in the date range, the body also includes an @odata.NextLink with a URL to query the next page of call entries. The last page in the date range does not have @odata.NextLink . For more information, see paging Microsoft Graph data in your app.

In that case you will have to use another rest api plugin that does pagination (next is pagination) such as apache echart that you can use to iterate through the api next1k at a time to get all your data

Thank you very much :wink:

1 Like

This thread is where I recommended apache echarts