I would like to do a PATCH against the Microsoft Graph API, e.g. https://graph.microsoft.com/v1.0/planner/tasks/{task-id}
Unfortunately, the Custom Connector wraps the If-Match Header in quotes which causes Graph to return a 412: "The If-Match header must be specified for this kind of request". This is the header that it generates:
{ "Authorization": "Bearer eyJ0eXA...", "Content-type": "application/json", "If-Match": "W/\\\"JzEtVGFza0Rld...TCc=\\\"" }
In the Graph Explorer, if I wrap the If-Match Header value in quotes I repro the same result.
So, it looks like the root cause is the fact that the Custom Connector is wrapping the etag in quotes is the problem. I've tried all of the other data types for the Header values, and it wraps them all in quotes.
Seems a pretty basic thing to me (to do a PATCH to the Graph) - what am I missing please community!
Saved me alot of time. Thanks !
your answer is not clear enough.
You mentioned that the "@odata.etag" value has to be grabbed from a GET response, prior to using it in a PATCH. That is correct.
However, there are 2 different APIs for a task,
https://graph.microsoft.com/v1.0/planner/tasks/{task-id}
and
https://graph.microsoft.com/v1.0/planner/tasks/{task-id}/details
Both have their GET and PATCH calls, hence you should get the etag value from the correct API prior to make a PATCH.
It is easy to get confused and treat it as one API and use the PATCH sample given by Graph Explorer while trying to edit on the second API which is incorrect.
It is also necessary to clarify that the etag showed on Graph Explorer needs to get formatted, by erasing the escape character symbols "\"and the "W/"from the begging which indicates a weak entity tag, not taken by the API:
ex: value from GET call:
value to use in the PATCH call:
"JzEtVGFza0RldGFpbHMgQEBAQEBAQEBAQEBAQEBAcCc="
Long shot but i'm having real issues with this still. Below is my query in Graph but can't seem to get any of it to work no matter what format I use for the if-match, I need to be able to update the convthreadID in a task but cannot seem to even change the title:
I found my own answer: my problem was the weak etag syntax that I was using. It does not like this:
W/\"JzEtVG...TCc=\"
nor does it like this:
JzEtVG...TCc=
but it does like this:
"JzEtVG...TCc"
which it (double, escape) wraps in quotes to looks like this, and which works.
{ "Authorization": "Bearer eyJ0e...", "Content-type": "application/json", "If-Match": "\"JzEtVG...TCc=\"" }