Possible to play local file through API?

Plan: Premium

Country: DK

Device: Spotify on Linux Ubuntu (PC)

 

My Question or Issue

Hi, I'm playing songs using the Web API like this without issues:

 

PUT /v1/me/player/play HTTP/1.1
Content-Type: application/json
Authorization: xxxxx
Host: api.spotify.com
Content-Length: 116
 
{"context_uri": "spotify:album:5ht7ItJgpBH7W6vJ5BqpPr", "offset": {"position": 5},"position_ms": 0}
 

Is it possible to play a local file (added to a playlist) through the same Web API call by using a different URI e.g. something like:

"spotify:local:Grandmaster+Flash::The+Message:392"

 

I got that URI format from checking the playlist where the local song was added.

 

I'm getting http code 400 and the following error message when trying this:

"Invalid track uri: spotify:local:Grandmaster+Flash::The+Message:392"

 

Regards,

Flemming

Child Item
Child Item
Child Item

Accepted answers

You make the exact same request as is shown at the beginning of your first post, except you replace the album URI with a playlist URI.

All comments

You cannot play local files using the web API unless they are already in a playlist and you reference them by their index in the playlist.

Thanks, that sounds interesting.

Which API call or URI would I use to play a local file by its index?

 

You make the exact same request as is shown at the beginning of your first post, except you replace the album URI with a playlist URI.

thanks, it worked using e.g. :

 

PUT /v1/me/player/play HTTP/1.1
Content-Type: application/json
Authorization: xxxxx
Host: api.spotify.com
Content-Length: nnn
 
{"context_uri": "spotify:playlist:5ht7ItJgpBH7W6vJ5BqpPr", "offset": {"position": 5},"position_ms": 0}
Child Item
Child Item