none
What should User-Agent be set to when using Microsoft Graph API? RRS feed

  • Question

  • I am currently working on an application that makes requests using the .NET SDK for the Microsoft Graph API. Specifically to retrieve information about users and their OneDrives.

    API requests are throttled by returning an HTTP 429 status code, and I have implemented a back-off using the 'Retry-After' header. I have noticed however that I seem to be getting throttled after only a handful of requests.

    I have also been using Graph Explorer to test some of my API calls and have noticed that I never seem to get a 429 response when accessing the API via that method. After also seeing reports of people having issues with the OneDrive client on Linux that they managed to work around by changing their User-Agent header, I thought maybe I needed to set a User-Agent for my requests.

    The result is that it seems that if I set the User-Agent header to be something like Mozilla/5.0then all the throttling issues seem to disappear. I have searched high and low and so far haven't managed to find any documentation on what a valid User-Agent should be, and I would prefer to avoid making my app impersonate a browser, so I wondered whether there was any guidance or documentation around that I might have missed?

    Thursday, April 5, 2018 2:02 PM