Posted to tcl by dandy at Tue May 04 17:12:14 GMT 2021view pretty

For Pause:

curl -X "PUT" "https://api.spotify.com/v1/me/player/pause?device_id=d70b*MASKED*c308" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer BQBTK50*MASKED*gJGJquMgh"

This code worls perfect:

set spot_url [http::geturl https://api.spotify.com/v1/me/player/pause? -method PUT -query \
[http::formatQuery device_id "d70b*MASKED*c308"] -headers [list Accept \
application/json Content-Type application/json Authorization "Bearer $::access_token"]]


And for repeat:

curl -X "PUT" "https://api.spotify.com/v1/me/player/repeat?state=track&device_id=d70b*MASKED*c308" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer BQBTK50*MASKED*gJGJquMgh"



I'm trying this:

                set spot_url [http::geturl https://api.spotify.com/v1/me/player/repeat? \
                -method PUT \
                -query [http::formatQuery state "track" device_id "d70b*MASKED*c308"] \
                -headers [list Accept application/json Content-Type application/json Authorization "Bearer $::access_token"]]


but get this:

{
  "error" : {
    "status" : 400,
    "message" : "Required parameter state missing"
  }
}