Getting a 429 response when attempting to subscribe to calendar - microsoft-graph-api

We previously posted this issue on GitHub regarding concerns over limits for subscribing to calendar changes for rooms: https://github.com/microsoftgraph/microsoft-graph-docs/issues/5709
The answer we got was that "No, there aren't any [limits] that you should be concerned about."
However, we have started to see this response when trying to register a webhook to subscribe to changes to a calendar of a room:
Invalid response - 429:
{
"error": {
"code": "ExtensionError",
"message": "Operation: Create; Exception: [Status Code: 429; Reason: Resource 'MaxTotalRequests' has reached limit of '5000'. Please retry after '9/23/2019 2:20:44 PM']",
"innerError": {
"request-id": "43b79bf3-ddee-4bc3-b436-9caa7bff81ac",
"date": "2019-09-23T14:20:42"
}
}
}
We aren't making any large amount of subscriptions, and we only get this response when we are trying to register subscriptions to calendars of users or resources (i.e. not when making other requests to msgraph which are not related to subscriptions). There was a total of 210 subscription related requests made (either subscribing, extending a subscription, or deleting a subscritpion) between 10min before this error and 10min after. Any guidance?

This isn't really a subscription limit so much as an Exchange Online limit. The message is telling you that you've hit the throttling. Exchange's throttling is based on n requests per 10m window. Your code needs to recognize the HTTP 429 and handle it accordingly.
You find complete details in the Microsoft Graph throttling guidance.

Related

Unable to get call details using MS graph API?

I am unable to get call details or call records using graph api.It's saying forbidden in response although I am using application token.In the docs I don't see any extra permission required for this.
Below are the details:
Method : GET
API CALL : https://graph.microsoft.com/beta/communications/callRecords/ce4e4e99-be1b-4c6e-8c43-22308f968d3e
Response :
{
"error": {
"code": "Forbidden",
"message": "",
"innerError": {
"request-id": "4e603f5c-3ac8-466c-acde-24e40f1d6309",
"date": "2021-06-17T13:51:08",
"client-request-id": "4e603f5c-3ac8-466c-acde-24e40f1d6309"
}
}
}
What is the basic requirement for this do I need to set some permission while call in order to get the call record as I am able to call user through graph API.Call.Records.All permission has been set for record and get data.
Please help.
Thanks in Advance.
The API works as it is with the same request but the only issue is that it will return response after certain cases.
The cases are :
1.The call must has ended.
2.Record has been created in the log of Microsoft which usually takes time.
3.Try running the same API with the same configuration but after around 10-15 minutes you will surely get the response.
Follow the document from MS docs for /communincation/calls. The only etxra thing which is not mentioned is that it return after 15min(approx.) call has ended.
This will help others not to get panic as I was.
Thanks

Microsoft Graph API: UnknownError when i am trying to get a call

I am trying to get the subject (ex. Maths 1) of an online TEAMS meeting via Microsoft Graph API.
When i send a request to https://graph.microsoft.com/v1.0/communications/callRecords/8f4477a7-f5b2-40ed-a165-95519825c9cg in the response there is no value for the subject of the meeting.
So my next move is to send a request to https://graph.microsoft.com/v1.0/communications/calls/8f4477a7-f5b2-40ed-a165-95519825c9cg because the Graph API documentation has the property 'subject' in the response. When i send this request i get this response:
{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"date": "2021-02-10T12:32:19",
"request-id": "9a81a114-8a58-457b-929v-390bda79669g",
"client-request-id": "9a81a114-8a58-457b-929a-490bda79669g"
}
}
}
with a response status code : 500 Interval Server Error from the Graph API.
I have tried this request with different meeting ids but the result is the same.
My API permissions are these:
API Permissions
I would appreciate it if I had a solution to my problem or some other way to find the subject of the meeting.
The reason why you are getting that error is because you are querying the teams meeting as a resource of type 'call' instead of 'event'.
Please use GET https://graph.microsoft.com/v1.0/users/{id |userPrincipalName}/events/{id} using Calendars.Read Application permission when querying as an application or GET https://graph.microsoft.com/v1.0/me/calendar/events/{id} with the Calendars.Read delegated permissions when querying as a signed-in user.
For further reference, have a look at https://learn.microsoft.com/en-us/graph/api/event-get?view=graph-rest-1.0&tabs=http

Teams listChannel Graph API resulting in "Unauthorized error - "Failed to execute Aad backend request GetUsersByObjectIdsRequest"

