REST API - Attachments
Available since v. 2.31.0
Get attachments
Please read official documentation Confluence REST API Documentation - getAttachments
Get all versions of the attachment
Available only for:
users in group confluence-administrators
users who can VIEW the page with this attachment
This API supports Pagination
Method type: GET
URL: {CONFLUENCE_URL}/rest/extender/1.0/content/attachment/{ATTACHMENT_ID}/versions
where {ATTACHMENT_ID} is the attachment id
Response format: JSON
Example response:
{
"total": 5,
"versions": [
{
"fileSize": 10342,
"creatorName": "admin",
"comment": "",
"creationDate": 1657610335026,
"version": 5,
"fileSizeNice": "10 kB"
},
{
"fileSize": 10342,
"creatorName": "admin",
"comment": "",
"creationDate": 1657610331450,
"version": 4,
"fileSizeNice": "10 kB"
},
{
"fileSize": 10342,
"creatorName": "admin",
"comment": "",
"creationDate": 1657610327882,
"version": 3,
"fileSizeNice": "10 kB"
},
{
"fileSize": 10342,
"creatorName": "admin",
"comment": "",
"creationDate": 1657610312649,
"version": 2,
"fileSizeNice": "10 kB"
},
{
"fileSize": 10342,
"creatorName": "admin",
"comment": "",
"creationDate": 1657610309971,
"version": 1,
"fileSizeNice": "10 kB"
}
],
"fileExtension": "xlsx",
"maxResults": 100,
"name": "Book1.xlsx",
"id": 819207,
"startAt": 0
}
Delete attachment
Removes an Attachment and its data from the server and data store (and all of its versions)
Available only for:
users in group confluence-administrators
users who can EDIT the page with this attachment AND has the right to delete attachments for the space where the attachment is located
Method type: DELETE
URL: {CONFLUENCE_URL}/rest/extender/1.0/content/attachment/{ATTACHMENT_ID}/delete
where {ATTACHMENT_ID} is the attachment id
Response format: JSON
Example response:
{
"message": "attachment with id '1441802' does not exist"
}
{
"message": "Attachment 'Book1.xlsx' deleted.",
"status": "success"
}
Delete specific versions of an attachment
Removes the given version of the Attachment and its data from the server and data store.
Available only for:
users in group confluence-administrators
users who can VIEW the page with this attachment AND has space administrator rights
Method type: DELETE
URL: {CONFLUENCE_URL}/rest/extender/1.0/content/attachment/{ATTACHMENT_ID}/delete/{VERSION_ID}
where {ATTACHMENT_ID} is the attachment id
where {VERSION_ID} is the version id
Response format: JSON
Example response:
{
"message": "attachment with id '1638412' does not exist"
}
{
"message": "version '3' of the 'Book1.xlsx' attachment has been removed",
"status": "success"
}
{
"message": "version '3' of the 'Book1.xlsx' attachment does not exist"
}
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:
{
"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 - 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.