How to get user information from Confluence REST API? Edited

I am trying to get user details like their name, email, phone, about me, department and position.

I am getting only following as response and no expandable properties.

URL - "/rest/api/user?username=sample"

Response

{"type":"known","username":"sample","userKey":"2edfc034541014edfc2c9ba06b8","profilePicture":{"path":"/images/icons/profilepics/default.png","width":48,"height":48,"isDefault":true},"displayName":"Sample, User","_links":{"base":"https://confluence.com","context":"","self":"https://confluence.com/rest/experimental/user?key=2edfc034541014edfc2c9ba06b8"}}

 

PS - I have modified to JSON details above to hide personal details.

1 answer

2 votes
Stephen Deutsch Community Champion May 29, 2017

Hi Ashwini,

I'm fairly familiar with the Confluence API and I'm pretty sure that there is no way to get the information that you require via the REST API. Only name and e-mail should be available, but unfortunately phone, about me, department, and position are not accessible.

Hi Stephen,
Can you please share how to get the user's email address.
https://docs.atlassian.com/confluence/REST/6.2.1/#user-getUser

What all is expadable while making the request?

Stephen Deutsch Community Champion May 30, 2017

Hi Arjun,

I stand corrected. It does seem possible to get the details using the new /rest/user API endpoint. Here is the usage:

https://<confluence_url>/<context_path, if there is one>/rest/api/user?username=<username>&expand=details.personal,details.business

details.personal contains phone, website, and e-mail, and details.business contains position, department, and location.

Hi Stephen,

I also want to get the email address via REST, but it's missing.

That's what I got for:

GET /rest/api/user?username=myusername&expand=details.personal,details.business

{
  "type": "known",
  "username": "myusername",
  "userKey": "myuserkey",
  "profilePicture": {
    "path": "/download/attachments...",
    "width": 48,
    "height": 48,
    "isDefault": false
  },
  "displayName": "myDisplayName",
  "_links": {
    "base": "baseURL",
    "context": "",
    "self": "..."
  }
}

We are using the external LDAP user directory. Confluence Version 6.2.1. 

Thanks for your help!

Stephen Deutsch Community Champion Jul 06, 2017

It appears that the expansions are not available for Confluence Server yet; I tested on Cloud and thought that it would be the same, but apparently the products are developing at a different pace.

An alternative to be able to get the e-mail address:

https://<confluence_url>/rest/prototype/1/user/non-system/myusername

The result should be in displayableEmail.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Published 8 hours ago in Confluence

Think you know shares vs. @mentions in Confluence? Take this collab quiz.

To anyone who doubts that Atlassians are a little too obsessed with collaboration, and tools related thereto, let me describe a recent discussion we had (which took place on our internal Confluence, ...

85 views 2 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you