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. 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." But I am including the If-Match header, just might not be entering it correctly.
The URL is: "https://graph.microsoft.com/v1.0/planner/tasks/" & $microsoftplannerTaskID
The CURLOPTIONS, I am entering within FileMaker is ...
"-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
When I CREATE the task initially, the response show … "@odata.etag":"W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="" Which I am using in the cURL header above. BUT … I am stripping the W/ and the quotes. 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.
Here is Microsoft’s UPDATE PLANNERTASK reference … 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.
I can get it to work in Postman and in there I have entered for the Plan ETag variable this … W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="
I notice in postman the header shows etag is W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="
And the body returns as "@odata.etag": "W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="",
It’s got to be a simple syntax issue with my curloption variable, but I can’t figure it out.
I also tried removing the W/ in the If-Match header, so it looks like this: -H "If-Match: "JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc=""
And the extra quotes in the If-Match header, so it looks like this: -H "If-Match: JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="
All of these result in the same “if-match” error.
One interesting thing …if I change the If-Match to include a slash in front of the quotes
-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. Makes sense though, since it is reading this as “if-match: ”
And same thing if I add the W/ back in -H "If-Match: W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc="" Gives me error 10 as well
If you have any thoughts, I would greatly appreciate your help!!