Retrieve cover artwork using Spotify API

June 17th 2014: Today Spotify released a new Web API. It is now easy to retrieve cover artwork, as all endpoints includes an array of images for every item. Search example: curl -X GET “https://api.spotify.com/v1/search?q=tania%20bowra&type=artist” { “artists” : { … “items” : [ { … “images” : [ { “height” : 640, “url” : “https://d3rt1990lpmkn.cloudfront.net/original/f2798ddab0c7b76dc2d270b65c4f67ddef7f6718”, … Read more

Spotify Apps API: any more documentation?

As others have said, it WAS possible to browse the source and view a sample “API” application, but neither of these are available anymore. For this reason, I have put together a kitchen sink application, which demonstrates how to perform much of the basic functionality. It may come in handy to anyone getting started: https://github.com/ptrwtts/kitchensink … Read more

How is it possible to know what’s spotify is playing from an external Android app?

Spotify has the following intent-actions: metadatachanged, playbackstatechanged, and queuechanged. queuechanged contains no extra data. playbackstatechanged has a boolean value for “playing”, and a value for playbackPosition. metadatachanged contains artist, album, track, length, and id values. You can get Artist, Track, and Album names when the track is changed (manually or automatically) by using com.spotify.mobile.android.metadatachanged If … Read more

Allowing frontend JavaScript POST requests to https://accounts.spotify.com/api/token endpoint

You can find an example of using express to perform the authentication flow with Spotify on https://github.com/spotify/web-api-auth-examples (see the authorization_code approach). You can’t get an access token making a client-side request to /api/token. You need to make a request to /authorize, which will redirect to your redirect_uri, which itself will exchange a code with an … Read more

SWIG interface to receive an opaque struct reference in Java through function argument

At the most basic level you can make code that works using the cpointer.i part of the SWIG library to allow a direct “pointer to pointer” object to be created in Java. For example given the header file: #include <stdlib.h> typedef struct sp_session sp_session; typedef struct {} sp_session_config; typedef int sp_error; inline sp_error sp_session_create(const sp_session_config … Read more

Getting Spotify API access token from frontend JavaScript code

I believe the issue here is that you’re attempting to retrieve JSON data from the endpoint where you should direct your users. So instead of making a request to it, you should supply a button on your page that links to your https://accounts.spotify.com/authorize/{…} URL. The user will proceed to give your application the permissions you’ve … Read more