microsoft-graph-api

Graph JSON response seldom contains raw HTML


When I send batch request made of calendar appointment request to Graph API, I seldom encounter a improper response from the API: some XML are injected as is in the JSON response. This is impossible to unserialize, so I cannot know which appointment had issues, and it leaves no choice but to reiterate the same calendar appointments batch, which poses performance issue.

The request to batch API looks as follow (I intentionally hide information with *** in the post data below and did not show with ... the 3 others requests to calendar Graph API)

POST https://graph.microsoft.com/v1.0/$batch
Accept: application/json
Content-Type: application/json

{
    "requests": [
        {
            "id": "33",
            "method": "PATCH",
            "url": "/me/calendars/***/events/***",
            "body": {
                "subject": "***",
                "location": {
                    "displayname": "***"
                },
                "body": {
                    "content": "***"
                },
                "categories": ["***"],
                "start": {
                    "dateTime": "2021-05-12 06:00:00",
                    "timeZone": "UTC"
                },
                "end": {
                    "dateTime": "2021-05-12 07:00:00",
                    "timeZone": "UTC"
                },
                "showAs": "free",
                "isReminderOn": false,
                "reminderMinutesBeforeStart": 0,
                "singleValueExtendedProperties": [{
                        "id": "String {***} Name ***",
                        "value": "***"
                    }
                ]
            },
            "headers": {
                "Content-Type": "application/json"
            }
        }, {
           "id": "34",
            ...
        }
    ]
}

This is what I seldom get (before and later on, the same id worked just fine)

{
    "responses": [
        {
            "id": "33",
            "status": 503,
            "headers": {
                "Content-Type": "text/html; charset=us-ascii"
            },
            "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>
        }, {
            "id": "34",
            "status": 200
            ...
        }
    ]
}

Could you please investigate this issue and render a proper JSON response in any case, even if it fails with a 503 response?

Note: I reported this bug at https://github.com/microsoftgraph/microsoft-graph-docs/issues/12951 but none of the solution provided by the automated closing message was relevant.


Solution

  • I rather reported the bug to the right github repo https://github.com/microsoftgraph/msgraph-sdk-serviceissues/issues/93