The teams list channel Graph API has started throw Unauthorized error as below. It use to work fine until yesterday. We are using "ServicePrincipal" for authentication and it has all necessary graph permission. In this case - Group.Read.All
Sample endpoint we are using is as below.
https://graph.microsoft.com/v1.0/teams/dccde580-0fc5-11eb-adc1-0242ac120002/channels.
Since this morning, it is failing continuously with the below error. More over, this is not a beta API.
As per our analysis, it is failing for those teams which has a private channel it. But as per documentation, private channels should be returned in the response as well. I dont understand what could be the issue.
Any idea / hints /help in this regard is really appreciated.
{
"error": {
"code": "Unauthorized",
"message": "Failed to execute Aad backend request GetUsersByObjectIdsRequest. Workload Unknown. Request Url: https://graph.windows.net/myorganization/getObjectsByObjectIds?api-version=1.61-internal, Request Method: POST, Response Status Code: Unauthorized, Response Headers: ocp-aad-diagnostics-server-name: 0yK5pQbb6mmQTig21hH07WmGI0k2nuTime8Zw4wMO7k=\r\nrequest-id: c33c655e-27f7-4f96-aabf-70e6d9d8770d\r\nclient-request-id: 5bd775a7-7dba-4ad7-bc9a-fbd91ae46fea\r\nStrict-Transport-Security: max-age=31536000; includeSubDomains\r\nDate: Fri, 16 Oct 2020 15:23:45 GMT\r\n, Reason Phrase: Unauthorized",
"innerError": {
"date": "2020-10-16T15:23:45",
"request-id": "3f3793b8-02d6-4653-a14f-3e455660e3d8",
"client-request-id": "3f3793b8-02d6-4653-a14f-3e455660e3d8"
}
}
}
We are facing the same issue, and the error exist in some of our test tenants and it will thrown by microsoft when we using the application permission to make the request.
The requests with the delegate permission token work without any issue.
Microsoft adds some Permissons.
https://learn.microsoft.com/de-de/graph/api/channel-list?view=graph-rest-beta&tabs=http
Do you have the application permissons?
Do you use the beta endpoint?
Look at this: https://learn.microsoft.com/de-de/microsoftteams/platform/graph-api/rsc/resource-specific-consent

504 Gateway Timeout (UnknownError) when trying to track changes in a user's calendar

For our internal application we synchronize our user's calendars (in our Office 365 tenant) with a local "cache" in our database. We're using the new Delta Queries in Microsoft Graph to do track these changes.
Most of the calendars synchronize correctly, but for some reason there is one single calendar where we consistently hit a 504 Gateway Timeout error when attempting to request the events using the nextLink received from the first request.
First request:
GET https://graph.microsoft.com/v1.0/users/<userId>/calendars/<calendarId>/calendarView/delta?startDateTime=2017-06-10t00%3A00%3A00Z&endDateTime=2018-06-10t00%3A00%3A00Z
First response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(event)",
"#odata.nextLink": "https://graph.microsoft.com/v1.0/users/<userId>/calendars/<calendarId>/calendarView/delta?$skiptoken=R0usmcdvmMuZCBYV0hguCGmIJqcU0n_6jVFWUlNKbXkBKYVlxLSMsISZI5sLLLJyLJF8hZIj0PURpAeP_XxydW_qbMUoFMTXjOpLa8Ta6rxMRA7Wv6IHYfjyLPcDzCbM_hKvTgq8BZaBeJv-a61mebF6X2wT4HqCAGL5lL4nLZabHk1nD9GbWJ0a4Qq0M41_GPYxEi5YNe9u1673SQ1Djw.F85xXB6GjtO7myCQCOgFvzp1G7mQB0BvuHQJyn0CICQ",
"value": [
<list of events>
]
}
Second request:
GET https://graph.microsoft.com/v1.0/users/<userId>/calendars/<calendarId>/calendarView/delta?$skiptoken=R0usmcdvmMuZCBYV0hguCGmIJqcU0n_6jVFWUlNKbXkBKYVlxLSMsISZI5sLLLJyLJF8hZIj0PURpAeP_XxydW_qbMUoFMTXjOpLa8Ta6rxMRA7Wv6IHYfjyLPcDzCbM_hKvTgq8BZaBeJv-a61mebF6X2wT4HqCAGL5lL4nLZabHk1nD9GbWJ0a4Qq0M41_GPYxEi5YNe9u1673SQ1Djw.F85xXB6GjtO7myCQCOgFvzp1G7mQB0BvuHQJyn0CICQ
Second response:
504 Gateway Timeout
{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"request-id": "0784cffb-cba7-424b-be1d-74b2bfef5da1",
"date": "2017-07-10T09:11:33"
}
}
}
I've tried executing the script a few times over the last week, but the request consistently fails when using requesting the second page. Other calendars synchronize with no issues, so I don't really know how to debug these kind of issues. Is there anything we can do to resolve this issue?
I'm working with the team that owns Calendar sync to check where the latency in the stack is causing this time out. I'll post as soon as they have root caused this. I may need more info on what is special about this one Calendar encountering this issue.
Thanks,
Sri

sendMail Intermittent Errors

I'm sending messages using the Microsoft Graph REST API. My application is a service/daemon application where I am sending email on a users behalf. I am using the sendMail API (POST /users/{user id}/sendMail ) and this works a very large percentage of the time. The problem is that every so often the following error is returned:
{ "error": { "code": "UnknownError", "message": "", "innerError": { "request-id": "a901d503-8acf-47e7-8f7e-a20311aa0e3b", "date": "2017-01-10T15:06:48" } }}
Any idea what is causing this error and is there a workaround?
The logs show that you're getting a 429 status code (which means throttling).
Is your app sending many requests for the same resource/user? If so, the error docs say this:
Client application has been throttled and should not attempt to repeat the request until an amount of time has elapsed.

Resources