ColdFusion GOV Data SDK Sample

Overview

This sample will provide the steps to create a simple ColdFusion application that can consume GOV Data. Following these steps in order will allow your application to operate correctly. Download this project.

Create a New Project

For this sample we are going to create a web site that will consume and list Agency data.
Create a project folder for this sample.
Create a new text document using any text editor and save it as Sample.cfm in the project folder.

Add the SDK To Your Project

Copy the SDK folder into the project folder. You can get this from our GitHub Repository.

Locate Dataset Path

Each Dataset has a Dataset Location path that gives the URL that will be needed
to reach the Dataset on the API. For the standard GOV Agency dataset sample
please use http://api.dol.gov/V1/DOLAgency.

Define the SDK Object

This SDK is used in an object-oriented manner. This provides for cleaner code that is easier to use and maintain. Your first task is to create the object.

Implementing the GOV Data Request

The rest of the code you will be writing will be between the body tags. These next tags could be placed up with the object instantiation above, but if you're combining data from multiple federal agencies, you will likely find yourself using these later on in the document as we are now. Let's set our object's properties (by default, they're "").

Our last step is now to loop through the result and print it to the screen. As you use other agencies' APIs, you may want to cfdump your results first as the structure of the results will vary from API to API.