API Stands for Application Programming Interface. Usually we interact with websites buy sending URL Request and retrieving. Below we can see that the differences between an API and a website is that with an API we receive data in either JSON, CSV or XML format.
Another clear benefit of using an API over web scraping is that an API will have documentation. This is not to say that the documentation will always be good but in comparison to web scraping some documentation is better than none.
How to use an API in Alteryx
For this example we will use the swapi.dev api. This is a free to use API that is showing star wars data. Therefore if you have Alteryx you can follow along with the next steps.
Firstly we start by dragging in the text input tool and type the URL of the API you want to connect to.
Now use the download tool from the developers tab, configure the tool and untick "use Data Connection Manager".
Now use the JSON Parse tool. Make sure to select the field that contains the JSON. and also to select "Output Values into single string field" You will now have all your data in one column (JSON_ValueString) with the headers in the column next to it (JSON_Name).
You will notice that the values in the column with all the headers (JSON_Name) are split by full stops. To extract the headers, use the text to columns tool to split by delimiters.
Now we can now use the cross tab tool to pivot our data.
After using the select tool to only keep the columns that we want we end up with a table like the one below.
Just like that we have connected to an API and extracted the data and cleaned it so that it is ready for analysis.