How can I set user avatar in confluence using it's API and python?
EDIT
Alright, I found an endpoint while using confuence in browser.
https://conf.example.ru/rest/user-profile/1.0/iserID/avatar/upload
Where can I found any docs about this endpoint? I feel like confluence has a billion different api's with like 30% documentation for each.
EDIT
I'm now trying to use this endpoint with no documentation. I'm using python requests:
requests.post('https://conf.example.ru/rest/user-profile/1.0/userID/avatar/upload', auth=HTTPBasicAuth('user', 'pass'))
And it returns 403 which means incorrect credentials, but they are correct, I copy pasted them from login page. What should I do. Documentation still needed.
Alright, I've managed to do it. Turns out, that creds were correct, but I didn't provide any image data. Now It works. Just want to make clear that I figured out how to do it using f12 in browser and then, after getting the correct endpoint (which I couldn't find anywhere else), I've figured how to use it with no documentation. Thanks Obama.
Hi gorlov, it is very encouraging to hear that you managed to get this endpoint to work in 2020. I have been having issues using it and would really appreciate you posting more details regarding how you accomplished this (maybe with an example). Like you said there is virtually no documentation for this endpoint anywhere and any insight you could provide would be helpful to me and other people facing this problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
#!/usr/bin/env python3
import xmlrpc.client
server = xmlrpc.client.ServerProxy('{confluence_url}/rpc/xmlrpc')
token = server.confluence1.login('username', 'password')
photo_data = xmlrpc.client.Binary(open(PHOTO_PATH,'rb').read())
picture_added = server.confluence1.addProfilePicture(token, username, image_name, 'image/png', photo_data)
I thought I would add an update as I found this issue very frustrating. This is a way that works with python3. picture_added is true if the profile picture for username was successfully changed. I hope this helps someone.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.