Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An example of using the HiringThing API using ColdFusion
<!--- Set the Variable Name for the Jobs --->
<cfset jsonDoc = '' />
<!--- Call the Endpoint --->
<cfhttp method="get" url="http://{YourHost}/remote/jobs/active" username="{UserName}" password="{Password}" result="get" >
</cfhttp>
<!--- Set the Variable for the data retunred and deserialize it --->
<cfset jsonDoc = DeserializeJSON(get.filecontent) />
<!--- Set the Variable for the Array --->
<cfset activeJobs = jsonDoc />
<!--- See how many jobs are returned --->
<cfset size = ArrayLen(activeJobs) />
<!--- In this section we will create a query and take the contects of the array and convert it into a query, which is easier to work with --->
<cfset qJobs = QueryNew("Abstract, Archived, City, Company, Country, Created_At, Description, ID, Job_Code, State, Title, URL") >
<cfset temp = QueryAddRow(qJobs, #size#)>
<cfloop index="i" from = "1" to = #size#>
<cfset node = jsonDoc[i] />
<cfset temp = QuerySetCell(qJobs, "Abstract", #node.Abstract#, #i#)>
<cfset temp = QuerySetCell(qJobs, "Archived", #node.Archived#, #i#)>
<cfset temp = QuerySetCell(qJobs, "City", #node.City#, #i#)>
<cfset temp = QuerySetCell(qJobs, "Company", #node.Company#, #i#)>
<cfset temp = QuerySetCell(qJobs, "Country", #node.Country#, #i#)>
<cfset temp = QuerySetCell(qJobs, "Created_At", #node.Created_At#, #i#)>
<cfset temp = QuerySetCell(qJobs, "Description", #node.Description#, #i#)>
<cfset temp = QuerySetCell(qJobs, "ID", #node.ID#, #i#)>
<cfset temp = QuerySetCell(qJobs, "Job_Code", #node.Job_Code#, #i#)>
<cfset temp = QuerySetCell(qJobs, "State", #node.State#, #i#)>
<cfset temp = QuerySetCell(qJobs, "Title", #node.Title#, #i#)>
<cfset temp = QuerySetCell(qJobs, "URL", #node.URL#, #i#)>
</cfloop>
<!--- Now we output the query data on the page, formatted however we like. --->
<cfoutput query="qJobs">
<h2>#qJobs.Title#</h2>
<a href="#qJobs.URL#" target="_new">Apply for this Position</a>
<p>#qJobs.Description#</p>
<p><strong>Location:</strong> #qJobs.City#, #qJobs.State#<br />Job ID: #qJobs.ID#</p>
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment