Graph sometimes returns html response even when json is requested

AP 0 Reputation points
2024-04-17T06:33:54.43+00:00

We have a golang application which uses graph SDK to do exchange/onedrive/sharepoint API calls. We set Accept header to application/json. But sometimes, graph server returns responses in text/html format, which causes content type text/html does not have a factory registered to be parsed error in the graph SDKs code which processes the response.

Can MSFT please fix this on graph server end? Or maybe provide a mechanism in the graph SDK to format this response as json and pass it down to the application? Right now we cannot track & interpret these responses since we see a blanket content type text/html does not have a factory registered to be parsed error, which is not really of much use.

E.g.

  1. Do a GET https://graph.microsoft.com/v1.0/users/user-id/message/message-id request to graph.
  2. Graph sometimes returns html response. An example below.
  3. We see this behavior across services, not just exchange.
  4. This is not a client side error.
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"..."}}
<!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>
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,670 questions
{count} votes