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 User Profiles in Spotify



Overview

The following operations allow you to work with User profiles 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 User profiles, see Sample configuration.

OperationDescription
getProfileOfAUserGet a User profile.
getProfileOfCurrentUserGet Current user’s profile.

Operation details

This section provides the details on each operation related to User profiles.

 Get profile of a User

To get the public profile information of a Spotify user, use spotify.getProfileOfAUser operation

getProfileOfAUser
<spotify.getProfileOfAUser>
    <userId>keerthu</userId>
</spotify.getProfileOfAUser>
Properties
  • userId: The user’s Spotify Id.

Sample request

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

Sample Request for getProfileOfAUser
{
"userId":"keerthu"
}

 Get current User’s profile

To get the detailed profile information of current Spotify user including username, use spotify.getProfileOfCurrentUser operation.

getProfileOfCurrentUser
<spotify.getProfileOfCurrentUser/>
Sample request

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

Sample Request for getProfileOfCurrentUser
{
"clientId":"f043fec58a584539ba94c0c588136712",
"clientSecret":"b421eecdfe184be29b1d297505befcac",
"grantType":"refresh_token",
"refreshToken":"AQCQPj6__vnciBWMpS1lJ_V_oefCZUy2V7z_Ha7WBoZZTKRsVPgDTtecOMN5rxXs9mvtencluvX3m_RNCsTqTTJtwZCmcrte_1Ar_SzXDug-AtdbSiZXMObPa8Kw0-8tE8c"
}

Sample configuration

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

Sample Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="spotify_getProfileOfCurrentUser"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
    <target>
        <inSequence>
            <spotify.init/>
            <property name="clientId" expression="json-eval($.clientId)"/>
            <property name="clientSecret" expression="json-eval($.clientSecret)"/>
            <property name="grantType" expression="json-eval($.grantType)"/>
            <property name="refreshToken" expression="json-eval($.refreshToken)"/>
            <spotify.getAccessTokenFromRefreshToken>
                <clientId>{$ctx:clientId}</clientId>
                <clientSecret>{$ctx:clientSecret}</clientSecret>
                <grantType>{$ctx:grantType}</grantType>
                <refreshToken>{$ctx:refreshToken}</refreshToken>
            </spotify.getAccessTokenFromRefreshToken>
            <spotify.getProfileOfCurrentUser/>
            <respond/>
        </inSequence>
        <outSequence>
            <send/>
        </outSequence>
    </target>
    <description/>
</proxy>