How to perform artist searches in a Spotify application?

I’m working on a Spotify app and need to find tracks by artists. The problem is I only have the artist’s name, not their Spotify URI. I’ve looked through the App API docs but can’t find any search features.

I thought about using the ws.spotify.com web services, but they don’t support JSONP. This is a must for Spotify apps.

Does anyone know how to do this? Are there other ways to search for artists and their tracks within a Spotify app? Maybe there’s a workaround I’m missing?

I’d really appreciate any tips or suggestions. Thanks!

yo mikechen, i had the same issue. try using the spotify web api with the implicit grant flow. it’s client-side so no server needed. just GET https://api.spotify.com/v1/search?q=artistname&type=artist with your access token. returns json with artist URIs n stuff. good luck with ur app bro!

Hey mikechen, have u tried the Spotify Metadata API? it lets u search artists by name n get their tracks. use the /search/1/artist endpoint with a GET request. it returns JSON so should work for ur app. just remember to handle rate limits n stuff. hope this helps!

As someone who’s worked extensively with Spotify’s APIs, I can tell you that the Spotify Web API is indeed your best bet for artist searches. While it’s true that JSONP isn’t supported, there’s a workaround that doesn’t require setting up a proxy server.

You can use the implicit grant flow for authentication, which works client-side and doesn’t require a server. Once you have an access token, you can make requests to the /search endpoint directly from your app using AJAX.

Here’s a quick example:

  1. Implement the implicit grant flow (Spotify has a good guide for this)
  2. Use the access token to make a GET request to:
    https://api.spotify.com/v1/search?q=artistname&type=artist

This will return JSON with artist info, including their Spotify URI. From there, you can fetch their tracks or albums.

Remember to handle token expiration and respect rate limits. Good luck with your app!

I’ve encountered a similar issue in my Spotify app development. The Spotify Web API is actually the best solution here. While it doesn’t support JSONP directly, you can use a proxy server to get around CORS restrictions. Set up a simple Node.js server that forwards requests to the Spotify API and returns the results. This way, you can make AJAX calls from your app to your proxy, which then communicates with Spotify. It’s a bit more work initially, but gives you full access to Spotify’s robust search capabilities, including artist searches by name. Just ensure you handle authentication and rate limiting properly on your proxy server.

I’ve dealt with this issue before in my Spotify app development. The Spotify Web API is indeed the way to go for artist searches. While it doesn’t support JSONP, you can use the implicit grant flow for authentication, which works client-side without a server.

Once you have an access token, make a GET request to https://api.spotify.com/v1/search?q=artistname&type=artist. This returns JSON with artist info, including Spotify URIs.

Remember to handle token expiration and rate limits. Also, consider caching results to improve performance and reduce API calls.

If you need more advanced features, you might want to look into the recently released Spotify Web Playback SDK. It offers additional functionality for playback control within your app.