REST API - Groups

General informations

Availability

Check availability in each rest api documentation



Get group users

Available for all confluence users

This API returns all users with and without access to use Confluence

Since v. 2.7.0 this API supports Pagination

Since v. 2.8.0 - removed parameter showDetails, added parameters showBasicDetails and showExtendedDetails

Method type - GET

URL:

  • {CONFLUENCE_URL}/rest/extender/1.0/group/getUsers/{GROUP}
  • {CONFLUENCE_URL}/rest/extender/1.0/group/getUsers/{GROUP}?showBasicDetails=true
  • {CONFLUENCE_URL}/rest/extender/1.0/group/getUsers/{GROUP}?showExtendedDetails=true

where {GROUP} group name in Confluence.

Response format - JSON


Example URL: 

  • {CONFLUENCE_URL}/rest/extender/1.0/group/getUsers/confluence-users
  • {CONFLUENCE_URL}/rest/extender/1.0/group/getUsers/confluence-users?showBasicDetails=true
  • {CONFLUENCE_URL}/rest/extender/1.0/group/getUsers/confluence-users?showExtendedDetails=true

Calling with a parameter showBasicDetails or showExtendedDetails may affect the response time

Parameters:

  • showBasicDetails, showExtendedDetails - for details please check Example response

  • dateFormat - define date format for date fields in output JSON - default format ‘yyyy-MM-dd'

Example response:

Without parameters

{
  "total": 4,
  "maxResults": 100,
  "startAt": 0,
  "users": [
        {
            "name": "new_user"
        },
        {
            "name": "admin"
        }
    ]
  "status":"success"
}

With parameter showBasicDetails=true

{
  "total": 4,
  "maxResults": 100,
  "startAt": 0,
    "users": [
        {
            "name": "new_user",
            "fullName": "New user",
            "key": "4128810272455d7b0172457188c10000",
            "email": "new@user.pl"
        },
        {
            "name": "admin",
            "fullName": "admin",
            "key": "4128810272455d7b0172457188c10005",
            "email": "admin@admin.com"
        }
    ]
  "status":"success"
}

With parameter showExtendedDetails=true

{
  "total": 4,
  "maxResults": 100,
  "startAt": 0,
    "users": [
        {
            "business": [
                {
                    "location": "",
                    "position": "",
                    "department": ""
                }
            ],
            "lastFailedLoginDate": null,
            "lastSuccessfulLoginDate": null,
            "fullName": "Admin CEO",
            "personal": [
                {
                    "website": "",
                    "im": "",
                    "phone": ""
                }
            ],
            "updatedDate": 1590302967994,
            "lastFailedLoginDateString": null,
            "createdDate": 1590302967994,
            "createdDateString": "2020-05-24 08:49:27",
            "name": "Admin",
            "lastSuccessfulLoginDateString": null,
            "key": "4128810272455d7b0172457188c10000",
            "email": "admin@admin.com",
            "updatedDateString": "2020-05-24 08:49:27",
            "hasAccessToUseConfluence": true
        }
    ]
  "status":"success"
}


Get all groups

Available since v. 1.1.1

Available for all confluence users

Since since v. 2.7.0 this API supports Pagination

Method type - GET

URL:

  • {CONFLUENCE_URL}/rest/extender/1.0/group/getGroups

Response format - JSON


Example response:

{
  "total": 2,
  "maxResults": 100,
  "startAt": 0,
  "groups": [
      "confluence-administrators",
      "confluence-users"
  ],
  "message":"",
  "status":"success"
}



Add groups

Available for confluence administrators

Method type - POST

URL:

  • {CONFLUENCE_URL}/rest/extender/1.0/group/addGroups

Request format - JSON

Example

JSON POST for one group
{
  "groups": [
    "group1"
  ]
}
JSON POST for several groups
{
  "groups": [
    "group1", "group2", "group3"
  ]
}

Response format - JSON

Example

Example 1
{
  "groupsAdded": [
    "group1"
  ],
  "groupsSkipped": [],
  "message": "all groups added",
  "status": "success"
}
Example 1
{
  "groupsAdded": [
    "group2"
  ],
  "groupsSkipped": [
    "group1"
  ],
  "message": "groups added, some groups skipped",
  "status": "success"
}


Remove groups

Available for confluence administrators

Method type - POST

URL:

  • {CONFLUENCE_URL}/rest/extender/1.0/group/removeGroups

Request format - JSON

Example

JSON POST for one group
{
  "groups": [
    "group1"
  ]
}
JSON POST for several groups
{
  "groups": [
    "group1", "group2", "group3"
  ]
}

Response format - JSON

Example

Example 1
{
  "groupsRemoved": [
    "group1"
  ],
  "groupsSkipped": [],
  "message": "all groups removed",
  "status": "success"
}
Example 2
{
  "groupsRemoved": [
    "group2"
  ],
  "groupsSkipped": [
    "group1"
  ],
  "message": "groups removed, some groups skipped",
  "status": "success"
}


Add users to group

Available for confluence administrators

Method type - POST

URL:

  • {CONFLUENCE_URL}/rest/extender/1.0/group/addUsers/{GROUP}

where {GROUP} group name in Confluence.

Request format - JSON

Example

JSON POST for unsafe-one user
{
  "users": [
    "user1"
  ]
}
JSON POST for several users
{
  "users": [
    "user1",
    "user2"
  ]
}

Response format - JSON

Example


Example 1
{
  "usersAdded": [
    "user1"
  ],
  "usersSkipped": [],
  "message": "all users added to group",
  "status": "success"
}
Example 1
{
  "usersAdded": [
    "user2"
  ],
  "usersSkipped": [
    "user1"
  ],
  "message": "users added to group, but some users skipped",
  "status": "success"
}


Remove users from group

Available for confluence administrators

Method type - POST

URL:

  • {CONFLUENCE_URL}/rest/extender/1.0/group/removeUsers/{GROUP}

where {GROUP} group name in Confluence.

Request format - JSON

Example

JSON POST for unsafe-one user
{
  "users": [
    "user1"
  ]
}
JSON POST for several users
{
  "users": [
    "user1",
    "user2"
  ]
}

Response format - JSON

Example

Example 1
{
  "usersRemoved": [
    "user1"
  ],
  "usersSkipped": [],
  "message": "all users removed from group",
  "status": "success"
}
Example 1
{
  "usersRemoved": [
    "user2"
  ],
  "usersSkipped": [
    "user1"
  ],
  "message": "users removed from group, but some users skipped",
  "status": "success"
}



Pagination

This REST API uses pagination to improve performance for all Jira users. Pagination is enforced for methods that could return a large collection of items. When you make a request to a paged API, the response will wrap the returned array of values in a JSON object with paging metadata, for example:

{
    "startAt" : 0,
    "maxResults" : 10,
    "total": 200,
    "objects": [
        { /* result 0 */ },
        { /* result 1 */ },
        { /* result 2 */ }
    ]
}

Where:

  • startAt is the index of the first item returned in the page of results.
  • maxResults is the maximum number of items that can be returned per page. Each API endpoint may have a different limit for the number of items returned, and these limits may change without notice. (default value - 1000)
  • total is the total number of items contained in all pages. This number may change as the client requests the subsequent pages, therefore the client should always assume that the requested page can be empty.