API doc在这里https://developer.yammer.com/docs/usersjson
我的javascript代码可以成功获取yammer网络第1页中的用户。
但是如何通过一个查询或多个查询以优雅的方式获取所有用户?我认为我需要通过循环查询page 1
page 2
page 3
...直到返回的userArray长度为0?那么如何验证何时在循环中停止?
yam.connect.loginButton('#yammer-login', function (resp) {
console.log(resp.authResponse);
if (resp.authResponse) {
//trigger data process
yam.platform.request({
url: "users.json",
method: "GET",
data: {
"page": 1
},
success: function (user) {
console.log("The request was successful.");
console.dir(user);
},
error: function (user) {
console.log("There was an error with the request.");
}
});
}else{
console.log("error to get access_token");
}
});