/* make the API call */
FB.api(
"/me/books.wants_to_read",
"POST",
{
"book": "http:\/\/samples.ogp.me\/344468272304428"
},
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
NSDictionary *params = @{
@"book": @"http://samples.ogp.me/344468272304428",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/me/books.wants_to_read"
parameters:params
HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
Bundle params = new Bundle();
params.putString("book", "http://samples.ogp.me/344468272304428");
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/me/books.wants_to_read",
params,
HttpMethod.POST,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->post(
'/me/books.wants_to_read',
array (
'book' => 'http://samples.ogp.me/344468272304428',
),
'{access-token}'
);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
POST /v2.12/me/books.wants_to_read HTTP/1.1
Host: graph.facebook.com
book=http%3A%2F%2Fsamples.ogp.me%2F344468272304428
curl -X POST \
-d "book=http%3A%2F%2Fsamples.ogp.me%2F344468272304428" \
https://graph.facebook.com/v2.12/me/books.wants_to_read
Request