Page tree
Skip to end of metadata
Go to start of metadata

The org.opencode4workspace.endpoints.PhotoPostEndpoint is used to post a new profile photo 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 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

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

postPhoto
File photo = new File("C:/temp/PaulWithers.jpg");
PhotoResponse response = client.postPhoto(photo);
assert(response.isSuccess());
Post Photo from Endpoint
PhotoPostEndpoint ep = new PhotoPostEndpoint(client);
File photo = new File("C:/temp/PaulWithers.jpg");
PhotoResponse response = ep.postPhoto(photo);
assert(response.isSuccess());

2 Comments

  1. Anonymous

    Great! Thanks for the Support I have stuck at this code and finally sorted it out.  Currently, I am working on a project regarding the best resume writing service in America and to handle its images and main favicon I stuck to it. Your method is pretty much easy and straight and I will be working over it. Glad someone posted the solution here!

  2. Anonymous

    Much Appreciated! I have gone the extra mile to make these changes yet I failed every attempt. Finally, with your help, I found a proper solution. I have been spending half of my time solving this and there was a situation when I was looking to pay someone to do my essay UK just because I had a short deadline for my college essay submission. It's a pity that I could not do my work on my own but I am more satisfied with the WMCE company who did a great job and wrote a perfect essay for me.


Write a comment…