Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Add functionality to send batched requests to graph API #62

Closed
wants to merge 1 commit into from
Closed

Add functionality to send batched requests to graph API #62

wants to merge 1 commit into from

Conversation

gary-rafferty
Copy link
Contributor

When making multiple calls to the graph API, it is often handy to batch up the requests and make a single call.
This commit allows you to make calls like

$facebook = new Facebook(array(
  'appId'  => APP_ID,
  'secret' => SECRET
));

$batch_data = array(
  array('method' => 'GET', 'relative_url' => 4),
  array('method' => 'GET', 'relative_url' => 5)
);

$response = $facebook->batch($batch_data);

// Verify the response(s)
$this->assertEquals(2, count($response));
$this->assertEquals(4, $response[0]['id']);
$this->assertEquals(5, $response[1]['id']);
$this->assertEquals('zuck', $response[0]['username']);
$this->assertEquals('ChrisHughes', $response[1]['username']);

@gfosco
Copy link
Contributor

gfosco commented Oct 14, 2013

Hi Gary,

This sounds like a good addition to the library. Once you've signed the CLA (I commented on one of your other PRs with the URL,) we can further review and consider this.

Thanks for your contribution,

Fosco

@gary-rafferty
Copy link
Contributor Author

Hi Fosco,

The CLA has now been signed. Thanks,

@gfosco
Copy link
Contributor

gfosco commented Oct 28, 2013

We'll look to add batch support to a future release, after the main codebase is refactored and namespaced with newer PHP features. We also want to spend some time designing the API and fully test it. It will be tracked by issue #109

Thanks for your contribution.

@gfosco gfosco closed this Oct 28, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants