Day 4 is now behind us. We were tasked to work with another API, although this time a little less crazy than Rick and Morty’s, the Energy Information Administration, that gathers all the data about energy in the US.

Since a good part of the morning was spent trying to figure out how the API worked and what data we could extract from it, I thought I would show you how I went about using this API with Alteryx and how easy it is to set it up,

An API is essentially a manual that gives you the rules to follow to access a website data. Depending on how well or badly designed it is the experience can be pretty smooth or turn into a nightmare..! Thankfully this API was well documented and I could easily find what I was looking for. I wanted to look at the energy production at the state level, so I found the base URL to retrieve this data:

http://api.eia.gov/series/?api_key=YOUR_API_KEY_HERE&series_id=SEDS.CLPRB

From there I had to create a formula updating the ID, depending on what I wanted to download and append the state I wanted to retrieve data from at the end. So one URL looked like this:

http://api.eia.gov/series/?api_key=YOUR_API_KEY_HERE&series_id=SEDS.CLPRB.AL.A

Once all the URLs formed, I could set Alteryx to download all the JSON files and set a macro to parse them and join them together.

Here is my viz, have a look at it and let me know your thoughts 🙂