REST API - Trash
Available since v. 2.44.0
General availability
Available since v. 3.18.0
Get trash items - added “deletedByName”
Get trash items
Available only for Confluence Administrators and Space Administrators
This API supports Pagination
This API supports optional parameters
Method type: GET
URL: {CONFLUENCE_URL}/rest/extender/1.0/trash/{SPACE_KEY}
where {SPACE_KEY} is the space key
Parameters:
dateFormat - define date format for JSON output fields
trashDateString
andcreationDateString
- default format ‘yyyy-MM-dd'showAttachments - add information about attachments in deleted pages
Example URL:
{CONFLUENCE_URL}/rest/extender/1.0/trash/MYSPACE?dateFormat=MM/dd/yyyy
{CONFLUENCE_URL}/rest/extender/1.0/trash/DEMO?dateFormat=MM.dd.yyyy
Response format: JSON
Example response:
{
"totalWithAttachments": 3,
"total": 1,
"maxResults": 50,
"startAt": 0,
"trash": [
{
"totalAttachments": 2,
"attachments": [
{
"fileSize": 416896,
"fileName": "bilety_2023.11.25_2.pdf",
"creatorName": "admin",
"deletedByName": "admin", //Available only for Confluence >= 8.7.0
"comment": "",
"creationDate": 1671781545071,
"creationDateString": "2022-12-23 08:45:45",
"version": 1,
"fileSizeNice": "407 kB"
},
{
"fileSize": 416507,
"creatorName": "admin",
"deletedByName": "admin", //Available only for Confluence >= 8.7.0
"comment": "",
"creationDate": 1671781545150,
"creationDateString": "2022-12-23 08:45:45",
"fileName": "bilety_2023.11.25_1.pdf",
"version": 1,
"fileSizeNice": "407 kB"
}
],
"trashDate": 1671778675465, //Available only for Confluence >= 7.14
"trashDateString": "2022-12-23 07:57:55", //Available only for Confluence >= 7.14
"contentId": "1703938",
"title": "Test page",
"type": "page"
}
]
}
Purge all
Delete all items from the trash
Method type: DELETE
URL: {CONFLUENCE_URL}/rest/extender/1.0/trash/{SPACE_KEY}/purgeAll
where {SPACE_KEY} is the space key
Purge specific content
Method type: DELETE
URL: {CONFLUENCE_URL}/rest/extender/1.0/trash/{SPACE_KEY}/purgeContent
where {SPACE_KEY} is the space key
Request format: JSON
Example request:
{
"contentId": [
65554, 1081417
]
}
Response format: JSON
Example response:
{
"removedContent": [
65554, 1081417
],
"status": "success"
}
Restore specific content
Method type: POST
URL: {CONFLUENCE_URL}/rest/extender/1.0/trash/{SPACE_KEY}/restoreContent
where {SPACE_KEY} is the space key
Request format: JSON
Example request:
Response format: JSON
Example response:
Pagination
This REST API uses pagination to improve performance for all 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:
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 - 100)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.