Kevin Ferrell

U.S. State Department Travel

Implementing an iOS SDK for State.gov’s Data API

Recently, the Public Affairs office at State.gov released the Select State.gov Data API, which exposes several datasets that are published and routinely updated on State.gov. When I heard about the API, I was really excited that the State Department would be publishing portions of the official travel data for the Secretary and began thinking of several ideas for mobile apps that could use the data.

After giving it some thought, I decided that it would be beneficial to start by creating a reusable iOS SDK for accessing the API data in order to make it easier for the development community to access this data. I was able to convince my company to allow me to donate some of my time to the SDK project, which is now published on Github:

https://github.com/AcuityInfoMgt/DOSDataAPI

The SDK utilizes AFNetworking to interact with the API and I’ve used the concept of manager classes to connect to the API and retrieve model objects that correspond to State.gov data elements. Each function in the manager classes accept a block in order to process the results that are returned by the API. I found this approach much easier to work with than a delegate pattern and it follows the general approach used by the AFNetworking library. The SDK itself doesn’t implement any persistence functions but the API model objects generated by the SDK can be easily stored using CoreData.

I also implemented a series of unit tests to provide full test coverage of the SDK. This has come in very handy in validating the SDK code and has helped me to quickly spot minor regressions when the State.gov team tweaked the API that was still in development.

I’m in the process of finalizing a new iPhone app that uses the SDK and will be available on the Apple App Store soon.  Developing an app in conjunction with the SDK was helpful in guiding design decisions in order to make the SDK easy for developers to leverage.

I hope others make use of the SDK and the data that’s available. The dataset from State.gov is interesting and I think there are some useful insights that can be drawn from the info with a bit of analysis.

Discussion Closed

New comments are not allowed on this post.