Profile pictures and uploaded pictures for a Facebook Page.
Retrieve the photos associated to a page.
| 이름 | 설명 |
|---|---|
| 페이지 전체 공개 콘텐츠 액세스 | 이 기능 권한이 필요할 수도 있습니다. |
MODERATE task on the Pagepages_read_engagement permissionpages_show_list permissionGET /v25.0/{page-id}/photos HTTP/1.1
Host: graph.facebook.com/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->get(
'/{page-id}/photos',
'{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(
"/{page-id}/photos",
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{page-id}/photos",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/{page-id}/photos"
parameters:params
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];curl -X GET -G \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/{page-id}/photosBy default reading from the photos edge returns the current profile picture for the Page as well as previous profile pictures. Use the optional type parameter with the value uploaded to get the photos that a Page has uploaded.
GET /{page-id}/photos?type=uploaded| 매개변수 | 설명 |
|---|---|
biz_tag_idint64 | business tag id to filter photos |
business_idnumeric string or integer | optional param assist with filters such as recently used |
typeenum{profile, tagged, uploaded} | 기본 값: profileAllows you to query which type of photos to return |
이 에지로부터 읽는 경우 JSON 형식의 결과를 반환합니다:
{ "
data": [], "paging": {} }
datapaging| 오류 | 설명 |
|---|---|
| 200 | Permissions error |
| 100 | Invalid parameter |
| 80001 | There have been too many calls to this Page account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting. |
| 190 | Invalid OAuth 2.0 Access Token |
| 104 | Incorrect signature |
| 368 | The action attempted has been deemed abusive or is otherwise disallowed |
CREATE_CONTENT task on the Pagepages_read_engagement permissionpages_manage_posts permissionpages_show_list permission| 속성 | 사양 |
|---|---|
파일 유형 | .jpeg, .bmp, .png, .gif, .tiff |
파일 크기 | 파일은 4MB를 초과할 수 없습니다. .png 파일은 1MB를 초과하지 않는 것이 좋습니다. 초과할 경우 이미지가 픽셀화 상태로 표시될 수 있습니다. |
Facebook strips all location metadata before publishing and resizes images to different dimensions to best support rendering in multiple sizes.
There are two separate ways of uploading photos to Facebook:
Attach the photo as multipart/form-data. The name of the object doesn't matter, but historically people have used source as the parameter name for the photo. How this works depends on the SDK you happen to be using to do the post.
Use a photo that is already on the internet by publishing using the url parameter:
POST /v25.0/page-id/photos HTTP/1.1
Host: graph.facebook.com
url=image-url/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->post(
'/page-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(
"/page-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(),
"/page-id/photos",
params,
HttpMethod.POST,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();NSDictionary *params = @{
@"url": @"image-url",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/page-id/photos"
parameters:params
HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];You can upload and publish a single photo in one API request.
curl -i -X POST \ -d "url=https://www.facebook.com/images/fb_icon_325x325.png" \ -d "published=true" \ -d "access_token=<access_token>" \ "https://graph.facebook.com/me/photos"
Upload a photo without publishing it to the /{page-id}/photos edge by making a similar call as described in the single photo post section but by adding the argument published=false.
curl -i -X POST \ -d "url=https://www.facebook.com/images/fb_icon_325x325.png" \ -d "published=false" \ -d "access_token=<access_token>" \ "https://graph.facebook.com/me/photos"
If the photo is used in a scheduled post, temporary=true must be used.
curl -i -X POST \ -d "url=https://www.facebook.com/images/fb_icon_325x325.png" \ -d "published=false" \ -d "temporary=true" \ -d "access_token=<access_token>" \ "https://graph.facebook.com/me/photos"
Use the Graph API Explorer to get SDK code snippets of the requests.
On successful upload, the Graph API provides a response including the photo ID. After you upload an unpublished photo, Facebook stores it in a temporary upload state, which means it will remain on Facebook servers for about 24 hours. If you do not publish these photos within 24 hours, we delete them.
After you successfully upload all photos, you can publish a multi-photo post using the returned ids by using the /page-id/feed endpoint. Here is an example of a request:
curl -i -X POST \
-d "message=Testing multi-photo post!" \
-d "attached_media[0]={"media_fbid":"1002088839996"}" \
-d "attached_media[1]={"media_fbid":"1002088840149"}" \
-d "access_token=<access_token>" \
"https://graph.facebook.com/me/feed"When the photos are part of a scheduled post, the published, scheduled_publish_time, and unpublished_content_type parameters must be included.
curl -i -X POST \
-d "message=Testing multi-photo post!" \
-d "attached_media[0]={"media_fbid":"1002088839996"}" \
-d "attached_media[1]={"media_fbid":"1002088840149"}" \
-d "access_token=<access_token>" \
-d "published=false" \
-d "scheduled_publish_time=1512068400" \
-d "unpublished_content_type=SCHEDULED" \
"https://graph.facebook.com/me/feed"Use the Graph API Explorer to get SDK code snippets of the requests.
When publishing to a page using the Graph API Explorer the media_fbids must appear as an array in one Value box,
[{"media_fbid":"photo_id"},{"media_fbid":"photo_id"}] or an error will occur.
A successful Graph API request returns the Page Post ID.
If you receive any errors, it's typically because of a permission failure or a bad parameter.
photos 에지에 POST 요청을 만들 수 있습니다: | 매개변수 | 설명 |
|---|---|
aidstring | Legacy album ID. Deprecated |
allow_spherical_photoboolean | 기본 값: falseIndicates that we should allow this photo to be treated as a spherical photo. This will not change the behavior unless the server is able to interpret the photo as spherical, such as via Photosphere XMP metadata. Regular non-spherical photos will still be treated as regular photos even if this parameter is true. |
alt_text_customstring | Accessible alternative description for an image |
android_key_hashstring | Android key hash |
application_idnon-empty string | iTunes App ID. This is used by the native Share dialog that's part of iOS |
attemptint64 | 기본 값: 0Number of attempts that have been made to upload this photo |
audience_expboolean | 기본 값: falseAudience exp |
backdated_timedatetime | A user-specified creation time for this photo |
backdated_time_granularityenum{year, month, day, hour, min, none} | 기본 값: noneUse only the part of the |
captionUTF-8 string | The description of the photo 이모티콘 지원 |
composer_session_idstring | Composer session ID |
direct_share_statusint64 | The status to allow sponsor directly boost the post. |
feed_targetingfeed target | Object that controls News Feed targeting for this post. Anyone in these groups will be more likely to see this post. People not in these groups will be less likely to see this post, but may still see it anyway. Any of the targeting fields shown here can be used, but none are required. |
filter_typeint64 | 기본 값: -1Unused? |
full_res_is_coming_laterboolean | 기본 값: falseFull res is coming later |
initial_view_heading_override_degreesint64 | Manually specify the initial view heading in degrees from 0 to 360. This overrides any value present in the photo embedded metadata or provided in the spherical_metadata parameter |
initial_view_pitch_override_degreesint64 | Manually specify the initial view pitch in degrees from -90 to 90. This overrides any value present in the photo embedded metadata or provided in the spherical_metadata parameter |
initial_view_vertical_fov_override_degreesint64 | Manually specify the initial view vertical FOV in degrees from 60 to 120. This overrides any value present in the photo embedded metadata or provided in the spherical_metadata parameter |
ios_bundle_idstring | iOS Bundle ID |
is_explicit_locationboolean | Is this an explicit location? |
is_explicit_placeboolean | If set to |
location_source_idnumeric string or integer | ID of a page or a page set that provides location informationto enable Local Extensions |
manual_privacyboolean | 기본 값: falseManual privacy |
messagestring | Deprecated. Please use the caption param instead. |
namestring | Deprecated. Please use the caption param instead. |
nectar_modulestring | Nectar module. Internal apps only |
no_storyboolean | If set to |
offline_idint64 | 기본 값: 0Offline ID |
og_action_type_idnumeric string or integer | The Open Graph action type |
og_icon_idnumeric string or integer | The Open Graph icon |
og_object_idOG object ID or URL string | The Open Graph object ID |
og_phrasestring | The Open Graph phrase |
og_set_profile_badgeboolean | 기본 값: falseFlag to set if the post should create a profile badge |
og_suggestion_mechanismstring | The Open Graph suggestion |
placeplace tag | Page ID of a place associated with the photo |
privacyPrivacy Parameter | Determines the privacy settings of the photo. If not supplied, this defaults to the privacy level granted to the app in the Login dialog. This field cannot be used to set a more open privacy setting than the one granted |
profile_idint | Deprecated. Use Deprecated |
provenance_infoJSON object | provenance_info |
proxied_app_idnumeric string or integer | Proxied app ID |
publishedboolean | 기본 값: trueSet to |
qnstring | Photos waterfall ID |
scheduled_publish_timeint64 | Time at which an unpublished post should be published (Unix timestamp). Applies to Pages only |
spherical_metadataJSON object | A set of params describing an uploaded spherical photo. This field is not required; if it is not present we will try to generate spherical metadata from the metadata embedded in the image. If it is present, it takes precedence over any embedded metadata. Please click to the left to expand this list and see more information on each parameter. See also the Google Photo Sphere spec for more info on the meaning of the params: https://developers.google.com/streetview/spherical-metadata |
sponsor_idnumeric string or integer | Facebook Page id that is tagged as sponsor in the photo post |
sponsor_relationshipint64 | Sponsor Relationship, such as Presented By or Paid PartnershipWith |
tagslist<Object> | 기본 값: VecTags on this photo |
target_idint | Don't use this. Specifying a |
targetingtarget | Allows you to target posts to specific audiences. Applies to Pages only |
temporaryboolean | 기본 값: falseThis is a temporary photo. |
time_since_original_postint64 | Same as |
uidint | Deprecated |
unpublished_content_typeenum {SCHEDULED, SCHEDULED_RECURRING, DRAFT, PUBLISH_PENDING, ADS_POST, INLINE_CREATED, PUBLISHED, REVIEWABLE_BRANDED_CONTENT} | Content type of the unpublished content type |
urlURL | The URL of a photo that is already uploaded to the Internet. You must specify this or a file attachment |
user_selected_tagsboolean | 기본 값: falseUser selected tags |
vault_image_idnumeric string or integer | A vault image ID to use for a photo. You can use only one of |
id로 표시되는 노드를 읽습니다.id: numeric string, post_id: string, | 오류 | 설명 |
|---|---|
| 368 | The action attempted has been deemed abusive or is otherwise disallowed |
| 324 | Missing or invalid image file |
| 200 | Permissions error |
| 190 | Invalid OAuth 2.0 Access Token |
| 100 | Invalid parameter |
| 240 | Desktop applications cannot call this function for other users |
| 283 | That action requires the extended permission pages_read_engagement and/or pages_read_user_content and/or pages_manage_ads and/or pages_manage_metadata |