1

Is there any documentation for the Spotify Web API as to which characters are valid when searching? For example "Macklemore & Ryan Lewis" needs the & to be url encoded in order for the request to work.

The character ":" is completely invalid it seems. In order to search for an album like "Pink Friday: Roman Reloaded", I have to remove the : completely from the String. Even URL encoding it doesn't work. This probably was to do with the fact that : seems to be used to separate the fields of the query.

Other characters like .[()/ seem to work ok. Any docs on this anywhere? Just want to know we are being comprehensive. Thanks.

NickDK
  • 999
  • 10
  • 24

1 Answers1

2

Given the Björk example here,

http://ws.spotify.com/search/1/artist?q=artist:Bj%C3%B6rk

You'll need percent encoding. Not sure what technology you're using, if javascript, this answer should help - URL encode sees “&” (ampersand) as “&” HTML entity.

Update:

Colons are special characters used for advanced search. Queries involving colons need to be quoted, unless it's an advanced search :).

Community
  • 1
  • 1
Thomas
  • 3,348
  • 4
  • 35
  • 49
  • I don't think it will accept a percent encoded colon character. For example, Nicki Minaj's album, "Pink Friday: Roman Reloaded". This URL works http://ws.spotify.com/search/1/album.json?q=album:Pink%20Friday%20Roman%20Reloaded (The colon is taken out completely). But the following does not (returns zero results) http://ws.spotify.com/search/1/album.json?q=album:Pink%20Friday%3A%20Roman%20Reloaded (that one has a percent encoded colon as %3A). And as expected, it doesn't work if you just put a non-encoded colon. – NickDK Dec 17 '13 at 15:12
  • I've seen some complaints on IRC about similar things. I suspect there's some undocumented rules about making search work best. I'd probably cut out all punctuation. – Thomas Dec 17 '13 at 15:36
  • 1
    Putting quotes around the title with colon does work: http://ws.spotify.com/search/1/album.json?q=album:%22Pink%20Friday%3A%20Roman%20Reloaded%22 – Thomas Dec 17 '13 at 15:40
  • Oh, and sorry I didn't read your question clearly enough. You already knew about url encoding. – Thomas Dec 17 '13 at 15:43