apispotifylibspotifyechonestspotify-desktop

Spotify API get track info based on track name?


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 ?


Solution

  • You can use the 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"