图谱 API 版

Page Picture

The profile picture of a Facebook Page.

读取

Get the profile picture of a Facebook Page.

New Page Experience

This endpoint is supported for New Page Experience.

Permissions

OR

例子

Graph API Explorer
GET /v19.0/{page-id}/picture?redirect=0 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}/picture?redirect=0',
    '{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}/picture",
    {
        "redirect": "0"
    },
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
Bundle params = new Bundle();
params.putString("redirect", "0");
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{page-id}/picture",
    params,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
NSDictionary *params = @{
  @"redirect": @"0",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{page-id}/picture"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
curl -X GET -G \
  -d 'redirect=0' \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v19.0/{page-id}/picture
如果你希望详细了解如何使用图谱 API,请阅读我们的图谱 API 指南

参数

参数描述
height
integer

The height of this picture in pixels.

redirect
boolean
默认值:true

By default the picture edge will return a picture instead of a JSON response. If you want the picture edge to return JSON that describes the image set redirect=0 when you make the request.

type
enum{small, normal, album, large, square}

The size of this picture. It can be one of the following values: small, normal, large, square.

width
integer

The width of this picture in pixels.

字段

从这条连线读取将返回一个 JSON 格式的结果:

{ "data": [], "paging": {} }

data

A single ProfilePictureSource node.

paging

详细了解分页功能,请见图谱 API 指南

错误代码

错误描述
100Invalid parameter
190Invalid OAuth 2.0 Access Token
200Permissions error
368The action attempted has been deemed abusive or is otherwise disallowed
80001There 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.
459The session is invalid because the user has been checkpointed
2500Error parsing graph query

创建

你可以通过下列路径向 picture 连线发出 POST 请求:
发布到这个连线会创建 a ProfilePictureSource

Permissions

参数

参数描述
android_key_hash
string

Android key hash for the proxied app ID.

burn_media_effect
boolean

burn_media_effect

caption
UTF-8 string

The caption for a profile pic

支持表情符号
composer_session_id
string

Composer session ID

frame_entrypoint
string

frame_entrypoint

has_umg
boolean

Whether or not the picture uploaded has edits made in the unified media gallery

height
int64

Height for crop

ios_bundle_id
string

iOS bundle ID for the proxied app ID.

media_effect_ids
list<int>

Set of Media Effect IDs that were used on this pic

media_effect_source_object_id
int

The FBID of the media from which the effects were sourced.

msqrd_mask_id
string

MSQRD mask ID that was used to create this pic

已停用
photo
numeric string

ID of the photo to use as the profile pic

picture
URL

URL of the picture to upload

profile_pic_method
string

Method of the profile pic change for logging

profile_pic_source
string

Source of the profile pic change for logging

proxied_app_id
int

ID of the proxied app that performed this action

qn
string

Waterfall logger session ID

reuse
boolean

Whether to reuse an existing profile pic

scaled_crop_rect
Object

Dictionary with fractional (scaled) keys x/y/width/height for crop

x
float

y
float

width
float

height
float

set_profile_photo_shield
string

Whether to set Women in Emerging Markets Profile Photo Safety Shield on or off

sticker_id
int

Sticker ID for profile pics with sticker overlays

sticker_source_object_id
int

The FBID of the source media

suppress_stories
boolean

suppress_stories

width
int64

Width for crop

x
int64

Top-left x-coordinate for crop

y
int64

Top-left y-coordinate for crop

返回类型

Struct {
success: bool,
}

错误代码

错误描述
368The action attempted has been deemed abusive or is otherwise disallowed
332The image you tried to upload is too small. Please try again with a larger image.
200Permissions error
324Missing or invalid image file
240Desktop applications cannot call this function for other users
190Invalid OAuth 2.0 Access Token
121Invalid photo id
100Invalid parameter
283That action requires the extended permission pages_read_engagement and/or pages_read_user_content and/or pages_manage_ads and/or pages_manage_metadata

更新

你无法在此端点执行该操作。

删除

你无法在此端点执行该操作。