I'm working to integrate Microsoft Graph with a Rails web application. We're trying to send multiple email messages via Graph, but every now and then we get a 503 Service Unavailable
with the following headers and body:
Response headers:
{
"content-type": [
"text/html; charset=us-ascii"
],
"server": [
"Microsoft-HTTPAPI/2.0"
],
"date": [
"Wed, 30 May 2018 22:05:31 GMT"
],
"connection": [
"close"
],
"content-length": [
326
]
}
Response body:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>Service Unavailable</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii">
</HEAD>
<BODY>
<h2>Service Unavailable</h2>
<hr>
<p>HTTP Error 503. The service is unavailable.</p>
</BODY>
</HTML>
We use the POST https://graph.microsoft.com/v1.0/me/sendMail
call to send hundreds of outlook emails. After sending roughly 100-200 emails with the Graph API we get the 503 Service Unavailable
error. This is problematic when we have to send 1000+ customized emails since it is unclear to me how we could properly handle the error without knowing how long to wait before retrying and other Graph API request.
I'm wondering if anyone has run into a similar issue before. I've read about something similar along the lines of client throttling (Microsoft Graph API - Throttling), but in this post, they're getting 409
(with a retry-after
header), not 503
.
Based on the Graph documentations, we're supposed to receive a JSON object that may contain a Retry-After
header. However, as shown above, we're neither getting the Retry-After
header nor a JSON object for the 503
error.