Newer Version Available

This content describes an older version of this product. View Latest

User Profiles Photo

The user profile photo. Get, post, and crop the photo.

To use an image from the Files page, pass the file ID in the fileId property of the request body or in the fileId request parameter. Images uploaded on the User page and on the Group page don’t have a file ID and can’t be used as the fileId.

To upload a binary file as the user photo, send it in a multipart/form-data message. For information about how to create the multipart/form-data message, see Uploading Binary Files.

To display user profile photos in a feed, cache the user photos. Then use the photoVersionId property of the Photo response body to determine when to update a photo. This technique helps you avoid running over limits and may improve mobile client performance.

Resource
1/connect/user-profiles/userID/photo
1/connect/communities/communityId/user-profiles/userID/photo
Available version
35.0
Requires Chatter
Yes
HTTP methods
GET, DELETE, or POST
Response body for GET
Photo
Request body for POST
Name Type Description Required or Optional Available Version
cropSize Integer The length, in pixels, of any edge of the crop square. Required to crop an uploaded file or an existing file. 35.0
cropX Integer The position X, in pixels, from the left edge of the image to the start of the crop square. Top left is position (0,0). Required to crop an uploaded file or an existing file. 35.0
cropY Integer The position Y, in pixels, from the top edge of the image to the start of the crop square. Top left is position (0,0). Required to crop an uploaded file or an existing file. 35.0
fileId String 18–character ID of an existing file. The key prefix must be 069 and the file size must be less than 2 GB.

Files uploaded on the Group page and on the User Profile page don’t have a file ID and can’t be posted or cropped. Files uploaded on the Files page have a file ID and can be posted and cropped.

Note

Required to choose an existing file. 35.0
versionNumber Integer Version number of an existing file. If not provided, the latest version is used. Optional 35.0
Request parameters for POST
Parameter Name Type Description Required or Optional Available Version
cropSize Integer The length, in pixels, of any edge of the crop square. Required to crop an uploaded file or an existing file. 35.0
cropX Integer The position X, in pixels, from the left edge of the image to the start of the crop square. Top left is position (0,0). Required to crop an uploaded file or an existing file. 35.0
cropY Integer The position Y, in pixels, from the top edge of the image to the start of the crop square. Top left is position (0,0). Required to crop an uploaded file or an existing file. 35.0
fileId String 18 character ID of an existing file. The key prefix must be 069 and the file size must be less than 2 GB.

Files uploaded on the Group page and on the User Profile page don’t have a file ID and can’t be posted or cropped. Files uploaded on the Files page have a file ID and can be posted and cropped.

Note

Required to choose an existing file. 35.0
versionNumber Integer Version number of the existing content. If not provided, the latest version is used. Optional 35.0

Photos are processed asynchronously and may not be visible right away.

Note

Response body for POST
Photo