إصدار ‏‎Graph API‎‏

User Picture

A User's profile image.

Querying a User ID (UID) now requires an access token. Refer to the requirements table to determine which token type to include in UID-based requests.

قراءة

Get the app user's profile image.

Requirements

TypeRequirement

Access Tokens

If querying an App-Scoped User ID:

  • None

If querying a User ID:

  • User or Page access token for Facebook Login authenticated requests
  • App access token for server-side requests
  • Client access token for mobile or web client-side requests

If querying a Page-Scoped User ID:

Permissions

None

Notes

  • Supports App-Scoped User IDs (ASID), User IDs (UID), and Page-Scoped User IDs (PSID).
  • By default this edge will return a 302 redirect to the image. To get data about the image, include the redirect=false query string parameter.
  • Profile picture URLs returned by this edge will expire.
  • Tokenless requests on ASIDs made by apps that are inactive or that have not completed Data Use Checkup will receive an error code in response.

Limitations

  • Apps in Development mode that make tokenless requests on ASIDs will receive a silhouette image in response.
  • Apps in Development mode that make requests with a Client token will receive a silhouette image in response.

مثال

Graph API Explorer
GET /v19.0/{user-id}/picture 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(
    '/{user-id}/picture',
    '{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(
    "/{user-id}/picture",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{user-id}/picture",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{user-id}/picture"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
إذا كنت تريد التعرف على كيفية استخدام واجهة Graph API، يرجى قراءة ‏دليل استخدام واجهة Graph 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

لمزيد من التفاصيل عن تقسيم الصفحات، يرجى الاطلاع على ‏دليل Graph API‏.

‎Error Codes‎

خطأالوصف
100Invalid parameter
368The action attempted has been deemed abusive or is otherwise disallowed
200Permissions error
190Invalid OAuth 2.0 Access Token
613Calls to this api have exceeded the rate limit.
459The session is invalid because the user has been checkpointed
104Incorrect signature

إنشاء

لا يمكنك تنفيذ هذه العملية في نقطة النهاية هذه.

جارٍ التحديث

لا يمكنك تنفيذ هذه العملية في نقطة النهاية هذه.

جارٍ الحذف

لا يمكنك تنفيذ هذه العملية في نقطة النهاية هذه.