Skip to main content

Spotify

"Spotify is a digital music, podcast, and video service that gives you access to millions of songs and other content from creators all over the world."

Configuration

Getting Spotify OAuth credentials

Start by accessing or creating a Spotify account.

If you do not already have a Client Id and Client Secret, you will first need to create them. Start by creating an App.

Once you have registered an application, select it from the dashboard, then note your Client Id and Client Secret for the next step.

Configuring Spotify OAuth Credentials in crul

Navigate to the credentials page in crul (top right corner menu -> credentials).

Click the "create" button.

Select "OAuth" from the type dropdown, then select "Spotify" from the provider dropdown.

Copy the Client Id into the Client Id credentials form entry. Then copy the Client Secret into the Client Secret credentials form entry.

Test the credential by running the following query. You should see a populated token.access_token column in the results.

oauth --credential "spotify"

Example queries

These examples use the endpoints described in the Spotify API reference.

Example 1:

Gets the first page of albums and singles for a provided artist id.

oauth --credential "spotify"
|| api get https://api.spotify.com/v1/artists/1vCWHaC5f2uS3yhpwWbIA6/albums?limit=50&include_groups=album,single
--token.access_token "$token.access_token$"
|| normalize items

Example 2:

Gets the first 5 pages of and singles for a provided artist id.

oauth --credential "spotify"
|| api get https://api.spotify.com/v1/artists/1vCWHaC5f2uS3yhpwWbIA6/albums?limit=50&include_groups=album,single
--token.access_token "$token.access_token$"
--pagination.next "next"
--pagination.max 5
|| normalize items

Example 3:

asdf