question

JSG-3345 avatar image
0 Votes"
JSG-3345 asked saldana-msft edited

Header "x-ms-throttle-limit-percentage" not coming in response

My application makes a lot of calls to the graph API to get the properties I need. It is impossible to reduce the number of requests in my case. And for this, I need to understand when the number of requests approaches the limit and that I need to stop doing them so as not to get 429)

The documentation says that the parameter "x-ms-throttle-limit-percentage" should come in the header when the number of requests approaches the limit from 0.8. As I understand it, 0.8 is a coefficient from 1, where 1 is the upper limit of the limit: https://docs.microsoft.com/en-us/graph/throttling?view=graph-rest-1.0#regular-responses-requests

But I didn’t get this parameter in the header, although Retry-After with TooManyRequests.

How can I get this parameter in the response? Perhaps you need to specify additional parameters for this? Or set up Tenant for this?

Or is there another way to view throttle-limit?

Thanks in advance for your reply)

microsoft-graph-usersmicrosoft-graph-throttling
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @JSG-3345, would you mind providing the API you are using?

0 Votes 0 ·
JSG-3345 avatar image JSG-3345 ZehuiYaoMSFT-7151 ·

I am using GraphServiceClient to get a client
https://docs.microsoft.com/en-us/graph/sdks/create-client?tabs=CS

In Batch request I am wrapping multiple requests to get users info

List<string> requestIds = new List<string>();
BatchRequestContent batchRequestContent = new BatchRequestContent();
foreach (string id in userIds) {
var request = _graphClient.Users[id].Request().Select("aboutMe, birthday, hireDate, interests, mySite, pastProjects, preferredName, responsibilities, schools, skills, id");
string requestId = batchRequestContent.AddBatchRequestStep(request);
requestIds.Add(requestId);; }

and to get a response

foreach (string requestId in requestIds) {
User user = await returnedResponse.GetResponseByIdAsync<User>(requestId); }

I am using MS graph api v 1.0 version
I also have my own ResponseHandler in which I view requests and responses from the GraphServiceClient

List<DelegatingHandler> handlers = new List<DelegatingHandler>
{ new Handlers.ResponseHandler(), new AuthenticationHandler(authProvider), new CompressionHandler(), new RetryHandler(), new RedirectHandler(), };
HttpClient httpClient = GraphClientFactory.Create(handlers);
new GraphServiceClient(httpClient);

0 Votes 0 ·

1 Answer

ZehuiYaoMSFT-7151 avatar image
0 Votes"
ZehuiYaoMSFT-7151 answered

Hi @JSG-3345, As you mentioned in another post, the properties you requested is not stored in Azure AD,and cannot be obtained through the API.

At the same time, it is possible that your number of requests has not reached the limit according to the documentation, so the header does not appear.

175259-image.png

I recommend opening a support ticket for more details on throttling and getting properties stored outside of the main data store.


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



image.png (11.4 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.