Project: Warm Up: Taming the API

Preparing the final project by getting its innards in order, starting with a well-designed API wrapper.

Scroll down...




When building your Political Tracking app, you will be completely reliant upon a third-party API for the data. We recommend using the free Sunlight Congress API (their documents mention the need for an API key, but this is no longer required).

Your first task will be to investigate and experiment w/ the API, figuring out both what data you want and then how best to get it. Once you know what you need, you will write a JavaScript Module that gives you straightforward methods and objects for dealing with the API and the data it returns.

But first things first...

Getting Started

  1. Go to the Github Repo for this project. It's basically just a README file.
  2. Fork a copy of this repo for yourself.
  3. Clone your forked copy to your local machine.
  4. Crack your knuckles. You're now ready to go!

Researching the API

Start by understanding the API. Make a list of the data you need and then read the Sunlight Congress API documentation and take note of which endpoints and query parameters seem useful. Ideally, you should make as few API hits and retrieve as little data as possible. The more thought you put into this, the easier it will be to write the functions wrapping and processing the data.

Wrapping the API

Once you know what you want and how to retrieve it, it's time to encode that knowledge into your program. Here's is where you'll create a Node.js module full of helpful functions. You should have at least the following behavior:

  • A method for grabbing a list of legislators based upon a given zip code.
  • A method for parsing the JSON data into objects (Legislators, Bills, etc.).
  • A method for retrieving the bills recently voted upon by a given legislator.
    • Make sure you include how the legislator voted.
  • Any other methods or objects you find useful

Once you're done, continue to the next exercise, where you will use your new functions to turn the data into a web application.

Solution 300 Pull request 300 Octocat 300

Sign up to track your progress for free

There are ( ) additional resources for this lesson. Check them out!

There are no additional resources for this lesson just yet!

Sorry, comments aren't active just yet!

Next Lesson: Main Event: Building the App