0
votes

I want to get the resource of a track through the Soundcloud API:

https://soundcloud.com/killbite/death-illusion

The API returns the wrong track when I do this though:

http://api.soundcloud.com/users/killbite/tracks/death-illusion.json?client_id="myClientId"

Even if I query by UserId instead of Username it's wrong. If I go by track ID it'll be correct (ID=161781638).

Is there anyway to get the correct track by userId and/or track name?

1

1 Answers

0
votes

Yes, it is possible to get a track by username, userID, or track name. I've done it here in jsfiddle: https://jsfiddle.net/jchan11/jsq7pjh0/

var USER = "killbite";
SC.get("/users/"+USER+"/tracks", {limit: 10}, function(tracks){
  var trackList = "";
  for (var i = 0; i < tracks.length; i++) { 
    trackList += tracks[i].title + "<br>";
  }
    $("#tracks").html(trackList);
});

Replacing 'USER' with the userID will also work.

To search for a particular track by name, use the 'q' filter. Have a look at this part of the API docs: https://developers.soundcloud.com/docs/api/guide#search