向 Microsoft Calender Create Event Api 发送发布请求后出现“UnableToDeserializePostBody”错误

问题描述 投票:0回答:1

下面是我使用访问令牌和 application/json 内容类型传递的 json。

{
    "isOnlineMeeting": true,
    "subject": "Work Today",
    "attendees": [
        {
            "emailAddress": {
                "address": "[email protected]",
                "name": "Mohit Gupta"
            },
            "type": "required"
        }
    ],
    "start": {
        "dateTime": "2023-05-04T16:00:00",
        "timeZone": "India Standard Time"
    },
    "onlineMeetingProvider": "teamsForBusiness",
    "end": {
        "dateTime": "2023-05-04T16:30:00",
        "timeZone": "India Standard Time"
    },
    "body": {
        "subject": "HTML",
        "content": "I am working hard"
    }
}

在此 api 上的 POST 请求后 - https://learn.microsoft.com/en-us/graph/api/calendar-post-events?view=graph-rest-1.0&tabs=http

POST /users/{id}}/calendar/events

我收到以下错误。 发生异常 org.springframework.web.client.HttpClientErrorException$BadRequest: 400 错误请求:

[
    {
        "error": {
            "code": "UnableToDeserializePostBody",
            "message": "were unable to deserialize "
        }
    }
]

找不到问题。

microsoft-graph-api httpresponse
1个回答
0
投票

我想这个问题在

...
"body": {
    "subject": "HTML",
    "content": "I am working hard"
}
...

物业应该是

contentType
不是
subject

"body": {
    "contentType": "HTML",
    "content": "I am working hard"
}
© www.soinside.com 2019 - 2024. All rights reserved.