Tableau

Get web api data with Alteryx (on my way to Inspire 2014)

Alteryx is the new buzzword in our office at Inviso. We just recently became Alteryx partners and are now able to make data Tableau-ready a lot faster (and more robust).

I am these days personally getting ready for the Inspire 2014 Alteryx conference in San Diego next week and from Seann Gardiners visualisation on the Alteryx blog it looks like I will be representing the Nordics together with a single Swedish partner. I am really excited to spend tree days with a lot of Alteryx users and I find myself seeing Alteryx in everything at the moment. Also when Dave Norren from Tableau shared a visualization on LinkedIn that utilizes last.fm's web api.

The REST API from last.fm works great as an example on how to use Alteryx to quickly get data from a web API and make it ready for Tableau.

  • From Last.FM API to Tableau Using Alteryx

First I found the API method "getRecentTracks" in the last.fm API documentation. This gives me all the recent tracks for a given username. Next I build my Alteryx module in 8 steps:

1) Input data

I input the API url (create an API account to use your own), the username and the page I would like to fetch. You will need the page parameter to swop pages because last.fm only give you 200 records per page.

2) Formular

To put together the URL based on the parameters above.

3) Download

This is where is magic happens. Alteryx use the URL to get the XML file from last.fm.

4) XML parse

In one step Alteryx will parse to XML into a table of data.

5) Select

Only the necessary field are selected.

6) Formular

Because I want to use the data in Tableau I set the correct datatype.

7) Select

Again I limit the fields to the once I need in Tableau

8) Output

Create the Tableau (tde) file.

The finished module looks like this and can be downloaded here. It will work if you change "USERNAME"to a valid last.fm username in the text input tool.

  • Overcome the 200 Tracks per page limit (Combine Multiple Downloads)

The example above has a limitation on 200 tracks per page and it is not a great solution if you have listened to music for years and want to get all your songs. Therefor I made a slightly more advanced example where the first set of tools, lookup the number of total pages (click on the first browse tool to see it). The next set of tools do the same steps as described above with the important difference that I placed a "generate row" tool in front. This tool create one row with a url for each page number. The module looks like this and you can check it out yourself by downloading it here.


Back to blog


Subscribe for updates