Available: | Crowd 2.1 and later. |
API version: | 1 |
Note that these might be out of date. For the current versions of Crowd see https://developer.atlassian.com/server/crowd/rest/latest
The Crowd REST APIs allow you to address the Crowd data entities as 'resources'. This means that the data entities are identified by URIs and operated on by HTTP requests (GET, POST, PUT and DELETE). Whenever you GET one of these resources, you receive a representation encoded in XML or JSON. Below are details of the resources made available by the APIs.
Crowd offers a set of REST APIs for use by applications connecting to Crowd.
Please note the main difference between Crowd APIs and the APIs of other applications like JIRA and Confluence: In Crowd, an application is the client of Crowd, whereas in JIRA/Confluence a user is the client. For example, when authenticating a request to a Crowd REST resource via basic authentication, the application name and password is used (and not a username and password). Keep this in mind when using the REST APIs.
URIs for a Crowd REST API resource have the following structure: With context:
1 2http://host:port/context/rest/api-name/api-version/resource-name
Or without context:
1 2http://host:port/rest/api-name/api-version/resource-name
usermanagement
In Crowd 2.1, the only api-name
available is usermanagement
. This is the API that allows an application to interact with the Crowd server.
With context:
1 2http://myhost.com:8095/crowd/rest/usermanagement/1/user?username=USERNAME http://localhost:8095/crowd/rest/usermanagement/latest/user?username=USERNAME
Or without context:
1 2http://crowd.myhost.com:8095/rest/usermanagement/1/user?username=USERNAME http://crowd.myhost.com:8095/rest/usermanagement/latest/user?username=USERNAME
Please refer to the Crowd REST API usage guide for a description of the common factors in the APIs, including a full explanation of the URI format, authentication, API versions, HTTP response codes, and so on.
Figure 1: User
1 2<?xml version="1.0" encoding="UTF-8"?> <user name="username" expand="attributes"> <first-name>First</first-name> <last-name>Last</last-name> <display-name>First Last</display-name> <email>email@email.com</email> <active>true</active> <attributes> <link rel="self" href="link_to_user_attributes"/> </attributes> <password> <link rel="edit" href="link_to_user_password"/> <!-- /user/password?username=<username> --> <value>password</value> <!-- only used when creating a user, otherwise not filled in --> </password> </user>
User List
1 2<?xml version="1.0" encoding="UTF-8"?> <users expand="user"> <user name="username"> <link rel="self" href="link_to_user"/> </user> </users>
Request Body (XML) | Description |
---|---|
None. | GET Retrieves a user
Status code: 200 (OK) if the user exists Response Body (XML): As in Figure 1 |
None. | GET Retrieves a user with attributes
Status code: 200 (OK) if the user exists Response Body (XML): As in Figure 1 with attributes filled in |
As in Figure 1, except with a | POST Creates a new user
Status code: 201 (Created) if the user is successfully created Response Body (XML):
(Since Crowd 2.8)
As in Figure 1 with attributes filled in. |
As in Figure 1, except with a | PUT Updates a user
Status code: 204 (No Content) if the user previously existed and is now updated Response Body (XML): As in Figure 1 |
None. | DELETE Deletes a user
Status code: 204 (No Content) if the user is found and deleted |
None. | GET Retrieves a list of user attributes
Status code: 200 (OK) if the user exists Response Body (XML): A list of user attributes |
| POST Stores all the user attributes for an existing user
Status code: 204 (No Content) if the user attributes are successfully set |
None. | DELETE Deletes a user attribute
Status code: 204 (No Content) if the user attribute is successfully deleted or the attribute was not defined for the user |
| PUT Updates a user's password
Status code: 204 (No Content) if the password is successfully updated |
None. | POST Sends the user a password reset link
Status code: 204 (No Content) if the user is found |
None. | POST Sends a username reminder to the users associated with the given email address
Status code: 204 (No Content) if successful |
None. | GET Optional Retrieves the groups that the user is a direct member of
Status code: 200 (OK) if the user is found, otherwise 404 (Not Found) Response Body (XML): List of groups (See Group List figure) |
None. | GET Retrieves the group that the user is a direct member of
Status code: 200 (OK) if the user and group are found, otherwise 404 (Not Found) Response Body (XML): See Group List figure |
| POST Adds the user (
Status code: 201 (Created) if the user is successfully added to the group |
None | DELETE Removes the group membership of the user
Status code: 204 (No Content) if the group membership is successfully deleted |
None | GET Optional Retrieves the groups that the user is a nested member of
Status code: 200 (OK) if the user is found, otherwise 404 (Not Found) Response Body (XML): List of groups (See Group List figure) |
None | GET Retrieves the group that the user is a nested member of
Status code: 200 (OK) if the user and group are found, otherwise 404 (Not Found) Response Body (XML): See Group List figure |
Figure 2: Group
1 2<?xml version="1.0" encoding="UTF-8"?> <group name="groupname" expand="attributes"> <type>GROUP</type> <description>Group Description</description> <active>true</active> <attributes> <link rel="self" href="link_to_group_attributes"/> </attributes> </group>
Group List
1 2<?xml version="1.0" encoding="UTF-8"?> <groups expand="group"> <group name="groupname"> <link rel="self" href="link_to_group"/> </group> </groups>
All Group Memberships
1 2<memberships> <membership group='parent-group'> <users> <user name='parent-group-user'/> ... </users> <groups> <group name='child-group'/> ... </groups> </membership> ... </memberships>
Request Body (XML) | Description |
---|---|
None. | GET Retrieves a group
Status Code: 200 (OK) if the group is found, otherwise 404 (Not Found) Response Body (XML): As in Figure 2 |
None. | GET Retrieves a group with attributes
Status Code: 200 (OK) if the group is found, otherwise 404 (Not Found) Response Body (XML): As in Figure 2 except including a list of group attributes |
As in Figure 2 | POST Creates a new group
Status Code: 201 (Created) if the group is successfully created |
As in Figure 2 | PUT Updates a group
Status Code: 200 (OK) if the group previously existed and is now updated Response Body (XML): As in Figure 2 |
None. | DELETE Deletes a group
Status Code: 204 (No Content) if the group is found and deleted |
None. | GET Retrieves a list of group attributes
Status Code: 200 (OK) if the group attribute is found, otherwise 404 (Not Found) Response Body (XML): A list of group attributes |
None | POST Stores all the group attributes
Status Code: 204 (No Content) if the group attributes are successfully set |
None | DELETE Deletes a group attribute
Status Code: 204 (No Content) if the group attribute is successfully deleted |
Optional | GET Retrieves the users that are direct members of the specified group
Status Code: 200 (OK) if the group is found, otherwise 404 (Not Found) Response Body (XML): List of users |
| POST Adds user as direct member of group
Status Code: 201 (Created) if the user is successfully added as a member of the group |
None | GET Retrieves the user that is a direct member of the specified group
Status Code: 200 (OK) if the group and user are found, otherwise 404 (Not Found) Response Body (XML): See User figure |
None | DELETE Removes the user membership
Status Code: 204 (No Content) if the user membership is successfully deleted |
None. | GET Optional Retrieves the users that are nested members of the specified group
Status Code: 200 (OK) if the group is found, otherwise 404 (Not Found) Response Body (XML): List of users |
None. | GET Retrieves the user that is a nested member of the specified group
Status Code: 200 (OK) if the group and user are found, otherwise 404 (Not Found) Response Body (XML): See User figure |
None. | GET Optional start-index and max-results query params Retrieves the groups that are direct parents of the specified group
Status Code: 200 (OK) if the group is found, otherwise 404 (Not Found) Response Body (XML): List of groups |
| POST Adds a direct parent group membership
Status Code: 201 (Created) if the parent group membership is successfully added |
None. | GET Retrieves the group that is a direct parent of the specified group
Status Code: 200 (OK) if the groups are found, otherwise 404 (Not Found) Response Body (XML): See Group List figure |
None. | GET Optional Retrieves the groups that are nested parents of the specified group
Status Code: 200 (OK) if the group is found, otherwise 404 (Not Found) Response Body (XML): List of groups |
None | GET Retrieves the group that is a nested parent of the specified group
Status Code: 200 (OK) if the groups are found, otherwise 404 (Not Found) Response Body (XML): See Group figure |
None | GET Optional Retrieves the groups that are direct children of the specified group
Status Code: 200 (OK) if the group is found, otherwise 404 (Not Found) Response Body (XML): List of groups (See Group List figure) |
| POST / Adds a direct child group membership
Status Code: 201 (Created) if the child group membership is successfully added |
None. | GET Retrieves the group that is a direct child of the specified group
Status Code: 200 (OK) if the groups are found, otherwise 404 (Not Found) Response Body (XML): See Membership figure |
None. | DELETE Deletes a child group membership
Status Code: 204 (No Content) if the child group membership is deleted |
None. | GET Optional Retrieves the groups that are nested children of the specified group
Status Code: 200 (OK) if the group is found, otherwise 404 (Not Found) Response Body (XML): List of groups (See Group List figure) |
None. | GET Retrieves the group that is a nested child of the specified group
Status Code: 200 (OK) if the groups are found, otherwise 404 (Not Found) Response Body (XML): See Group figure |
GET
Status Code: 200 (OK) on success, or 404 if unavailable in earlier releases of Crowd. Response Body (XML): Membership details for every group. See All Group Memberships figure. This resource is optimised for streaming XML responses, and does not support JSON responses. |
No session is created in user authentication. An application can simply ask Crowd "is this username/password valid?" This is the primary purpose of the Authentication resource.
Successful Authentication Response
1 2<?xml version="1.0" encoding="UTF-8"?> <user name="username"> ... </user>
Unsuccessful Authentication Response
1 2<?xml version="1.0" encoding="UTF-8"?> <error> <reason>...</reason> <message>Error message</message> </error>
Request Body (XML):
1 2<?xml version="1.0" encoding="UTF-8"?> <password> <value>Password</value> </password>
Description:
POST /authentication?username=USERNAME
Authenticates a user
Status Code:
200 (OK) if successful 400 (Bad Request) if unsuccessful
Response Body (XML):
As below
All Search resource methods have optional start-index
and max-results
query params.
Request Body (XML) | Description |
---|---|
| POST
Searches for users (returning the usernames) with the specified search restriction |
As above | POST
Searches for users with the specified search restriction |
As above | POST
Searches for groups (returning the group names) with the specified search restriction |
As above | POST
Searches for groups with the specified search restriction |
From Crowd 2.2 onwards, you can perform searches using the Crowd Query Language. Use a GET, rather than a POST, and provide the restriction
parameter with CQL:
Request Body (XML):
As above
Descrition:
GET /search?entity-type=ENTITY_TYPE&restriction=CQL_QUERY
Searches for entities of ENTITY_TYPE
(either 'user' or 'group') with the specified search restriction (as Crowd Query Language).
The Crowd SSO token resource allows an application to authenticate a user and receive an SSO token from the Crowd server. The application decides what to do with the SSO token, though normally this SSO token is set as a cookie in the user's browser.
Crowd SSO Session
1 2<?xml version="1.0" encoding="UTF-8"?> <session expand="user"> <link rel="self" href="link_to_token_URI"/> <token>abc123</token> <user name="username"/> <!-- authenticated user --> <created-date>2013-01-30T16:38:27.369+11:00</created-date> <expiry-date>2013-01-30T17:08:27.369+11:00</expiry-date> </session>
Unsuccessful Crowd SSO Session Creation Response
1 2<?xml version="1.0" encoding="UTF-8"?> <error> <reason>...</reason> <message>Error message</message> </response>
Request Body (XML) | Description |
---|---|
| POST Optional Create new session token valid for If an ongoing session already exists for the same authentication credentials and validation factors, then that session token is returned.
Status: 201 (Created) with successful response as above if the session creation was successful or an ongoing session already existed
Response Body (XML): See Crowd SSO Session entity above |
None. | DELETE Optional Invalidate all tokens for a given user name. Optionally, a token key can be saved from invalidation if specified in the
Status: 204 (No Content) if successful 404 (Not Found) if the user is not found 400 (Bad request) if the application is not found |
None. | GET Retrieves the token with the authenticated user expanded
Status: 200 (OK) if successfully retrieved
Response Body (XML): See Crowd SSO Session entity above
|
| POST Validates the session token. Validating the token keeps the SSO session alive.
Status: 200 (OK) if successful
Response Body (XML): See Crowd SSO Session entity above |
| DELETE Invalidates the token
Status: 204 (No Content) |
GET /config/cookie -
Retrieves cookie configurations.
Status: 200 (OK)
Response Body (XML):
1 2<?xml version="1.0" encoding="UTF-8"?> <cookie-config> <domain>.atlassian.com</domain> <secure>true</secure> <name>cookie-name</name> </cookie-config>
Overview of the Crowd REST APIs Crowd Developer Documentation
1 2<memberships> <membership group='parent-group'> <users> <user name='parent-group-user'/> ... </users> <groups> <group name='child-group'/> ... </groups> </membership> ... </memberships>
Rate this page: