I want to search for tracks by tag relating only to my user name i.e. the Royal Opera House.
For example:
http://api.soundcloud.com/users/royaloperahouse/tracks/?client_id=238947HSGDHSDG&tags=eric
tells me I need to use a q parameter. To humour it I search:
http://api.soundcloud.com/users/royaloperahouse/tracks/??client_id=238947HSGDHSDG&tags=eric&q=e
and simply get a list of sounds from the whole of Sound Cloud not the ones relating to just my user.
Similarly if I try and search the tracks API (not by users) and limit the query with &user_id
I get videos relating to all users not one specific to the Royal Opera House.
The ultimate aim is to find all tracks that the Royal Opera House has uploaded relating to a specific artist. At the moment the way we are solving it is by getting all of our uploaded tracks (37 at present) and iterating through those to match the tracks by the relevant tag. Obviously as our music list grows this will start to be a problem.
Thanks.
I haven't used this API before, but after a few tests i think i've found your problem.
You shouldn't use users as the first url segment because you aren't searching for users, you are searching for tracks filtered by username and tags.
Instead use tracks as the first url segment, and use the q parameter to filter the username. Then you can use use the tags parameter as well.
Test this url: http://api.soundcloud.com/tracks?q=username&tags=tag
SC.get('/tracks/', {q:'royaloperahouse', tags: 'insights' }, function(result) {
console.log(result[0].tag_list);
});
To be honest i still do not understand the q parameter. In API documentation you find references about it in tracks, users, etc and in search page they talk about it too but i haven't found any documentation about what the q parameter is filtering in each query type. In tracks is the username (and possible user id)
If you are consuming this API, you should ask soundcloud team in their google group more the meaning of this parameter.
Try this (you'll have to check my syntax):
SC.get('/tracks/',array('user_id' => 'YOUR_ID', q:'royaloperahouse', tags: 'insights' ), function(result) {
console.log(result[0].tag_list);
});
or
SC.get('users/YOUR_ID/tracks/', {q:'royaloperahouse', tags: 'insights' }, function(result) {
console.log(result[0].tag_list);
});
First, understand the difference between the user "id" and the user "permalink". They're both unique user identifiers, but they're separate things with different purposes. You can use the former, but not the latter, to access tracks. So instead of
http://.../users/royaloperahouse/...
you should be using
http://.../users/12127832/...
substituting 12127832 for the appropriate ID if you're looking for a different artist. Also, you should probably specify JSON as the return type. To conclude, your server call should look like this:
http://api.soundcloud.com/users/12127832/tracks.json?client_id=238947HSGDHSDG&tags=eric
Also: don't post your client ID on Stack Overflow!!!