Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

Anchor
Overview
Overview
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.

Anchor
OperationDetails
OperationDetails
Operation details

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

Anchor
getATrack
getATrack
 Get profile of a User

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

Code Block
languagexml
titlegetProfileOfAUser
<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.

Code Block
titleSample Request for getProfileOfAUser
{
"userId":"keerthu"
}

Anchor
getProfileOfCurrentUser
getProfileOfCurrentUser
 Get current User’s profile

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

Code Block
languagexml
titlegetProfileOfCurrentUser
<spotify.getProfileOfCurrentUser/>
Anchor
sampleRequest
sampleRequest
Sample request

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

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

Anchor
sampleconfiguration
sampleconfiguration
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.

Code Block
titleSample 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>