1

I'm trying to upload a jpeg file for profile image using the Profiles REST API to IBM Connections_v5.0. I however get an error message "The type of the photo file you provided is not supported". I'm however able to upload the same file directly using the Connections UI interface directly. I'm setting the MIME type correctly as "image/jpeg". Also tried with GIF and PNG images but get the same error message. Any pointers would be very helpful.

I'm just using FF restclient addon to fire a REST call. So basically doing a PUT on /profiles/photo.do?key=.... Content-Type is set as "image/jpeg" and the payload consists of the image data in binary (base 64) encoded.

Machavity
  • 30,841
  • 27
  • 92
  • 100
  • It would help a lot if you included your code in your question, or at least a [minimal, complete, verifiable example](http://stackoverflow.com/help/mcve) that demonstrates the problem. – Aiken Jan 28 '15 at 10:02
  • @Aiken, here is my example connected with the same problem: `curl "https://apps.na.collabserv.com/profiles/photo.do?key=...&lastMod=..." -o log.out -v -k -u user@mail.com:password -X PUT -H "Content-Type: image/jpg" -T 1.jpg`. Same error... – pstr Jan 28 '15 at 10:22
  • Edit that into your question rather than posting it as a comment, just click the 'edit' text under the question to do so. – Aiken Jan 28 '15 at 10:27
  • @Aiken, it is not my question. I just have the same problem and could provide my 'code'. – pstr Jan 28 '15 at 10:29

2 Answers2

1

The payload should just be the binary of the image, there is no need to Base64 encode it.

Ademund
  • 66
  • 5
0

You should refer to Adding a Profile Photo

You need to use a Key (great stackoverflow post here)

If you know the key for a user's profile you can do the following: key — This is generated by Connections itself during the population process. It is used to define the users profile within the context of Profiles and provides Connections with the ability to associate content with a user when the users LDAP information has been altered. It provides a separation of identity and helps facilitate user content synchronization for Connections.

Once you have a key, you make the following request

URL: https://profiles.enterprise.example.com/profiles/photo.do?key=
b559403a-9r32-2c81-c99w-ppq8bb69442
METHOD: PUT
CONTENT-TYPE: image/png 
input the binary content on the stream

you should be able to use "image/jpeg", "image/jpg", "image/png" or "image/gif"

If you have an error after the PUT method, you should add the SystemOut.log lines which are relevant.

Community
  • 1
  • 1
Paul Bastide
  • 1,505
  • 4
  • 17
  • 22
  • Doing exactly the above. I am adding the key to the URL and setting the Content type. The binary content is base64 encoded string representation of the image file. Since I'm firing this from a REST client I only get the following response back The type of the photo file you provided is not supported. OMITTED – user1120842 Jan 28 '15 at 11:00
  • you can use a mime checker and see the mimetype of the image http://mime.ritey.com/ – Paul Bastide Jan 29 '15 at 11:43