Note that there are some explanatory texts on larger screens.

plurals
  1. POBatch Paged Requests
    primarykey
    data
    text
    <p>I need to retrieve the news feed for a user, and using the Graph API that returns multiple pages. I'd like to get four pages, and that's pretty slow, so I'd like to batch a request for all pages into one request using batching. I can't figure out how to batch-request multiple pages - clearly each request in the batch is dependent on the previous.</p> <p>I wrote up a webpage to let me test this all out, containing the following form:</p> <pre><code>&lt;form method="GET" action="https://graph.facebook.com"&gt; &lt;input type="hidden" name="access_token" value="blahblahblah"&gt; &lt;input type="hidden" name="batch" value="[{'method':'GET', 'name':'getnews', 'omit_response_on_success':false, 'relative_url':'me/home'},{'method':'GET', 'relative_url':'{result=getnews:$.paging.next}'}]"&gt; &lt;input type="hidden" name="method" value="post"&gt; &lt;input type="submit"&gt; &lt;/form&gt; </code></pre> <p>Of course, when I get a response from Facebook that requires paging, the paging.next value is a full URL and the batching functionality wants a relative_url, so my first request works and my second request returns with the paging.next URL in a "body" key.</p> <p>I found a piece of facebook documentation which states that a request like the following works, where you graph.facebook.com is followed by a full URL specifying a request://graph.facebook.com/http://graph.facebook.com/me/home?_fb_url=me/home&amp;access_token=blahblahblah"</p> <p>I was surprised to find that this works, but it does when I just make that GET request to the Graph API. Unfortunately, the batching functionality does not allow me to put that full URL in the "relative_url" field - it just does that "body" thing.</p> <p>Does anybody have a good way to batch requests for multiple pages? kongo09 and I were wondering this over in the facebook dev forum, but I guess that's on its way out... <a href="http://forum.developers.facebook.net/viewtopic.php?id=107098" rel="nofollow">http://forum.developers.facebook.net/viewtopic.php?id=107098</a></p> <p>Thanks, -Karl</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload