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.
Type | Requirement |
---|---|
If querying an App-Scoped User ID:
If querying a User ID:
If querying a Page-Scoped User ID: | |
None |
302
redirect to the image. To get data about the image, include the redirect=false
query string parameter.GET /v21.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
}];
Parameter | Description |
---|---|
height integer | The height of this picture in pixels. |
redirect boolean | Default value: 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 |
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. |
Reading from this edge will return a JSON formatted result:
{ "
data
": [], "paging
": {} }
data
paging
Error | Description |
---|---|
100 | Invalid parameter |
368 | The action attempted has been deemed abusive or is otherwise disallowed |
200 | Permissions error |
190 | Invalid OAuth 2.0 Access Token |
613 | Calls to this api have exceeded the rate limit. |
459 | The session is invalid because the user has been checkpointed |
483 | The session is invalid because the user is in consent app blocking |
2500 | Error parsing graph query |
104 | Incorrect signature |