Class AddTracksToPlaylistRequest


  • public class AddTracksToPlaylistRequest
    extends Object
    Add Items to a Playlist request

    Required OAuth scopes

    playlist-modify-public, playlist-modify-private

    Response

    On success, the HTTP status code in the response header is 201 Created. The response body contains a snapshot_id in JSON format. The snapshot_id can be used to identify your playlist version in future requests. On error, the header status code is an error code and the response body contains an error object. Trying to add an item when you do not have the user's authorization, or when there are more than 10.000 items in the playlist, returns error 403 Forbidden.

    • Constructor Detail

      • AddTracksToPlaylistRequest

        public AddTracksToPlaylistRequest​(ApiClient apiClient,
                                          String playlistId,
                                          List<String> uris)

        Add Items to a Playlist request

        Parameters:
        apiClient -

        The API client

        playlistId -

        The Spotify ID for the playlist.

        uris -

        A JSON array of the Spotify URIs to add. For example: {"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh","spotify:track:1301WleyT98MSxVHPZCA6M", "spotify:episode:512ojhOuo1ktJprKbVcKyQ"]}
        A maximum of 100 items can be added in one request. Note: if the uris parameter is present in the query string, any URIs listed here in the body will be ignored.

    • Method Detail

      • position

        public AddTracksToPlaylistRequest position​(int position)

        The position to insert the items, a zero-based index. For example, to insert the items in the first position: position=0 ; to insert the items in the third position: position=2. If omitted, the items will be appended to the playlist. Items are added in the order they appear in the uris array. For example: {"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh","spotify:track:1301WleyT98MSxVHPZCA6M"], "position": 3}

      • build

        public ApiCall<SnapshotId> build()
        Build the request into an executable call