Class StartUsersPlaybackRequest


  • public class StartUsersPlaybackRequest
    extends Object
    Start/Resume a User's Playback request

    Required OAuth scopes

    user-modify-playback-state

    Response

    A completed request will return a 204 NO CONTENT response code, and then issue the command to the player. Due to the asynchronous nature of the issuance of the command, you should use the Get Information About The User's Current Playback endpoint to check that your issued command was handled correctly by the player.

    If the device is not found, the request will return 404 NOT FOUND response code.

    If the user making the request is non-premium, a 403 FORBIDDEN response code will be returned.

    • Constructor Detail

      • StartUsersPlaybackRequest

        public StartUsersPlaybackRequest​(ApiClient apiClient)

        Start/Resume a User's Playback request

        Parameters:
        apiClient -

        The API client

    • Method Detail

      • deviceId

        public StartUsersPlaybackRequest deviceId​(String deviceId)

        The id of the device this command is targeting. If not supplied, the user's currently active device is the target.

      • contextUri

        public StartUsersPlaybackRequest contextUri​(String contextUri)

        Spotify URI of the context to play. Valid contexts are albums, artists, playlists. Example: {"context_uri": "spotify:album:1Je1IMUlBXcx1Fz0WE7oPT"}

      • uris

        public StartUsersPlaybackRequest uris​(List<String> uris)

        A JSON array of the Spotify track URIs to play. For example: {"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh", "spotify:track:1301WleyT98MSxVHPZCA6M"]}

      • offset

        public StartUsersPlaybackRequest offset​(Map<String,​Object> offset)

        Indicates from where in the context playback should start. Only available when context_uri corresponds to an album or playlist object, or when the uris parameter is used. “position” is zero based and can’t be negative. Example: "offset": {"position": 5} “uri” is a string representing the uri of the item to start at. Example: "offset": {"uri": "spotify:track:1301WleyT98MSxVHPZCA6M"}

      • positionMs

        public StartUsersPlaybackRequest positionMs​(int positionMs)

        Indicates from what position to start playback. Must be a positive number. Passing in a position that is greater than the length of the track will cause the player to start playing the next song.

      • build

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