Saturday, 19 November 2016

Accessing Spotify Metadata API from within a Spotify app?



I want to run Spotify searches from within a Spotify app (to find tracks for an artist, for which I do not have a Spotify URI, only the name).



I have not found functionality in the App API to run searches. An alternative is to talk to ws.spotify.com to get to Spotify's search, but these web services do not support jsonp which is required for their use in a Spotify app.




What are my options?


Answer



This is not the finest way to solve your problem. There is a direct API for searching within your app. See Juan's solution.



But you could also talk to ws.spotify.com directly when you add the domain to your app's manifest.json.



"RequiredPermissions": ["http://ws.spotify.com" ]



e.g. http://ws.spotify.com/search/1/track.json?q=kaizers+orchestra, see their

Developer Site. The response contains the header "Access-Control-Allow-Origin: *", so you should be able to query from within your app.


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...