简体   繁体   English

用于更新 Microsoft Planner 任务的 Microsoft Graph REST API?

[英]Microsoft Graph REST API to UPDATE Microsoft Planner Tasks?

I think this might be a simple quote escape issue, but can't figure it out.我认为这可能是一个简单的引用转义问题,但无法弄清楚。

I am trying to update a microsoft planner task using CURL with REST API.我正在尝试使用带有 REST API 的 CURL 更新 microsoft planner 任务。 I can CREATE tasks (from a custom application called FileMaker to Microsoft Planner using Microsoft Graph API) without issue, but when I try to UPDATE a planner task, I get an error that "The If-Match header must be specified for this kind of request."我可以毫无问题地创建任务(从名为 FileMaker 的自定义应用程序到使用 Microsoft Graph API 的 Microsoft Planner),但是当我尝试更新计划程序任务时,我收到错误消息“必须为此类指定 If-Match 标头”要求。” But I am including the If-Match header, just might not be entering it correctly.但是我包含了 If-Match 标头,只是可能没有正确输入它。

The URL is: "https://graph.microsoft.com/v1.0/planner/tasks/" & $microsoftplannerTaskID URL 是:“https://graph.microsoft.com/v1.0/planner/tasks/” & $microsoftplannerTaskID

The CURLOPTIONS, I am entering within FileMaker is ...我在 FileMaker 中输入的 CURLOPTIONS 是...

"-X PATCH " & " -H "Authorization: Bearer " & $$userToken & """ & " -H "Content-Type: application/json"" & " -H "If-Match: " & $microsoftPlannerTasketag & """ & " -d @$PlannerTaskDetails" "-X PATCH " & " -H "Authorization: Bearer " & $$userToken & """ & " -H "Content-Type: application/json"" & " -H "If-Match:" & $microsoftPlannerTasketag & """ & " -d @$PlannerTaskDetails"

ENDS UP LOOKING LIKE THIS … -X PATCH -H "Authorization: Bearer wEXu<>k_QQY" -H "Content-Type: application/json" -H "If-Match: W/"JzEtVGFzayAgQEBAQEBAQBAQEBARCc="" -d @$PlannerTaskDetails最终看起来像这样…… -X PATCH -H "Authorization: Bearer wEXu<>k_QQY" -H "Content-Type: application/json" -H "If-Match: W/"JzEtVGFzayAgQEBAQEBAQBAQEBARCc="" -d @$PlannerTaskDetails

When I CREATE the task initially, the response show … "@odata.etag":"W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="" Which I am using in the cURL header above.当我最初创建任务时,响应显示... "@odata.etag":"W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="" 我在上面的 cURL 标头中使用了它。 BUT … I am stripping the W/ and the quotes.但是……我正在剥离 W/ 和引号。 The W/ means it is a “weak”, and I assume we don't include that in the PATCH header, but I did try adding it anyway with no success. W/ 意味着它是一个“弱”,我假设我们没有将它包含在 PATCH 标头中,但我确实尝试添加它但没有成功。

Here is Microsoft's UPDATE PLANNERTASK reference … https://docs.microsoft.com/en-us/graph/api/plannertask-update?view=graph-rest-1.0&tabs=http这是微软的 UPDATE PLANNERTASK 参考…… https://docs.microsoft.com/en-us/graph/api/plannertask-update?view=graph-rest-1.0&tabs=http

I can update tasks using POSTMAN without issue, but I dont know what their header looks like when it sends the request.我可以毫无问题地使用 POSTMAN 更新任务,但我不知道它们在发送请求时的标头是什么样的。

I can get it to work in Postman and in there I have entered for the Plan ETag variable this … W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="我可以让它在 Postman 中工作,在那里我已经为 Plan ETag 变量输入了这个...... W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="

I notice in postman the header shows etag is W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="我注意到邮递员的标题显示 etag 是 W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="

And the body returns as "@odata.etag": "W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="",正文返回为 "@odata.etag": "W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="",

It's got to be a simple syntax issue with my curloption variable, but I can't figure it out.我的 curloption 变量一定是一个简单的语法问题,但我无法弄清楚。

I also tried removing the W/ in the If-Match header, so it looks like this: -H "If-Match: "JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc=""我还尝试删除 If-Match 标头中的 W/,所以它看起来像这样: -H "If-Match: "JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc=""

And the extra quotes in the If-Match header, so it looks like this: -H "If-Match: JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="以及 If-Match 标头中的额外引号,因此看起来像这样: -H "If-Match: JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="

All of these result in the same “if-match” error.所有这些都会导致相同的“if-match”错误。

One interesting thing …if I change the If-Match to include a slash in front of the quotes一件有趣的事情……如果我将 If-Match 更改为在引号前包含一个斜杠

-H "If-Match: "JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="" -H "If-Match: "JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc=""

I get an error 10 “requested data is missing” in Filemaker's script debugger and no response from the insert from url statement.我在 Filemaker 的脚本调试器中收到错误 10“请求的数据丢失”,并且从 url 语句插入没有响应。 Makes sense though, since it is reading this as “if-match: ”有道理,因为它把这个读作“if-match:”

And same thing if I add the W/ back in -H "If-Match: W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="" Gives me error 10 as well同样的事情,如果我将 W/ 添加回 -H "If-Match: W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="" 也会给我错误 10

If you have any thoughts, I would greatly appreciate your help!!如果您有任何想法,我将非常感谢您的帮助!!

Try this:尝试这个:

"-X PATCH " & 
"-H " & quote("Authorization: Bearer " & $$userToken) & 
"-H " & quote("Content-Type: application/json") &
"-H " & quote("If-Match: W/" & quote($microsoftPlannerTasketag)) &
"-d @$PlannerTaskDetails"

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM