We’re always working to make improvements to our Web APIs and today, we have some updates to share that will impact both The Spotify and The Echo Nest Web APIs.
Over the past two years, following Spotify’s acquisition of The Echo Nest, it’s become clear that rather than have two separate APIs with considerable overlap in features, it makes sense to migrate functionality and focus all of our future development on the Spotify API.
In doing so, there are a couple important dates you should be aware of:
If you currently have an app that uses The Echo Nest API, check out the Spotify Web API as we’ve already migrated the most-used features.
As always, we’ll continue to add additional features and enhancements to ensure you have what you need for development.
For more information on these new APIs check out the details on the Spotify Blog.
The Echo Nest API allows you to call methods that respond in JSON or XML. Individual methods are detailed in the menu on the left. You can call a method by using an HTTP GET to retrieve http://developer.echonest.com/api/v4/[type]/[method] along with method specific arguments.
You must have your own API key to make use of The Echo Nest API. To obtain a key, register for an account.
The example method calls in this set of documentation use a guest API key that is for demonstration purposes only and should not be used for any other application.
We want to be as flexible as possible with our API and data feeds; if you have an interesting use of our platform, we want to help. Here are some basic ground rules that all developers should abide by when using the API and data feeds.
Use UTF-8 encoding when sending arguments to API methods.
API methods are subject to rate limits. In general, non-commercial users of our API can expect a rate limit of around 120 calls per minute. This may vary depending upon overall system activity. If we are under a light load we may increase the limit associated with your API key and conversely, if we are under heavy load we may reduce that limit. If you need a guaranteed API limit, contact us at firstname.lastname@example.org. You can discover what your current rate limit and activity is by inspecting the response header that is returned with each API method call. There are three fields in the header associated with rate limits:
- X-RateLimit-Limit - the current rate limit for this API key
- X-RateLimit-Used - the number of method calls used on this API key this minute
- X-RateLimit-Remaining - the estimated number of remaining calls allowed by this API key this minute
You can inspect the response header with the -i option to curl like so:
curl -i 'http://developer.echonest.com/api/v4/artist/profile?api_key=YOUR_API_KEY&name=weezer'
This returns a response header with content like so:
HTTP/1.1 200 OK Content-Length: 135 X-RateLimit-Limit: 120 X-RateLimit-Remaining: 62 X-RateLimit-Used: 58
This indicates that the current rate limit is 120 calls per minute. In the current minute 58 calls have been made and we estimate that you will have 62 calls remaining for the current minute.
If you exceed the rate limit during a period, API methods will fail with an HTTP response status code of 429.
Many calls take ID of items (artists, songs, tracks, etc). IDs can be full formed Echo Nest IDs like music://id.echonest.com/~/AR/ARC51DL1187B9A9FED or can in abbreviated form such as ARC51DL1187B9A9FED.
These parameters are valid for all methods in the API
Parameter Required? Multiple? Values Description api_key yes no YOUR_API_KEY the developer API key format no no json, jsonp, xml the format of the response callback Required if format is jsonp no MyJSFunc the callback function for JSONP requests
|1||Missing/ Invalid API Key|
|2||This API key is not allowed to call this method|
|3||Rate Limit Exceeded|
The HTTP Status response status code can be used to determine the status of an API request:
- 200 - Success
- 304 - Not Modified - indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-Match.
- 400 - Bad Request - the request is not valid
- 403 - Forbidden - you are not authorized to access that resource
- 404 - Not Found - The requested resource could not be found
- 429 - Too Many Requests - You have exceeded the rate limit associated with your API key
- 5XX - Server Error - The Echo Nest is having an internal issue and cannot serve your request