This edge allows you to publish a photo to a Group's feed.
Use of this endpoint requires App Review. Apps that have already been approved to access this endpoint have until August 1, 2018, to resubmit for review or lose endpoint access.
This operation is not supported.
You can publish photos via upload or URL.
Capture a photo via file upload as multipart/form-data
then use the source
parameter:
POST /v3.2/{group-id}/photos HTTP/1.1
Host: graph.facebook.com
source=%7Bimage-data%7D
/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->post(
'/{group-id}/photos',
array (
'source' => '{image-data}',
),
'{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 */
/* make the API call */
FB.api(
"/{group-id}/photos",
"POST",
{
"source": "{image-data}"
},
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
Bundle params = new Bundle();
params.putString("source", "{image-data}");
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{group-id}/photos",
params,
HttpMethod.POST,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
NSDictionary *params = @{
@"source": @"{image-data}",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/{group-id}/photos"
parameters:params
HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
Publish a photo from the internet by using its URL and the url
parameter:
POST /v3.2/{group-id}/photos HTTP/1.1
Host: graph.facebook.com
url=%7Bimage-url%7D
/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->post(
'/{group-id}/photos',
array (
'url' => '{image-url}',
),
'{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 */
/* make the API call */
FB.api(
"/{group-id}/photos",
"POST",
{
"url": "{image-url}"
},
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
Bundle params = new Bundle();
params.putString("url", "{image-url}");
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{group-id}/photos",
params,
HttpMethod.POST,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
NSDictionary *params = @{
@"url": @"{image-url}",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/{group-id}/photos"
parameters:params
HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
Type of Requirement | Description |
---|---|
Your app must be approved for the following login permissions and features: (Click to expand) | |
The app must be installed on the Group. | |
A User access token for a user who is a member of the Group where the app is installed. | |
The user must grant your app this permission:
|
Name | Description | Type |
---|---|---|
| The description of the photo, used as the accompanying status message in any feed story. |
|
| The description of the photo. |
|
| Set to |
|
| The photo, encoded as form data. Either this or | |
| The URL of a photo that is already uploaded to the internet. Either this or |
|
If successful, you will receive a response with the following information. In addition, this endpoint supports read-after-write and can immediately read the node represented by id
in the return type.
Name | Description | Type |
---|---|---|
| The newly created photo ID |
|
This operation is not supported.
This operation is not supported.