web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Web API : Method Tunneling through POST

(0) ShareShare
ReportReport
Posted on by

Hello,

I'm using Dynamics CRM 2016 online and I want to update a contact using the Web API (odata) endpoint.

I use Fiddler to test the request. Here are the détails of the request :

PATCH https://XXXXXXXXXXX/api/data/v8.0/contacts(6b902ae1-19ed-e511-80e3-5065f3890551)
User-Agent: Fiddler Host: XXXXXXXXX Content-Length: 54 Accept: application/json OData-MaxVersion: 4.0 OData-Version: 4.0 Content-Type: application/json Authorization: Bearer XXXXXXXX { "firstname": "John", "lastname": "Doe" }

It works well. The problem is that the client does not support the PATCH verb.

An odata endpoint can handle this limitation by using POST and a additional HTTP header. Quote from the documentation :

In order to help work-around this limitation, OData servers can support method tunneling through POST. The methods that can be executed through tunneling are MERGE, PUT and DELETE.

To issue a request with method tunneling a client sets up a request with body and headers as needed, but uses POST as the HTTP method instead of the actual required one. It then adds one more header, "X-HTTP-Method", and gives it the value MERGE, PUT or DELETE.

Servers must check if POST requests have the X-HTTP-Method header set to one of the valid values and if so execute the rest of the request as if the header value was the actual HTTP method for it.

But when I try to execute the same request using POST instead of PATCH and with the additional header, I receive a error :

message=Unmapped Request found, PathTemplate:~/entityset/key, HttpVerb:POST


I also try the X-HTTP-Method-Override header as described here but same result.

Is there a mistake from my side or the endpoint does not support this feature ?

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at
    RE: Web API : Method Tunneling through POST

    Hi, 

    I have the same issue to make a PATCH call request to web API and didn't find any solution. 

    I've also tried appending the '?_HttpMethod=PATCH' to endpoint URL but it throws the same error. 

    Can anyone please help us to resolve the issue.

    Thanks,

    Sandip

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
Christoph Pock Profile Picture

Christoph Pock 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans