Mohamed Heiba
Mohamed Heiba

Reputation: 1833

SoundCloud, filtering by query on the tracks of a specific user doesn't work

I'm trying to use the soundcloud api to get the tracks of a specific user that's matching the query i am inputting

here's an example without querying, works fine, gets all tracks for that user http://api.soundcloud.com/users/4493849/tracks.json?client_id=YOUR_CLIENT_ID

works fine and gets me the 5 tracks for that user

now I need to only get the track called "Test Audio". so I do as follows http://api.soundcloud.com/users/4493849/tracks.json?client_id=YOUR_CLIENT_ID&q=Test

now the problem is, when I put the q= , it simply brings me all tracks in the whole of soundcloud which match Test, i.e. it queries all soundcloud not the 5 tracks for that user as I want to

Any help please

Upvotes: 3

Views: 1069

Answers (2)

cucko
cucko

Reputation: 1436

The SoundCloud's API doesn't work with user sub-resources and search query.

So, the best way to do this is to load all tracks (batch load with offset parameter, if user has lots of tracks) all tracks and then code your search in the results.

This was the first feature that i needed too when i started my app, but there is no way to do this only with thiers API.

Upvotes: 0

hwsw
hwsw

Reputation: 2606

I tried it with the SC own SDK here:

http://jsfiddle.net/iambnz/H7VW8/

SC.initialize({ client_id: "cd3e093bf9688f09e3cdf15565fed8f3" });  

SC.get('/users/4493849', { q: 'test' }, function(tracks) {
  console.log(tracks);
});

Result will be just one track / object:

Object {id: 4493849, kind: "user", permalink: "the-uprising-developers", username: "The Uprising Developers", uri: "http://api.soundcloud.com/users/4493849"…}

Upvotes: 0

Related Questions