简体   繁体   English

Microsoft graph api 更新事件返回 HTTP 错误 400 错误请求

[英]Microsoft graph api update event returns HTTP error 400 bad request

I am using MS Graph API in Pega 8.6.4 to update an event start and end date, attendees, and location if needed using PATCH but would always get an HTTP error 400 BAD REQUEST.我在 Pega 8.6.4 中使用 MS Graph API 来更新活动开始和结束日期、参与者和位置(如果需要)使用 PATCH,但总是会收到 HTTP 错误 400 BAD REQUEST。 Not sure what is going on since in my application I am able to create an event and cancel it.不确定发生了什么,因为在我的应用程序中我能够创建一个事件并取消它。

Request data:
{Request Message={"subject":"X",
"start":{"timeZone":"W. Europe Standard Time","DateTime2":"20220727T103000.000 GMT"},
"end":{"timeZone":"W. Europe Standard Time","DateTime2":"20220727T113000.000 GMT"},
"location":{"uniqueIdType":"private","displayName":"X","locationType":"default","uniqueId":"X"},

"body":{"contentType":"html",
"content":"<html> \t<body> \t\t<p>Afspraak met: X</p> \t\t<p>X \nANTWERPEN </p> \t\t<p>E-mailadres: X</p> \t\t<p>Telefoonummer: X</p> \t\t<p>Klantnummer: 45</p> </body> </html> "}}} 

Method: PATCH
URL: https://graph.microsoft.com/v1.0/users/{userprincipalname}/events/{EventID}
Request header: {Content-Type = "application/json"}

Here the problem is with the properties of start property.这里的问题在于start属性的属性。 As you can see this documentation of event object , there is a property called start to specify the start time of an event.正如您可以看到事件 object 的此文档,有一个名为 start 的属性来指定事件的开始时间。 If you obseve, it is of type DateTimeTimeZone object.如果您观察到,它的类型是DateTimeTimeZone object。 If you check the properties for this object, you can see that we have dateTime and timeZone .如果您检查此 object 的属性,您可以看到我们有dateTimetimeZone

Now just if you compare these properties with the data you are giving in JSON, you can see that in your JSON data the property is DateTime2 but according to documentation it has only those above two properties only, one of which is dateTime , so simply modify your JSON data property to dateTime and value to something like the format shared here with example.现在,如果您将这些属性与您在 JSON 中提供的数据进行比较,您可以看到在您的 JSON 数据中,该属性是DateTime2但根据文档,它只有上述两个属性,其中一个是dateTime ,所以只需修改您的 JSON 数据属性为dateTime和值,类似于此处与示例共享的格式。

Below screenshot is the sample JSON used from your data and it was successful.下面的屏幕截图是从您的数据中使用的示例 JSON,它是成功的。 在此处输入图像描述

Modified JSON:修改 JSON:

{
"subject": "X",
"start": {
    "timeZone": "W. Europe Standard Time",
    "dateTime": "2022-07-27T10:30:00.0000000"
},
"end": {
    "timeZone": "W. Europe Standard Time",
    "dateTime": "2022-07-27T11:30:00.0000000"
},
"location": {
    "uniqueIdType": "private",
    "displayName": "X",
    "locationType": "default",
    "uniqueId": "X"
},
"body": {
    "contentType": "html",
    "content": "<html> <body> <p>Afspraak met: X</p> <p>X ANTWERPEN </p> <p>E-mailadres: X</p> <p>Telefoonummer: X</p> <p>Klantnummer: 45</p> </body> </html> "
}

} }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 部署更新API时如何解决400错误的错误请求 - How to resolve 400 error with bad request in update api when it is deployed 图形 API - 获取“远程服务器返回错误:(400)错误请求。”使用多租户请求 AccessToken 时出错 - Graph API - Getting "The remote server returned an error: (400) Bad Request."Error while request AccessToken using multiTenant .NET Core API调用在发布后返回400 Bad请求 - .NET Core API call returns 400 Bad request after publish Web api:400 错误请求 - Web api: 400 bad request ASP.NET 核心 5,带有来自正文的参数的 HttpPut 请求始终返回 Http 400 错误请求 - ASP.NET Core 5, HttpPut request with parameters from body always returns Http 400 Bad request Microsoft Graph Api - 请求不起作用 - Microsoft Graph Api - request not working WebSocket错误:错误的HTTP响应。 状态码400,请求错误 - WebSocket Error: Incorrect HTTP response. Status code 400, Bad Request Blazor 错误 400,ReasonPhrase 错误请求版本:1.1 System.Net.Http.BrowserHttpHandler - Blazor Error 400,ReasonPhrase Bad Request Version: 1.1 System.Net.Http.BrowserHttpHandler CKEDITOR 文件上传错误请求 400 错误 - CKEDITOR File Upload Bad Request 400 Error Asp.net MVC核心错误请求 - 请求太长HTTP错误400.请求标头的大小太长 - Asp.net MVC core Bad Request - Request Too Long HTTP Error 400. The size of the request headers is too long
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM