/* make the API call */
FB.api(
"/id_from_create_call",
"POST",
{
"website": "http:\/\/samples.ogp.me\/256986074381212"
},
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
NSDictionary *params = @{
@"website": @"http://samples.ogp.me/256986074381212",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/id_from_create_call"
parameters:params
HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
Bundle params = new Bundle();
params.putString("website", "http://samples.ogp.me/256986074381212");
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/id_from_create_call",
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(
'/id_from_create_call',
array (
'website' => 'http://samples.ogp.me/256986074381212',
),
'{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 /v3.2/id_from_create_call HTTP/1.1
Host: graph.facebook.com
website=http%3A%2F%2Fsamples.ogp.me%2F256986074381212
curl -X POST \
-d "website=http%3A%2F%2Fsamples.ogp.me%2F256986074381212" \
https://graph.facebook.com/v3.2/id_from_create_call
Request