UPDATE: I managed to get this thing working!
Turns out, you NEED to send a secure ticket with the call to get a proper response. I have no idea why it worked in Poster without it. There are a couple other parameters that are required which ColdFusion apparently doesn't send by default.
Here is a working call:
<!---MyTicketValue is sent over from the SAML gateway--->
<cfset myTicket = #cookie.MyTicketValue#>
<!---here we set the XML for the POST--->
<cfsavecontent variable="APIxml"><qdbapi><ticket><cfoutput>#myTicket#</cfoutput></ticket><apptoken>c4abnsde36pse7hzurwvjjb4m</apptoken></qdbapi></cfsavecontent>
<!---and this is the post with all necessary headers (don't ask me why they're needed)--->
<cfhttp url="https://workplace.intuit.com/db/main" method="POST" result="objGet">
<cfhttpparam type="header" name="Accept-Encoding" value="gzip,deflate"/>
<cfhttpparam type="header" name="Keep-Alive" value="115" />
<cfhttpparam type="header" name="QUICKBASE-ACTION" value="API_GetUserInfo" />
<cfhttpparam type="header" name="Content-Type" value="application/xml; charset=UTF-8" />
<cfhttpparam type="body" value="#APIxml#" />
</cfhttp>
And this returns a perfect response from the Intuit Workplace.
I am trying to send a call to Intuit's API with Coldfusion. The call must be POSTed to them (through a SAML gateway). A token must be supplied in the header.
I have really no experience with cfhttp, and am totally confused with this whole API call situation. I need some pretty basic assistance here.
Basically, how do I format the cfhttp tag so that I can have this token in the header?
<cfxml variable="API_GetUserInfo">
<qdbapi>
<apptoken>c4abnsdepseds7hdzurwvjjb4m</apptoken>
<email>[email protected]</email>
</qdbapi>
</cfxml>
<cfhttp
url="https://workplace.intuit.com/db/main"
method="POST"
result="objGet">
<cfhttpparam
type="header"
name="Header"
value="QUICKBASE-ACTION:API_GetUserInfo"
/>
<cfhttpparam
type="xml"
name="API_GetUserInfo"
value="#API_GetUserInfo#"
/>
</cfhttp>
Later, I've tried the Poster add on for Firefox.
I can get the call to work just fine with that, but when I try to replicate it in CF, I still can't get a response.
Here's the updated code:
<cfhttp url="https://workplace.intuit.com/db/main" method="POST" result="objGet" >
<cfhttpparam type="header" name="QUICKBASE-ACTION" value="API_GetUserInfo" />
<cfhttpparam type="formfield" name="xml" value="#API_GetUserInfo#" />
</cfhttp>
And in Poster, here's what I'm entering:
URL: https://workplace.intuit.com/db/main
Content Type: xml
Content:
<qdbapi>
<apptoken>c4abnsdepseds7hdzurwvjjb4m</apptoken>
<email>[email protected]</email>
</qdbapi>
and 1 Header:
Name: QUICKBASE-ACTION
Value: API_GetUserInfo
With these settings, I get a correct response.
Any ideas as to what I'm doing wrong with the coldfusion code?