Linking to a spotify search with both track and artist

It seems that Spotify has made some changes to how one should format links when performing more complex searches, causing some problems with one of the services I work on. This post describes my solution.

We used to format the links like this to open the spotify app and performing a search (mouse over and inspect to see):

Castle on the hill Ed Sheeran.

The answer from the spotify app:

Megabig sad face. Huge.

I put a question up on Stack overflow, but no luck there, and I got a negative answer from a moderator at the official Spotify developer forum.

Luckily I had better success with contacting @SpotifyCares through Twitter.

Thanks! We’ve spoken with the relevant team regarding this. The search parameter has to be URI encoded, and the different field values have to be wrapped in «quotes». You can think of it like this – ‘spotify:search:’ + encodeURIComponent(‘track:»castle on the hill» artist:»ed sheeran»‘). We hope this helps. In the meantime, check out to our friends at @SpotifyPlatform. They’ll be able to help further :) /Q

So, grabbing track:"castle on the hill" artist:"ed sheeran" and jumping over to http://meyerweb.com/eric/tools/dencoder/ for a quick encode gives me track%3A%22castle%20on%20the%20hill%22%20artist%3A%22ed%20sheeran%22.

Then just add spotify:search: in front, and viola:

Castle on the hill Ed Sheeran.

Boyahh! Big happyface! The biggest!

Av Morten Skogly

Creator of Things

2 kommentarer

Legg igjen en kommentar

Din e-postadresse vil ikke bli publisert. Obligatoriske felt er merket med *