spotifyechonest

Can an Echo Nest Taste Profile be created based on Spotify Track ID's?


Echo Nest API is supposed to be 100% compatible with Spotify ID's, but I am unable to create an Echo Nest Taste Profile based on Spotify Track ID's.

I've tried the following:

create the Taste Profile

curl -F "api_key={api_key}" -F "type=song" -F "name=spotify-tracks" "http://developer.echonest.com/api/v4/catalog/create"

update the profile with json file containing tracks and their Spotify ID's

curl -X POST "http://developer.echonest.com/api/v4/tasteprofile/update" -F "api_key={api_key}" -F "id={taste_profile_id}" -F "data=@/spotify-tracks.json"

Here are the contents of spotify-tracks.json (just one track for testing):

[
  {
    "action": "update",
    "item": 
    {
        "item_id": "1",
        "track_id": "spotify:track:3HWxpLKnTlz6jE3Vi5dTF2"
    }
  }
]

But, when I check the update status it can't ever resolve the track:

{
  "response": {
    "items_updated": 1, 
    "percent_complete": 100.0, 
    "status": {
      "code": 0, 
      "message": "Success", 
      "version": "4.2"
    }, 
    "ticket_status": "complete", 
    "total_items": 1, 
    "update_info": [
      {
        "info": "couldn't resolve item", 
        "item_id": "1"
      }
    ]
  }
}

I've tried a number of different ways including using 'song_id' or 'item_id' rather than 'track_id' in the json input file, creating a 'general' Taste Profile rather than 'song' Taste Profile, using different Spotify tracks, and a couple other variations to no avail.

Without the ability to use Spotify Id's I would have to query each track individually to get the ENID, so I'm hoping I'm just missing something here.


Solution

  • OK, the answer is yes. The problem was with the format of my JSON input file. I should have used just the Spotify track ID for the value, not the full URI. Also, I needed to use "song_id" rather than "track_id" for the key to have it resolve to an EN Song instead of an EN Track. Like this:

    [
      {
        "action": "update",
        "item": 
        {
            "item_id": "1",
            "song_id": "SOEGJUJ12AF729D40A"
        }
      }
    ]
    

    This isn't super clear in the Echo Nest documentation, but I probably should have tried this out originally.