Skip to content

Tracks API

Romain Monteil edited this page Jan 3, 2019 · 1 revision

Tracks API

Get an user

$response = $spotify->tracks()->get('0tGPJ0bkWOUmH7MEOR77qc', [
    QueryParametersInterface::PARAMETER_MARKET => 'FR',
]);

Return an instance of TrackResponse

Get several tracks

$response = $spotify->tracks()->several([
    QueryParametersInterface::PARAMETER_IDS => [
        '7ouMYWpwJ422jRcDASZB7P',
        '4VqPOruhp5EdPBeR92t6lQ',
        '2takcwOaAZWiXQijPHIx7B',
    ],
    QueryParametersInterface::PARAMETER_MARKET => 'FR',
]);

Return an instance of TracksResponse

Retrieve saved tracks for the current user

$response = $spotify->tracks()->saved([
    QueryParametersInterface::PARAMETER_LIMIT => 20,
    QueryParametersInterface::PARAMETER_OFFSET => 0,
    QueryParametersInterface::PARAMETER_MARKET => 'FR',
]);

Return an instance of PagingResponse

Add a track for the current user

$response = $spotify->tracks()->saved([
    QueryParametersInterface::PARAMETER_IDS => [
        '7ouMYWpwJ422jRcDASZB7P',
        '0eFHYz8NmK75zSplL5qlfM',
    ]
]);

Return an instance of ResponseInterface

Delete a track for the current user

$response = $spotify->tracks()->remove([
    QueryParametersInterface::PARAMETER_IDS => [
        '7ouMYWpwJ422jRcDASZB7P',
        '0eFHYz8NmK75zSplL5qlfM',
    ]
]);

Return an instance of ResponseInterface