This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Artists in Spotify



Overview

The following operations allow you to work with Artists in Spotify. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with Albums, see Sample configuration.

OperationDescription
getAnArtistRetrieves the metadata information of an artist.
getSeveralArtistsRetrieves several artists.
getRelatedArtistsToAnArtistRetrieves all artists, related to an artist.

getAlbumsOfAnArtist

Retrieves albums of an artist.

getTopTracksOfAnArtist

Retrieves top tracks of an artist. 

Operation details

This section provides the details on each operation related to Artists.

  Get information of a single Artist

To get the Spotify catalog information for a single artist identified by their unique Spotify ID, use spotify.getAnArtist operation.

getAnArtist
<spotify.getAnArtist>
    <artistId>0LcJLqbBmaGUft1e9Mm8HV</artistId>
</spotify.getAnArtist>
Properties
  • artistId: Spotify Id of the artist to get Spotify catalog information of a single artist.

Sample request

Following is a sample REST/JSON request that can be handled by the getAnArtist operation.

Sample Request for getAnArtist
{
"artistId":"0LcJLqbBmaGUft1e9Mm8HV"
}

  Get information of a several Artists

To get the Spotify catalog information for several artists based on their Spotify IDs, use spotify.getSeveralArtists operation .

getSeveralArtists
<spotify.getSeveralArtists>
    <artistIds>0oSGxfWSnnOXhD2fKuz2Gy,3dBVyJ7JuOMt4GE9607Qin</artistIds>
</spotify.getSeveralArtists>
Properties
  • artistIds: All Spotify Ids of the artists to get the information of those artists. Ids must be comma separated .

Sample request

Following is a sample REST/JSON request that can be handled by the getSeveralArtists operation.

Sample Request for getSeveralArtists
{
"artistIds":"0oSGxfWSnnOXhD2fKuz2Gy,3dBVyJ7JuOMt4GE9607Qin"
}

  Get information of a related Artists of an Artist

To get the Spotify catalog information about artists similar to a given artist. Similarity is based on analysis of the Spotify community’s listening history, use spotify.getRelatedArtistsToAnArtist operation .

getRelatedArtistsToAnArtist
<spotify.getRelatedArtistsToAnArtist>
    <artistId>0LcJLqbBmaGUft1e9Mm8HV</artistId>
</spotify.getRelatedArtistsToAnArtist>
Properties
  • artistId : Spotify Id of the artist to get the information of related artists to that artist .

Sample request

Following is a sample REST/JSON request that can be handled by the getRelatedArtistsToAnArtist operation.

Sample Request for getRelatedArtistsToAnArtist
{
"artistId":"0LcJLqbBmaGUft1e9Mm8HV"
}

Get information of Albums of an Artist

To get the information of Alums of an Artists, use spotify.getAlbumsOfAnArtist operation .

getAlbumsOfAnArtist
<spotify.getAlbumsOfAnArtist>
    <artistId>1vCWHaC5f2uS3yhpwWbIA6</artistId>
    <albumType>single</albumType>
    <spotifyLimit>10</spotifyLimit>
    <spotifyOffset>1</spotifyOffset>
    <requestedCountry>SE</requestedCountry>
</spotify.getAlbumsOfAnArtist>
Properties
  • artistId                    : Spotify Id of the artist to get the information of albums of that artist .

  • albumType             : A comma-separated list of keywords that will be used to filter the response. If not supplied, all album types will be returned. Valid values are,

    • album

    • single

    • appears_on

    • compilation

  • spotifyLimit            : The number of album objects to return. Default: 20. Minimum: 1. Maximum: 50.

  • spotifyOffset          : The index of the first album to return. Default: 0 (i.e., the first album). Use with limit to get the next set of albums.

  •   requestedCountry : An ISO 3166-1 alpha-2 country code.Supply this parameter to limit the response to one particular country.

Sample request

Following is a sample REST/JSON request that can be handled by the getAlbumsOfAnArtist operation.

Sample Request for getAlbumsOfAnArtist
{
"artistId":"1vCWHaC5f2uS3yhpwWbIA6",
"albumType":"single",
"albumLimit":"10",
"albumOffset":"1",
"requestedCountry":"SE"
}

Get information of top Tracks of an Artist

To get Spotify catalog information about an artist’s top tracks by country, use spotify.getTopTracksOfAnArtist operation .

getRelatedArtistsToAnArtist
<spotify.getTopTracksOfAnArtist>
    <artistId>43ZHCT0cAZBISjO8DG9PnE</artistId>
    <requestedCountry>SE</requestedCountry>
</spotify.getTopTracksOfAnArtist>
Properties
  • artistId                   : Spotify Id of the artist to get the information of top tracks of that artist.

  • requestedCountry : An ISO 3166-1 alpha-2 country code.

Sample request

Following is a sample REST/JSON request that can be handled by the getTopTracksOfAnArtist operation.

Sample Request for getTopTracksOfAnArtist
{
"artistId":"43ZHCT0cAZBISjO8DG9PnE",
"requestedCountry":"SE"
}

Sample configuration

Following is a sample proxy service that illustrates how to connect to Spotify with the init operation to use the getTopTracksOfAnArtist operation. The sample request for this proxy can be found in getTopTracksOfAnArtist sample request.

Sample Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="spotify_getTopTracksOfAnArtist"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
    <target>
        <inSequence>
            <spotify.init/>
            <property name="artistId" expression="json-eval($.artistId)"/>
            <property name="requestedCountry" expression="json-eval($.requestedCountry)"/>
            <spotify.getTopTracksOfAnArtist>
                <artistId>{$ctx:artistId}</artistId>
                <requestedCountry>{$ctx:requestedCountry}</requestedCountry>
            </spotify.getTopTracksOfAnArtist>
            <respond/>
        </inSequence>
        <outSequence>
            <log/>
            <send/>
        </outSequence>
    </target>
    <description/>
</proxy>