How to get Bamboo users and groups when connecting to Jira/Crowd

Still need help?

The Atlassian Community is here for you.

Ask the community

Purpose

Sometimes we need to get details from users and groups programmatically when Bamboo is connected to Jira/Crowd.
This information is not available in Bamboo database but we can get this directly from Jira/Crowd using the same requests Bamboo does.

Solution

These are the requests done by Bamboo to get users, membership and groups:

  • Get users

curl -H "Accept: application/xml" \
     -H "Content-Type: application/xml" \
     -d '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><null-search-restriction/>' \
     -X POST '<JIRA_OR_CROWD_URL>/rest/usermanagement/1/search?entity-type=user&start-index=0&max-results=-1&expand=user' \
     --user <APPLICATION>:<PASSWORD>
  • Get groups

curl -H "Accept: application/xml" \
     -H "Content-Type: application/xml" \
     -d '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><null-search-restriction/>' \
     -X POST '<JIRA_OR_CROWD_URL>/rest/usermanagement/1/search?entity-type=group&start-index=0&max-results=-1&expand=group' \
     --user <APPLICATION>:<PASSWORD>
  • Get membership

curl -H "Accept: application/xml" \
     -X GET '<JIRA_OR_CROWD_URL>/rest/usermanagement/1/group/membership' \
      --user <APPLICATION>:<PASSWORD>
  • Get events
curl -H "Accept: application/xml" \
     -X GET '<JIRA_OR_CROWD_URL>/rest/usermanagement/1/event' \
      --user <APPLICATION>:<PASSWORD>

(warning) Please make sure you change the <JIRA_OR_CROWD_URL> to your JIRA or Crowd url, also <APPLICATION> and <PASSWORD>. You should use the same credentials used by Bamboo to get the same results.



Last modified on Sep 5, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.