I4A API ColdFusion Example: Difference between revisions

From i4a API Wiki
Jump to navigation Jump to search
(Created page with "i4a API Guide This example shows the basics of making a call to the API and returning the results. <source lang="cfm"> <Cfoutput> <cfset wUrl = "http://development.i4a.co...")
 
No edit summary
Line 3: Line 3:
This example shows the basics of making a call to the API and returning the results.
This example shows the basics of making a call to the API and returning the results.


<source lang="cfm">
<source lang="cfm">
<Cfoutput>
<Cfoutput>
<cfset wUrl = "http://development.i4a.com/i4a/utilities/authenticate.cfc?wsdl">
<cfset wUrl = "http://development.i4a.com/i4a/utilities/authenticate.cfc?wsdl">
<cfset username = "donadmin" />
<cfset username = "donadmin" />
<cfset password = "*******" />
<cfset password = "*******" />
<Cfset site_token = "ACC3937D-15C5-F089-E30E200797E6CB62" />
<Cfset site_token = "ACC3937D-15C5-F089-E30E200797E6CB62" />
<cfset search_url = "http://development.i4a.com/i4a/_api/json/membership.contacts/lastname%20like%20l/" />
<cfset search_url = "http://development.i4a.com/i4a/_api/json/membership.contacts/lastname%20like%20l/" />
Line 27: Line 27:


</Cfoutput>
</Cfoutput>
</source>
</source>


[[category:api]]
[[category:api]]

Revision as of 18:53, 5 April 2011

i4a API Guide

This example shows the basics of making a call to the API and returning the results.

 <Cfoutput>
 <cfset wUrl 		= "http://development.i4a.com/i4a/utilities/authenticate.cfc?wsdl">
 <cfset username		= "donadmin" />
 <cfset password		= "*******" />
<Cfset site_token 	= "ACC3937D-15C5-F089-E30E200797E6CB62" />
<cfset search_url	= "http://development.i4a.com/i4a/_api/json/membership.contacts/lastname%20like%20l/" />

<cfset myConn 		= createObject("webservice",wUrl) />
<cfset admin 		= myConn.authenticateAdmin(username,password,site_token) />
<cfdump var			="#admin#" />
<cfset adminXML		= xmlParse(admin) />
<Cfdump var="#adminXML#">
<Cfset authKey = adminXML.admin.XmlAttributes.authKey>
API URL=#search_url#<br>
<Cfhttp url="#search_url##authKey#" method="GET" result="result" charset="utf-8" />
<cfset contactJSON = result.FileContent />
<hr>Json Packet:<br>
<Cfdump var="#contactJSON#">
<hr>
<cfset contact = deserializejson(contactJSON) />
<cfdump var="#contact#" label="Decoded Json">

</Cfoutput>