Cleaning up the O365 REST API

I am trying to figure out what I am doing wrong. I'm trying to get all contacts from O365 in XML or JSON format, so I started looking into it and found out that Microsoft has an API that will return data in JSON (great!).

The API is available at: https://outlook.office365.com/api/v1.0/me/contacts

I opened the link in a browser and everything was fine, except that it only returns the first 10 contacts. I didn't need this to be included in any software or program or anything that I just needed to get through the browser. Am I missing something or is there another way how can I get all contacts dumped in a very basic format?

Thanks for any feedback.

+3


source to share


1 answer


By default, the API should only return 10 records per request. You can increase this to 50. For large result sets, you must use paging. http://msdn.microsoft.com/office/office365/APi/complex-types-for-mail-contacts-calendar#UseODataqueryparametersPageresults

So in the browser you can: https://outlook.office365.com/api/v1.0/me/contacts/ $ count

This will tell you how much you have. Then you can grab the first 50: https://outlook.office365.com/api/v1.0/me/contacts ? $ top = 50



If you have more, you can grab the next 50 with the $ skip parameter: https://outlook.office365.com/api/v1.0/me/contacts ? $ top = 50 & $ skip = 50

Etc.

+4


source







All Articles