Announcements

Search endpoint bug

Solved!

Search endpoint bug

chinzanoDev

I was trying to use search endpoint("https://api.spotify.com/v1/search"), but response return empty items. As ex. of response(changed link-title, because system doesn't allow):

"tracks": {
    "": "https://api.spotify.com/v1/search?query=remaster%2520track%3ADoxy%2Bartist%3AMiles%2520Davis&type=track&market=ES&locale=en-US%2Cru-RU%3Bq%3D0.8%2Cru%3Bq%3D0.5%2Cen%3Bq%3D0.3&offset=5&limit=10",
    "items": [],
    "limit": 10,
    "next": null,
    "offset": 5,
    "previous": "https://api.spotify.com/v1/search?query=remaster%2520track%3ADoxy%2Bartist%3AMiles%2520Davis&type=track&market=ES&locale=en-US%2Cru-RU%3Bq%3D0.8%2Cru%3Bq%3D0.5%2Cen%3Bq%3D0.3&offset=0&limit=10",
    "total": 0
  }

 Request has been filled with sample data. Problems started from 9:00 PM(UTC +2).

Maybe there some restrictions? But the other requests passed and response is correct.

Reply

Accepted Solutions
Marked as solution

plwww

I came searching over a similar problem, different query, and believe I have the solution. I noticed you're likely double url-encoding your query(you have a %2520 which happens when you double encode a space, first to %20, then to %2520. I double checked my query and I had the opposite problem, I had left out a space. Fixing that, it works. I tested your query out as well. It fails as given but replacing the %2520 with %20, works.

View solution in original post

3 Replies

RyanNewQuest

are you using client credentials or OAuth token?

I find that when I use client credentials, I often get the same result you're getting but when I'm using OAuth it seems to work just fine. This isn't fix. It's still problem if your trying to run server side automation. 

Marked as solution

plwww

I came searching over a similar problem, different query, and believe I have the solution. I noticed you're likely double url-encoding your query(you have a %2520 which happens when you double encode a space, first to %20, then to %2520. I double checked my query and I had the opposite problem, I had left out a space. Fixing that, it works. I tested your query out as well. It fails as given but replacing the %2520 with %20, works.

chinzanoDev

Yeah, u was right! I dunno why, but there's a mistake at "fill sample data" button. Thx to u!!

Suggested posts

Env: prod