Graph API日历批量请求偶现非标准JSON响应无法反序列化问题咨询
Microsoft Graph 日历批量请求响应格式异常问题
调用Microsoft Graph API提交日历预约批量请求时,极少出现API返回格式异常问题:原始HTML内容会被直接注入JSON响应中,导致响应无法正常反序列化,也无法定位具体哪条预约请求出错,只能重发完整的批量请求,产生额外的性能损耗。
批量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 ... } ] }
期望官方调查该问题,确保即使接口返回503等错误状态时,也能输出符合JSON规范的响应内容。
注:此前已反馈过该Bug,自动回复给出的解决方案均不适用。
内容的提问来源于stack exchange,提问作者jwissocq
相关产品推荐
相关产品推荐

