I'm working on an application that lets a user page through their friend list to take an action. I'm running into an issue (that wasn't there yesterday).
function doFriends(page_num){
page_num = page_num - 1;
var req = opensocial.newDataRequest();
var viewer_friends_spec = opensocial.newIdSpec({ "userId" : "VIEWER", "groupId" : "FRIENDS" });
var friend_params = {};
friend_params[opensocial.DataRequest.PeopleRequestFields.MAX] = 20;
friend_params[opensocial.DataRequest.PeopleRequestFields.FIRST] = (page_num * 20) + 1;
req.add(req.newFetchPeopleRequest(viewer_friends_spec, friend_params), "friends");
req.send(doFriendsCallback);
}
function doFriendsCallback(d){
var viewer_friends = d.get("friends");
friends = viewer_friends.getData();
// Do stuff with these records...
}
All three of these requests return only page 1 despite passing the correct values
doFriends(1);
doFriends(2);
doFriends(3);
I can see in the code it's looking to get the next set of data
http://api.msappspace.com/api-v2.svc/json/people/@me/@friends?opensocial_surface=CANVAS&ts=1252097128149&startIndex=2&count=20&format=JSON&filterBy=all
but then I get back:
{"totalResults":58,"startIndex":1,"itemsPerPage":20,"sorted":false,"filtered":true,"entry":[{...