CFHTTP PUT without a physical file

Posted by E-Madd on Stack Overflow See other posts from Stack Overflow or by E-Madd
Published on 2010-04-28T20:12:09Z Indexed on 2010/04/28 20:17 UTC
Read the original article Hit count: 255

Filed under:

I'm trying to communicate with an API that requires JSON payloads via PUT method. Is it possible to do this in CFHTTP with CFHTTPPARAM without first writing a file? My code currently looks like this...

<cfset json = "{'key':'value'}">
<cffile action="write" file="#ExpandPath('./test.js')#" output="#json#" />
<cfhttp method="put" url="http://servicedomain.com/api/method/" resolveurl="no" username="username" password="password">
    <cfhttpparam mimetype="application/json" type="file" name="payload" file="#ExpandPath('./test.js')#" />
</cfhttp>

© Stack Overflow or respective owner

Related posts about coldfusion