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

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?

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!

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
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

360 views 2 13
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