Wednesday 6 December 2017

Spotify API get track info based on track name?

itemprop="text">

Is there a way to query the spotify
API in order to get information about a
track/artist/album/playlist based on its
name.



E.g. query for track=I need a
hero&artistName=...
and get a URI/ID and some
information about the track.



I couldn't find
anything like this in the documentation. Am I overlooking something ?


style="font-weight: bold;">

Answer




You can use the href="https://developer.spotify.com/web-api/search-item/" rel="nofollow
noreferrer">search API endpoint, by specifying an artist and a track
parameters, then extract the track ID from the response if there is only one
match:




curl -X GET
"https://api.spotify.com/v1/search?q=track:I%20need%20a
hero%20artist:the%20artist&type=track"


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...