Adding a photo to a profile
Added by IBM contributorIBM | Edited by Claudia R Elbourn on June 15, 2015
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

To add a photo to a user's profile, send an Atom entry document containing a reference from the image file location to the user's Profile.

You can only add a photo to a profile if you are the profile owner or an administrator of the profile.

To add a photo to a profile, complete the following steps:
1. Get the service document for the person's profile. See Retrieving the Profiles service document.
2. From the service document, get the URI for the profiles feed which is specified in the href attribute of the collection element and use it to get the profiles feed for the user.
3. In the returned feed, find the link where the rel attribute has the value "" .../>.  Alternatively, use the URI specified in the "Request Details" table below.





type="image" /> 

4. Use this link to send a PUT request to add the image file.

A binary image file in the format indicated by the Content-Type header in the payload of the request is required.  A REST client that supports a binary stream of the media file you are trying to add is also required.  No ATOM xml payload needed for this operation.

Note: Be sure to make the image file available to the application. For example, if you are writing a Java™ application, you might use a method that extends the EntityEnclosingMethod class to reference the file. Or, you might make the file available by adding it to a file system location that is HTTP addressable.

Method URI Description
PUT /profiles/ Value of the href attribute of the <link rel="" .../> element in the user's profiles feed.
Name Type Optional Description
string No An ID generated by Profiles to identify a certain profile.
Name Type Optional Description
string No Indicates the format of the binary image data in the payload. Use "image/jpeg", "image/jpg", "image/png" or "image/gif"
Code Description
OK. Indicates that the request was received successfully.
Bad Request. Returned when no matching user record can be found.