Announcements

Possible to play local file through API?

Solved!

Possible to play local file through API?

FLEMMING_jans

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

Reply

Accepted Solutions
Marked as solution

Peter_Schorn

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.

View solution in original post

4 Replies

Peter_Schorn
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.

FLEMMING_jans

Thanks, that sounds interesting.

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

 

Marked as solution

Peter_Schorn

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.

FLEMMING_jans

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}

Suggested posts

Env: prod