I’m using the Facebook Javascript SDK. Is there a way to limit the number of elements returned for a specific field when making a request for multiple fields.
Example: If I wanted to get the ‘bio’ and liked ‘movies’ from all my friends, but limit the number of movies returned to let’s say 10 movies.
FB.api('/me/friends', { fields: 'bio, movies' }, function(response) {
// Do something with data
handleResponse(response);
});
If I add the limit parameter it only limits the number of friends returned, but I want ALL my friends returned and the number of movies limited.
FB.api('/me/friends', { fields: 'bio, movies', limit: 10 }, function(response) {
// Do something with data
handleResponse(response);
});
Is there any way to do this using the Javascript FB.api method? Any ideas/help is appreciated.
**Edit
OK, so using Tommy’s example of ‘field expansion’ below, this is what my example FB.api call would look like if you wanted to limit the number of movies returned to 10:
FB.api('/me/friends', { fields: 'bio, movies.limit(10)' }, function(response) {
// Do something with data
handleResponse(response);
});
Yes, add another parameter called
movies.limit.Example call:
https://graph.facebook.com/me/friends?fields=movies&movies.limit=3&access_token=<access_token>