Throttled. Individual requests 429 but overall batch response is 200

Chris A 10 Reputation points
2023-04-27T12:53:49.6166667+00:00

I am working on an app in which I need to create To-Do tasks, often around 20 at a time. I have been throttled and individual requests in a batch are coming back as status 429, but the overall response is still 200.

From the docs (https://learn.microsoft.com/en-us/graph/throttling#throttling-and-batching)

Requests in a batch are evaluated individually against throttling limits and if any request exceeds the limits, it fails with a status of 429 and an error similar to the one provided above. The batch itself fails with a status code of 424 (Failed Dependency)

Also I seem to be able to make individual requests immediately after eachother and not suffer throttling, but with batch requests I'm suffering throttling. I was under the impression that batching was the better practice to avoid throttling.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,871 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Antonio 250 Reputation points Microsoft Vendor
    2023-04-28T20:11:23.6566667+00:00

    Hi Chris A ,

    Thank-you of posting in the Q&A forum.

    Correct batch processing is a part of effective best practice strategy to process GRAPH API request processing.
    However, throttling it is possible for multiple requests to be throttled in a single batch. You should retry each failed request from the batch using the value provided in the retry-after response.

    Throttling and batching

    Best practices to avoid throttling

    Programming patterns like continuously polling a resource to check for updates and regularly scanning resource collections to check for new or deleted resources are more likely to lead to applications being throttled and degrade overall performances. You should instead leverage change tracking and change notifications when available.

    Note Best practices for discovering files and detecting changes at scale describes best practices in details.

    Throttling and batching

    JSON batching allows you to optimize your application by combining multiple requests into a single JSON object. Requests in a batch are evaluated individually against throttling limits and if any request exceeds the limits, it fails with a status of 429 and an error similar to the preceding sample response. The batch itself fails with a status code of 424 (Failed Dependency). It is possible for multiple requests to be throttled in a single batch. You should retry each failed request from the batch using the value provided in the retry-after response header from the JSON content. You may retry all the failed requests in a new batch after the longest retry-after value. If SDKs retry throttled requests automatically when they are not batched, throttled requests that were part of a batch are not retried automatically.

    Another good learning resources (with real world exercise examples) on how to avoid throttling & implementation of throttling strategies.

    Optimize network traffic with Microsoft Graph

    A status code of 200 only indicates that the JSON code was parsed correctly. However, the individual requests apart have a status code.

    https://learn.microsoft.com/en-us/graph/json-batching#response-format

    The status code on a batch response is typically 200 or 400. If the batch request itself is malformed, the status code is 400. If the batch request is parseable, the status code is 200. A 200 status code on the batch response does not indicate that the individual requests inside the batch succeeded. This is why each individual response in the responses property has a status code.

    The code (424) reference for sequencing requests with the dependsOn property defined within the JSON block.

    https://learn.microsoft.com/en-us/graph/json-batching#sequencing-requests-with-the-dependson-property

    If an individual request fails, any request that depends on that request fails with status code 424 (Failed Dependency).

    The throttling paragraph implication is that sequencing requests is enabled and would fail with error code (424).

    You can leave feed back for the page for any further clarification in wording.

    --please don't forget to upvote and Accept as answer if the reply is helpful--


  3. Youssef Salib 0 Reputation points
    2023-08-08T06:37:01.8566667+00:00

    Hi Chris A,

    were you able to solve the throttling issue for $Batch endpoint. I am developing a feature that depends on Batch call to Teams Graph API. I am making up to 3 batch calls in my application (41 requests total) , But I am getting throttling error every other request. Do you have any pointers or any suggestions (other than retry-after property)? Thank you


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.