Getting only 1000 records from the Intune API

hemantnh
Tera Expert

Getting only 1000 records from the Intune API

 

 

 

when i try to pull the intune data from the below url , i am getting only 1000 records, Please let me know how can we get more data

 

https://graph.microsoft.com/v1.0/deviceManagement/managedDevices

2 REPLIES 2

Runjay Patel
Giga Sage

Hi @hemantnh ,

 

Intune API has limit to send 999 data at time, so you have to make loop to get all data. check below thread it has solution for you. Or simple you can run for loop and call api to get the data. Lets say you have 5k data then run it 5 time.

 

https://www.servicenow.com/community/developer-forum/ms-graph-api-to-pull-records/m-p/1793498

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

AmolJ
Tera Expert

Basically you need this code:

    

    var rm = new sn_ws.RESTMessageV2("rest_message_name", "method_name");
    var response = rm.execute();
    var httpStatus = response.getStatusCode();
    var responseBody = response.getBody();
    var parsedData = JSON.parse(responseBody);
    var nextLink = parsedData["@odata.nextLink"];
Now once you have the nextLink, you just need to do some while looping (which I am trying to figure out myself if anyone could help) and until it's not null do something...