How to make HTTP call with action=PATCH using CFHTTP ( ColdFusion 10 )

拥有回忆 提交于 2020-01-04 04:10:10

问题


I was integrating a REST API of iCIMS and found some of the REST API calls need the http verb PATCH. However, it seems ColdFusion 10 doesn't support that. Is there any way around this?


回答1:


This was not added until ColdFusion 11 update 3.

Most API services allow you to use POST instead of PATCH. From the docs for iCIMS it appears they accept either POST or PATCH as well.




回答2:


Working with iCIMS API also here, but on CF 9, so no support for PATCH. But I did find that you can do a POST and then override that with an additional header: X-HTTP-Method-Override: PATCH

On iCIMS API, the PATCH method is required to update some data vs. a POST which creates a new entry. So something like the following should work.

<cfhttp method="post" url="api.icims.com/customers/1234/people/1289/fields/phones/332">
<cfhttpparam type="header" name="Authorization" value="Basic #auth_string#" >
<cfhttpparam type="header" name="X-HTTP-Method-Override" value="PATCH">
<cfhttpparam type="body" value="#your_json#" >
</cfhttp>


来源:https://stackoverflow.com/questions/28689612/how-to-make-http-call-with-action-patch-using-cfhttp-coldfusion-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!