图 JSON 响应很少包含原始 HTML
Graph JSON response seldom contains raw HTML
当我向 Graph API 发送由日历约会请求组成的批处理请求时,我很少遇到来自 API 的不正确响应:一些 XML 被注入 JSON回应。
这是不可能反序列化的,所以我不知道哪个约会有问题,而且别无选择,只能重复相同的日历约会批次,这会带来性能问题。
批处理 API 的请求如下所示(我故意在下面的 post 数据中用 *** 隐藏信息,并没有显示...其他 3 个对日历图的请求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",
...
}
]
}
这是我很少得到的(之前和之后,相同的id都可以正常工作)
{
"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
...
}
]
}
您能否调查此问题并在任何情况下都提供正确的 JSON 响应,即使它因 503 响应而失败?
注意:我在 https://github.com/microsoftgraph/microsoft-graph-docs/issues/12951 报告了此错误,但自动关闭消息提供的解决方案 none 是相关的。
我宁愿向右侧报告错误 github 回购 https://github.com/microsoftgraph/msgraph-sdk-serviceissues/issues/93
当我向 Graph API 发送由日历约会请求组成的批处理请求时,我很少遇到来自 API 的不正确响应:一些 XML 被注入 JSON回应。 这是不可能反序列化的,所以我不知道哪个约会有问题,而且别无选择,只能重复相同的日历约会批次,这会带来性能问题。
批处理 API 的请求如下所示(我故意在下面的 post 数据中用 *** 隐藏信息,并没有显示...其他 3 个对日历图的请求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",
...
}
]
}
这是我很少得到的(之前和之后,相同的id都可以正常工作)
{
"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
...
}
]
}
您能否调查此问题并在任何情况下都提供正确的 JSON 响应,即使它因 503 响应而失败?
注意:我在 https://github.com/microsoftgraph/microsoft-graph-docs/issues/12951 报告了此错误,但自动关闭消息提供的解决方案 none 是相关的。
我宁愿向右侧报告错误 github 回购 https://github.com/microsoftgraph/msgraph-sdk-serviceissues/issues/93