How to fix MaxRequestDurationExceeded" or "gatewayTimeoutUncategorized" in microsoft graph API?

Singh, Preeti 0 Reputation points
2023-02-17T01:45:41.5933333+00:00

Hi,

I am trying to read an excel sheet (~46 MB). When I try to read it using the api I get error code"MaxRequestDurationExceeded". I know that there are suggested ways to batch the requests, but how will you batch a request to read an excel sheet?

-Preeti

Microsoft 365 and Office Excel For business Windows
Microsoft Security Microsoft Graph
{count} votes

2 answers

Sort by: Most helpful
  1. Siddharth Gautam 860 Reputation points
    2023-02-17T12:52:18.43+00:00

    Hello Singh, Preeti,

    Thanks for reaching out!

    The errors "gatewayTimeoutUncategorized" defines service wasn’t able to complete the request within the time limit.

    You can refer below screenshots.

    User's image

    For handling the errors like "gatewayTimeoutUncategorized" which is fall under second-level error codes, please refer the link.

    JSON batching allows you to optimize your application by combining multiple requests (up to 20) into a single JSON object. Please refer the below screenshot of batch request for excel API.

    POST https://graph.microsoft.com/v1.0/$batch
    

    Screenshot 2023-02-17 181010

    Please refer the below link for Json Batching.

    Batching

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.

    0 comments No comments

  2. Zehui Yao_MSFT 5,876 Reputation points
    2023-02-20T09:09:05.1766667+00:00

    Hi @Singh, Preeti , I can reproduce your problem locally, I think the error is probably caused by the large file (I read almost 40MB of the file).

    Then I can solve this problem by using workbook session.

    So, you can also try this method, because the workbook-session-id: {session-id} header can improve performance. This is explained in the documentation.

    User's image

    The way it was created is shown in my screenshot below.

    For more information, you can refer to the documentation:

    https://learn.microsoft.com/en-us/graph/api/workbook-createsession?view=graph-rest-1.0&tabs=http

    https://learn.microsoft.com/en-us/graph/api/resources/excel?view=graph-rest-1.0

    Hope that can help you. Best Wishes.

    User's image

    User's image

    User's image


    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.


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.