In Part 1, we connected to the Spotify API, authenticated using a client token, and pulled artist-level metadata. In this follow-up, we’ll go a step further and extract the top tracks for any artist using additional API endpoints, all powered by Alteryx.
We begin by sending an API request using the artist’s Spotify URL and our previously created Authorization header. This is done using the Download tool, which returns a DownloadData field containing the full JSON response.


Next, we apply the JSON Parse tool to extract readable fields from the response. This gives us two key columns: one for the field names and one for their values.
To handle nested fields, we use the Text to Columns tool to split the name column into three separate parts. This allows us to separate data like "tracks.items.name" into a more usable structure for filtering and reshaping later.


To make the data easier to work with, we use the Cross Tab tool. We group the data by URL, set the parsed name field as column headers, and use the value field to populate each column. The aggregation method is set to concatenate, which helps when there are multiple values for a given field.
This gives us one row per artist with several columns for attributes such as popularity, followers, or genres.

To retrieve an artist’s top tracks, we build a new URL using the artist ID and a market code. This URL follows the structure defined in Spotify’s API documentation. We then create another authorization header by combining the access token with the necessary formatting.

As in Part 1, we append this header to our new URL so we can authenticate the next API request.
We use another Download tool to request the artist’s top tracks. After receiving the response, we parse it again using the JSON Parse tool.
We then use Text to Columns once more to split the name field into three parts, helping us isolate values like track name and ID more easily.

To clean the data and focus only on the information we need, we apply a filter:
- We keep rows where the first part of the parsed name equals “tracks.”
- We keep rows where the third part of the name equals “name,” which represents the song title.
- We remove any rows that refer to “available_markets,” as they add unnecessary detail.

Once filtered, the final output is a simple, structured list of your artist’s top tracks — ready for analysis, visualisation, or playlist building. This marks the completion of a two-step workflow that allows you to explore music insights using the Spotify API and Alteryx.
