Last active
September 26, 2015 00:55
-
-
Save m4dc4p/a90aa925a500ee8d0feb to your computer and use it in GitHub Desktop.
An example of using the HiringThing API using ColdFusion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- 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