I am trying to solve the last exercise in the graph academy of facebook developer page, https://developers.facebook.com/graph-academy/graph-api-basics/10/ but when i was asked to:
“GET call using the value from the next field.” i cannot get the excersice well done, because i get a full url in the value for paging.next
my code is:
// Graph API Basics
// Lesson 10 - Pagination
// The FBID of the Facebook page is 20531316728 or facebook.
FB.api('/facebook/posts', 'GET', {}, function(response) {
var paging = response.paging;
log(paging);
log(paging.next);
);
FB.api('/facebook/posts', 'GET', {}, function(response) {
});
the last part, FB.api, is my best try, but when i put the value on paging.next is a full url, i have tryied copy the entire url inside the brackets, or replacing responce variable, anyone can give me a hint?
Also i have tried this, it is working on the js sdk console, but it is not the expected result, the green checkmark is not triggered.this is the screenshot
// Graph API Basics
// Lesson 10 - Pagination
// The FBID of the Facebook page is 20531316728 or facebook.
FB.api('/facebook/posts', 'GET', {}, function(response) {
var paging = response.paging;
log(paging);
log(paging.next);
);
FB.api('paging.next', 'GET', {}, function(response) {
});
2
Answers
Why your answer won’t work:
First of, ‘paging.next’ is just a string. Secondly it is outside the callback function which is outside the callback scope.
Here’s the way I answered it.
I hope this helps.
They just wanted to log first and second pagination object. Try the code below: