HipChat: Example PUT for updating a user photo

dave goodine May 12, 2017

Hi,

I would like an example of a PUT to update a user photo using the hipchat api.  This request is not working:

PUT /v2/user/<username>@foo.com/photo?auth_token=SecretToken  HTTP/1.1
Host: company.hipchat.com
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: 544e703b-d29a-69ce-04a8-51b47cb56405

[{
	"photo" : {
		"_data" : "base64-encoded-data"
	}
	}
	]

1 answer

1 accepted

1 vote
Answer accepted
Arbi Dridi
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 16, 2017

Hi Dave, 

The following should work: 

  1. Create a JSON file with the base64 encoding of the image: 
    echo '{"photo": "' `base64 image.png` '"}' > image.json
  2. Upload the image as JSON: 
    curl -v -X PUT "https://<fqdn>/v2/user/2/photo?auth_token=<auth_token>" -H "Content-Type: application/json" --data @image.json

Notes:

I hope this helps. 

 

dave goodine May 16, 2017

Arbi - works perfectly.  Thank you!

Arbi Dridi
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 16, 2017

You're welcome, Dave. 

Please mark my reply as an answer when you get a chance. 

Thanks. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events