Reorder or Replace a Playlist's Items
PUT
/playlists/{playlist_id}/tracks
category-playlists
To reorder items, include
range_start
, insert_before
, range_length
and snapshot_id
in the request's body.To replace items, include
uris
as either a query parameter or in the request's body.Replacing items in a playlist will overwrite its existing items. This operation can be used for replacing or clearing items in a playlist.
These operations can't be applied together in a single request.
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request PUT 'https://api.spotify.com/playlists//tracks' \
--header 'Authorization;' \
--header 'Content-Type: application/json' \
--data-raw '{
"insert_before": 0,
"range_length": 0,
"range_start": 0,
"snapshot_id": "string",
"uris": [
"string"
]
}'
响应示例响应示例
200 - 示例 1
{
"snapshot_id": "string"
}
请求参数
Path 参数
playlist_id
必需
Query 参数
uris
可选
uris=spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:track:1301WleyT98MSxVHPZCA6M,spotify:episode:512ojhOuo1ktJprKbVcKyQ
A maximum of 100 items can be set in one request.
Header 参数
Authorization
必需
Reordering or replacing items in the current user's public playlists requires authorization of the
playlist-modify-public
scope; reordering or replacing items in the current user's private playlist (including collaborative playlists) requires the playlist-modify-private
scope. See Using Scopes.Content-Type
可选
application/json
Body 参数application/json