Using REST API
When Confluence User Export is installed on your Confluence server, it is possible to use the REST API and servlets for creating files with user information. With the REST API and servlets you do not have to use the Confluence user interface for exporting each time. You can automate the user export if needed. Use the Python scripts found on the Python scripts page for inspiration.
REST endpoints
URL | Description | HTTP Method | HTTP headers | HTTP Request payload |
---|---|---|---|---|
<CONFLUENCE_BASE_URL>/rest/confluenceuserexport/1.0/search | This is the endpoint that can be used for searching Confluence users. | POST | Content-type: application/json Accept: application/json Authorization: Basic (<username:password>base64) | EXAMPLE 1The payload below get the 20 first users that are active or inactive starting from 0. {
"searchString": "",
"activeUsers": true,
"inActiveUsers": true,
"offset": 0,
"pageSize": 20
} EXAMPLE 2The payload below get the 50 first users that are active or inactive starting from 0 where the user email contains @mail.com. {
"searchString": "@mail.com",
"activeUsers": true,
"inActiveUsers": true,
"offset": 0,
"pageSize": 50
} |
<CONFLUENCE_BASE_URL>/rest/confluenceuserexport/1.0/file/json | Converting Confluence users as JSON to a JSON file. | POST | Content-type: application/json Accept: application/json Authorization: Basic (<username:password>base64) | REQUEST:The payload below is a list of user objects that needs to be converted. [
{
"username": "tester",
"active": true,
"fullName": "tester",
"email": "tester@mail.com",
"directoryName": "Confluence Internal Directory",
"createdDate": "2019-09-03 22:50",
"updatedDate": "2019-09-19 09:20",
"lastLogin": "2019-09-19 09:28",
"groups": [
"testing-space5",
"confluence-users",
"testing-space"
],
"preferredLanguage": "Default",
"canUse": true
}
] RESPONSE:The response from server with the name of the file created and the path to the file on Confluence server. |
<CONFLUENCE_BASE_URL>/rest/confluenceuserexport/1.0/file/xml | Converting Confluence users as JSON to a XML file. | POST | Content-type: application/json Accept: application/json Authorization: Basic (<username:password>base64) | REQUEST:The payload below is a list of user objects that needs to be converted. RESPONSE:The response from server with the name of the file created and the path to the file on Confluence server. |
<CONFLUENCE_BASE_URL>/rest/confluenceuserexport/1.0/file/csv | Converting Confluence users as JSON to a CSV file. | POST | Content-type: application/json Accept: application/json Authorization: Basic (<username:password>base64) | REQUEST:The payload below is a list of user objects that needs to be converted. RESPONSE:The response from server with the name of the file created and the path to the file on Confluence server. |
<CONFLUENCE_BASE_URL>/rest/confluenceuserexport/1.0/file/xlsx | Converting Confluence users as JSON to a XLSX file. | POST | Content-type: application/json Accept: application/json Authorization: Basic (<username:password>base64) | REQUEST:The payload below is a list of user objects that needs to be converted. RESPONSE:The response from server with the name of the file created and the path to the file on Confluence server. |
Servlets
URL | Description | HTTP Method | HTTP headers | HTTP Request parameter |
---|---|---|---|---|
<CONFLUENCE_BASE_URL>/plugins/servlet/confluenceuserexport/admin/download | Download a file created in Confluence temp directory to the client | GET | Authorization: Basic (<username:password>base64) | fileName REQUEST URL:<CONFLUENCE_BASE_URL>/plugins/servlet/confluenceuserexport/admin/download?fileName=confluenceuserexport111f5467-e0de-457e-b7a2-366fdcde1b94.json |
Â