Forum Discussion

phani's avatar
phani
Advisor
10 years ago

PATCH request with http.client FreeMarker Context Object

Hi,

 

Can anyone suggest how to executes a HTTP PATCH request using http.client FreeMarker Context Object.

 

Thanks,

Phani

  • phani's avatar
    phani
    6 years ago

    HI KevinSaquing ,

     

    Yes, it is possible by passing header X-HTTP-Method-Override  = PATCH. Following is the syntax.

    <#assign response = http.client.request(API).header("X-HTTP-Method-Override", "PATCH").post()/>
     
    Thanks,
    Phani
     

5 Replies

  • phani's avatar
    phani
    Advisor
    6 years ago

    HI KevinSaquing ,

     

    Yes, it is possible by passing header X-HTTP-Method-Override  = PATCH. Following is the syntax.

    <#assign response = http.client.request(API).header("X-HTTP-Method-Override", "PATCH").post()/>
     
    Thanks,
    Phani
     
  • phani's avatar
    phani
    Advisor
    6 years ago

    This is strange, I am using the same code in multiple endpoints without any issue. Are you seeing any FreeMarker exceptions? will you able to debug on the other end (API) whether the request is coming or not? 

    http.clinet.request freemarker context object will throw exception if the API status code is other than 200, maybe check API status code as well.

  • Thanks for the suggestion but maybe its on Salesforce end. The solution for my problem is fixed by adding Salesforce parameter 🙂