Only 50 SoundCloud groups returned by GET

2019-05-07 05:31发布

问题:

I have joined 92 groups in SoundCloud, but when I do an SC.get("/me/groups"....etc I only get 50 returned to me. When I do a

curl http://api.soundcloud.com/users/6999000/groups.json?client_id=MY_CLIENT_ID

I only get 50 results returned to me? Any way to get the full number of group entries returned?

回答1:

There is an offset GET parameter that you can pass in order to retrieve tracks above the 50 items limit.

curl http://api.soundcloud.com/users/6999000/groups.json?client_id=YOUR_CLIENT_ID&offset=50

I hope this helps.



回答2:

You can use a loop and offset to get all.

Pseudo code...

String url = "http://api.soundcloud.com/users/6999000/groups.json?client_id=MY_CLIENT_ID";
getGroups(url);

int count = 50;
String newUrl = "http://api.soundcloud.com/users/6999000/groups.json?client_id=MY_CLIENT_ID&offset=50";
while( count < 92) {
    getGroups(newUrl);
    count = count + 50;
    }

Look at http://developers.soundcloud.com/docs#pagination for more information on offsets.



标签: soundcloud