REST API - Attachments


Get attachments

Please read official documentation Confluence REST API Documentation - getAttachments

 


Get all versions of attachment

Available only for:

  • users in group confluence-administrators

  • users who can VIEW the page with this attachment

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

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

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:

 


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.