Tuesday, November 27, 2018

Sample ColdFusion Code to Send POST Request to RESTlets

 

Below is a sample ColdFusion code to send a POST request to a RESTlet:

<cfset data='{"test":13}'>
<cfhttp url="https://rest.netsuite.com/app/site/hosting/restlet.nl?script=108&deploy=1" method="POST" resolveurl="Yes" result="results"> 
 <cfhttpparam type="Header" name="Content-Type" value="application/json">
 <cfhttpparam type="Header" name="Authorization" value="NLAuth nlauth_account=TSTDRV1234,nlauth_signature=password,nlauth_email=email@netsuite.com,nlauth_role=3">
 <cfhttpparam type="Header" name="User-Agent" value="NetSuite">
        <cfhttpparam type="body" value="#data#">
</cfhttp>
<cfset out=results.filecontent>
<cfoutput>
<cfdump var="#results#">
</cfoutput>

 

 

No comments:

Post a Comment