What Are APIs?
Application Programming Interfaces (APIs) are sets of rules and protocols which allow different software systems to communicate with each other. In the context of Alteryx, they can be integrated into workflows allowing us to exchange data with apps over the internet.
The user submits a request, which the API then processes and returns a response in a structured format (usually a JSON).
APIs are often compared to restaurant menus:
- The menu lists the dishes you can order (the available operations).
- You give the waiter your order (make a request).
- The kitchen (system) prepares and returns it.
- You don't need to know how its created - just what to ask for and what you'll be getting back.
How to call APIs in Alteryx Designer
Now that we understand what APIs are, let's consider an example of how they can be used in Alteryx.
1) Text Input
We start by introducing a text input tool containing the endpoint for the API. For this example, I will be using https://icanhazdadjoke.com/ to return a random dad joke. In this case, the documentation specifies that I also need to include a User-Agent header to help monitor the usage of this API.


2) Download
We then use a download tool (can be found in the developer tab) to retrieve the data. Ensure that the correct field is being used for the URL. In this particular case, the documentation requests that the User-Agent field is used as a header and to obtain a random dad joke we need our HTTP action to be set to GET.




This leaves us with an output that looks like this:

3) JSON Parse
Now we need to parse out the JSON which the API has returned to us.


Giving us:

4) Cross Tab
Now we just need to do a bit of formatting to clean up the data!



Hopefully this has been a useful introduction to API calls in Alteryx Designer. To close, here are some key things to remember when integrating APIs into Alteryx:
- Read the documentation. Every API will want slightly differently structured requests. Make sure you understand what its looking for.
- APIs have rate limits. This means that for a given IP address, there is a maximum number of requests you can make in a given period (cache and run workflow is your friend here once you've got your initial request working).
