Getting Confluence user avatar images

713 views
Skip to first unread message

Salvatore Cammarata

unread,
May 21, 2015, 6:24:08 AM5/21/15
to atlassian-...@googlegroups.com
Hi,
Is there a way to retrieve the URL of the user avatar images via some connect API (REST, Javascript)?

In JIRA, the AP.getUser() return a json object with all the user info, but in Confluence it seems to provide only id infos (at least on my local test server):

Object {fullName: "admin", id: "admin", key: "402881034cd88408014cd88418d80002"}

Thanks,
S.



stephen...@gmail.com

unread,
May 22, 2015, 3:34:02 AM5/22/15
to atlassian-...@googlegroups.com
Hi Salvatore,

Unfortunately, as far as I'm aware you'll have to use an additional request to /rest/prototype/1/user/non-system/{username} using the id from getUser.

Salvatore Cammarata

unread,
May 26, 2015, 6:46:47 AM5/26/15
to atlassian-...@googlegroups.com
Thanks Stephen! It works!

Robert Massaioli

unread,
May 26, 2015, 11:33:40 PM5/26/15
to atlassian-...@googlegroups.com
I think that there is a better REST api to call to get that information. You might want to look at the REST API Browser: https://developer.atlassian.com/docs/developer-tools/using-the-rest-api-browser (This is a better view of the JIRA Rest api docs: https://docs.atlassian.com/jira/REST/latest/)

And you should also look at the Scopes page for the JIRA rest api in the Scopes doc to see what URL's you can use and what scopes your addon needs to hit them: https://developer.atlassian.com/static/connect/docs/latest/scopes/jira-rest-scopes.html

On Tuesday, 26 May 2015 20:46:47 UTC+10, Salvatore Cammarata wrote:
Thanks Stephen! It works!

Salvatore Cammarata

unread,
May 27, 2015, 4:00:26 PM5/27/15
to atlassian-...@googlegroups.com
Hi Robert,
Thanks for the hints, but I need the correspondent REST API for the Confluence server. 

Am I missing something?

Roberto Dominguez

unread,
May 28, 2015, 6:17:28 AM5/28/15
to atlassian-...@googlegroups.com
Salvatore et al,

According to the AC Confluence REST Scopes (https://developer.atlassian.com/static/connect/docs/latest/scopes/confluence-rest-scopes.html) this should work: 

AP.request({url: '/rest/prototype/latest/usera/non-system/roberto.json',type: 'GET',success: function(data) { console.log('got',data);});

The response includes avatarUrl.

have you tried it?

Roberto






--
You received this message because you are subscribed to the Google Groups "Atlassian Connect Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connec...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages