Skip to main content

Notifications

Power Automate - Using Connectors
Answered

Custom Connector - Graph - The If-Match header must be specified for this kind of request

(0) ShareShare
ReportReport
Posted on by

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!

  • MattiasP1 Profile Picture
    MattiasP1 138 on at
    Re: Custom Connector - Graph - The If-Match header must be specified for this kind of request

    Saved me alot of time. Thanks !

  • alanfsrz Profile Picture
    alanfsrz 8 on at
    Re: Custom Connector - Graph - The If-Match header must be specified for this kind of request

    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:

        "@odata.etag": "W/\"JzEtVGFza0RldGFpbHMgQEBAQEBAQEBAQEBAQEBAcCc=\"",

    value to use in the PATCH call:

        "JzEtVGFza0RldGFpbHMgQEBAQEBAQEBAQEBAQEBAcCc="

  • mousman85 Profile Picture
    mousman85 196 on at
    Re: Custom Connector - Graph - The If-Match header must be specified for this kind of request

    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:

    mousman85_0-1649670845826.png

     

  • Verified answer
    Re: Custom Connector - Graph - The If-Match header must be specified for this kind of request

    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=\""
    }

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,495

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,822

Leaderboard

Featured topics