Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Watson Workspace provides the "/photos" REST endpoint to post a new photo for your profile. Within the WWS Java SDK, the The org.opencode4workspace.endpoints.PhotoPostEndpoint is used to post a new profile photo . This can also be done using the WWClient.postPhoto(and retrieve a PhotoResponse object coresponding to a successful posting.

The PhotoPostEndpoint is instantiated like the other endpoints, by passing in the WWClient for the request. The JPEG image file is posted using the postPhoto(File file) method. The method takes a File which file should be a .jpg less than 300Kb (this is specified as a restriction of the "/photos" REST endpoint in the Watson Workspace documentation). Alternatively the WWClient.postPhoto(File file) helper method is available for easier use.

Note
titleNOTE

The "/photos" endpoint can only be called from a user-authenticated WWClient. They cannot be called from an application-authenticated WWClient.

If the posting is successful, a PhotoResponse object is returned comprising the String id of the photo, a boolean for the successful posting, and a String URL to the photo file.

Examples

Code Block
languagejava
titlepostPhoto
collapsetrue
File photo = new File("C:/temp/PaulWithers.jpg");
PhotoResponse response = client.postPhoto(photo);
assert(response.isSuccess());

...