GET

Get attachment

Returns a paginated list of attachment Content entities within a single container.

Request

Path parameters

id

string

Required

Query parameters

expand

string

filename

string

limit

string

start

string

mediaType

string

Responses

Returns a JSON representation of a list of attachment Content entities.

application/json

object
GET/rest/api/content/{id}/child/attachment
1 2 3 curl --request GET \ --url 'http://{baseurl}/confluence/rest/api/content/{id}/child/attachment' \ --header 'Accept: application/json'
201Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 { "results": [ { "id": "123456", "type": "page", "status": "current", "title": "My Page", "links": {}, "space": { "id": 123456, "key": "TEST", "name": "Test Space", "status": "current", "icon": {}, "description": {}, "homepage": {}, "links": {}, "type": "global", "creator": {}, "creationDate": "2024-01-01T00:00:00Z", "lastModifier": {}, "lastModificationDate": "2024-01-01T00:00:00Z", "metadata": { "labels": [ "label1", "label2" ] }, "retentionPolicy": {}, "permissions": {} }, "history": { "previousVersion": {}, "nextVersion": {}, "lastUpdated": {}, "latest": true, "createdBy": {}, "createdDate": "2020-01-01T00:00:00Z", "contributors": {}, "contentParentRef": {}, "lastUpdatedRef": {}, "nextVersionRef": {}, "previousVersionRef": {} }, "version": { "by": {}, "when": "2020-01-01T00:00:00Z", "message": "A message", "number": 1, "minorEdit": true, "hidden": true, "syncRev": "123456", "content": {}, "contentRef": {} }, "ancestors": [], "position": 1, "operations": [ { "operation": "read", "targetType": "page" } ], "children": {}, "descendants": {}, "body": {}, "metadata": { "key": "value" }, "extensions": { "key": "value" }, "restrictions": { "use": { "operation": "use", "restrictions": [] } }, "relevantViewRestrictions": { "idProperties": {}, "expanded": true }, "versionRef": { "idProperties": {}, "expanded": true }, "containerRef": { "idProperties": {}, "expanded": true }, "historyRef": { "idProperties": {}, "expanded": true }, "spaceRef": { "idProperties": {}, "expanded": true } } ], "totalCount": 2154, "start": 25, "limit": 25, "size": 25, "_links": { "base": "http://localhost:8085/confluence", "context": "confluence", "self": "http://localhost:8085/rest/api/latest/..?limit=25&start=25", "next": "http://localhost:8085/rest/api/latest/..?limit=25&start=50", "prev": "http://localhost:8085/rest/api/latest/..?limit=25&start=0" } }
POST

Create attachments

Add one or more attachments to a Confluence Content entity, with optional comments.

Comments are optional, but if included there must be as many comments as there are files, and the comments must be in the same order as the files.

This resource expects a multipart post. The media-type multipart/form-data is defined in RFC 1867. Most client libraries have classes that make dealing with multipart posts simple. For instance, in Java the Apache HTTP Components library provides a MultiPartEntity that makes it simple to submit a multipart POST.

In order to protect against XSRF attacks, because this method accepts multipart/form-data, it has XSRF protection on it. This means you must submit a header of X-Atlassian-Token: nocheck with the request, otherwise it will be blocked.

The name of the multipart/form-data parameter that contains attachments must be 'file'.

Request

Path parameters

id

string

Required

Query parameters

expand

string

allowDuplicated

string

status

string

Request bodymultipart/form-data

The attachments to be added. The name of the multipart/form-data parameter that contains attachments must be 'file'.

file

string

comment

string

minorEdit

boolean

hidden

boolean

Responses

returns a JSON representation of the attachments added.

application/json

Content
POST/rest/api/content/{id}/child/attachment
1 2 3 curl --request POST \ --url 'http://{baseurl}/confluence/rest/api/content/{id}/child/attachment' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 { "id": "123456", "type": "page", "status": "current", "title": "My Page", "links": {}, "space": { "id": 123456, "key": "TEST", "name": "Test Space", "status": "current", "icon": { "idProperties": {}, "expanded": true }, "description": {}, "homepage": { "idProperties": {}, "expanded": true }, "links": {}, "type": "global", "creator": { "profilePicture": {}, "displayName": "Joe Smith", "type": "<string>" }, "creationDate": "2024-01-01T00:00:00Z", "lastModifier": { "profilePicture": {}, "displayName": "Joe Smith", "type": "<string>" }, "lastModificationDate": "2024-01-01T00:00:00Z", "metadata": { "labels": [ "label1", "label2" ] }, "retentionPolicy": { "idProperties": {}, "expanded": true }, "permissions": { "idProperties": {}, "expanded": true } }, "history": { "previousVersion": { "idProperties": {}, "expanded": true }, "nextVersion": { "idProperties": {}, "expanded": true }, "lastUpdated": { "idProperties": {}, "expanded": true }, "latest": true, "createdBy": { "profilePicture": {}, "displayName": "Joe Smith", "type": "<string>" }, "createdDate": "2020-01-01T00:00:00Z", "contributors": { "idProperties": {}, "expanded": true }, "contentParentRef": { "idProperties": {}, "expanded": true }, "lastUpdatedRef": { "idProperties": {}, "expanded": true }, "nextVersionRef": { "idProperties": {}, "expanded": true }, "previousVersionRef": { "idProperties": {}, "expanded": true } }, "version": { "by": { "profilePicture": {}, "displayName": "Joe Smith", "type": "<string>" }, "when": "2020-01-01T00:00:00Z", "message": "A message", "number": 1, "minorEdit": true, "hidden": true, "syncRev": "123456", "content": { "idProperties": {}, "expanded": true }, "contentRef": { "idProperties": {}, "expanded": true } }, "ancestors": [], "position": 1, "operations": [ { "operation": "read", "targetType": "page" } ], "children": {}, "descendants": {}, "body": {}, "metadata": { "key": "value" }, "extensions": { "key": "value" }, "restrictions": { "use": { "operation": "use", "restrictions": [] } }, "relevantViewRestrictions": { "idProperties": {}, "expanded": true }, "versionRef": { "idProperties": {}, "expanded": true }, "containerRef": { "idProperties": {}, "expanded": true }, "historyRef": { "idProperties": {}, "expanded": true }, "spaceRef": { "idProperties": {}, "expanded": true } }
POST

Move attachment

Move an attachment to a different content entity object.

When moving the attachment, the name of the attachment can be updated as well.

In order to protect against XSRF attacks, because this method accepts multipart/form-data, it has XSRF protection on it. This means you must submit a header of X-Atlassian-Token: nocheck with the request, otherwise it will be blocked.

A simple example to move an attachment with id "456" in a container with id "123" to a container with "789":

curl -D- -u admin:admin -X POST -H "X-Atlassian-Token: nocheck" "http://myhost/rest/api/content/123/child/attachment/456/move?newContentId=789"

An example to move the same file, while also renaming it to "my-new-name":

curl -D- -u admin:admin -X POST -H "X-Atlassian-Token: nocheck" "http://myhost/rest/api/content/123/child/attachment/456/move?newContentId=789&newName=my-new-name"

This can also be used to only rename an attachment:

curl -D- -u admin:admin -X POST -H "X-Atlassian-Token: nocheck" "http://myhost/rest/api/content/123/child/attachment/456/move?newContentId=123&newName=my-new-name"

Request

Path parameters

attachmentId

string

Required
id

string

Required

Query parameters

newName

string

newContentId

string

Responses

Returned if the operation is successful.

POST/rest/api/content/{id}/child/attachment/{attachmentId}/move
1 2 curl --request POST \ --url 'http://{baseurl}/confluence/rest/api/content/{id}/child/attachment/{attachmentId}/move'
PUT

Update non-binary data of an Attachment

Update the non-binary data of an attachment.This resource can be used to update an attachment's filename, media-type, comment, and parent container.

Request

Path parameters

attachmentId

string

Required
id

string

Required

Request bodyapplication/json

id

string

type

string

status

string

title

string

links

object

space

Space

history

History

version

Version

ancestors

array<Content>

position

integer

Responses

returns a JSON representation of the attachment after being updated.

application/json

Content
PUT/rest/api/content/{id}/child/attachment/{attachmentId}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 curl --request PUT \ --url 'http://{baseurl}/confluence/rest/api/content/{id}/child/attachment/{attachmentId}' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "id": "123456", "type": "page", "status": "current", "title": "My Page", "links": {}, "space": { "id": 123456, "key": "TEST", "name": "Test Space", "status": "current", "icon": { "idProperties": {}, "expanded": true }, "description": {}, "homepage": { "idProperties": {}, "expanded": true }, "links": {}, "type": "global", "creator": { "profilePicture": {}, "displayName": "Joe Smith", "type": "<string>" }, "creationDate": "2024-01-01T00:00:00Z", "lastModifier": { "profilePicture": {}, "displayName": "Joe Smith", "type": "<string>" }, "lastModificationDate": "2024-01-01T00:00:00Z", "metadata": { "labels": [ "label1", "label2" ] }, "retentionPolicy": { "idProperties": {}, "expanded": true }, "permissions": { "idProperties": {}, "expanded": true } }, "history": { "previousVersion": { "idProperties": {}, "expanded": true }, "nextVersion": { "idProperties": {}, "expanded": true }, "lastUpdated": { "idProperties": {}, "expanded": true }, "latest": true, "createdBy": { "profilePicture": {}, "displayName": "Joe Smith", "type": "<string>" }, "createdDate": "2020-01-01T00:00:00Z", "contributors": { "idProperties": {}, "expanded": true }, "contentParentRef": { "idProperties": {}, "expanded": true }, "lastUpdatedRef": { "idProperties": {}, "expanded": true }, "nextVersionRef": { "idProperties": {}, "expanded": true }, "previousVersionRef": { "idProperties": {}, "expanded": true } }, "version": { "by": { "profilePicture": {}, "displayName": "Joe Smith", "type": "<string>" }, "when": "2020-01-01T00:00:00Z", "message": "A message", "number": 1, "minorEdit": true, "hidden": true, "syncRev": "123456", "content": { "idProperties": {}, "expanded": true }, "contentRef": { "idProperties": {}, "expanded": true } }, "ancestors": [ { "id": "123456", "type": "page", "status": "current", "title": "My Page", "links": {}, "space": { "id": 123456, "key": "TEST", "name": "Test Space", "status": "current", "icon": {}, "description": {}, "homepage": {}, "links": {}, "type": "global", "creator": {}, "creationDate": "2024-01-01T00:00:00Z", "lastModifier": {}, "lastModificationDate": "2024-01-01T00:00:00Z", "metadata": { "labels": [ "label1", "label2" ] }, "retentionPolicy": {}, "permissions": {} }, "history": { "previousVersion": {}, "nextVersion": {}, "lastUpdated": {}, "latest": true, "createdBy": {}, "createdDate": "2020-01-01T00:00:00Z", "contributors": {}, "contentParentRef": {}, "lastUpdatedRef": {}, "nextVersionRef": {}, "previousVersionRef": {} }, "version": { "by": {}, "when": "2020-01-01T00:00:00Z", "message": "A message", "number": 1, "minorEdit": true, "hidden": true, "syncRev": "123456", "content": {}, "contentRef": {} }, "ancestors": [], "position": 1, "operations": [ { "operation": "read", "targetType": "page" } ], "children": {}, "descendants": {}, "body": {}, "metadata": { "key": "value" }, "extensions": { "key": "value" }, "restrictions": { "use": { "operation": "use", "restrictions": [] } }, "relevantViewRestrictions": { "idProperties": {}, "expanded": true }, "versionRef": { "idProperties": {}, "expanded": true }, "containerRef": { "idProperties": {}, "expanded": true }, "historyRef": { "idProperties": {}, "expanded": true }, "spaceRef": { "idProperties": {}, "expanded": true } } ], "position": 1, "operations": [ { "operation": "read", "targetType": "page" } ], "children": {}, "descendants": {}, "body": {}, "metadata": { "key": "value" }, "extensions": { "key": "value" }, "restrictions": { "use": { "operation": "use", "restrictions": [] } }, "relevantViewRestrictions": { "idProperties": {}, "expanded": true }, "versionRef": { "idProperties": {}, "expanded": true }, "containerRef": { "idProperties": {}, "expanded": true }, "historyRef": { "idProperties": {}, "expanded": true }, "spaceRef": { "idProperties": {}, "expanded": true } }'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 { "id": "123456", "type": "page", "status": "current", "title": "My Page", "links": {}, "space": { "id": 123456, "key": "TEST", "name": "Test Space", "status": "current", "icon": { "idProperties": {}, "expanded": true }, "description": {}, "homepage": { "idProperties": {}, "expanded": true }, "links": {}, "type": "global", "creator": { "profilePicture": {}, "displayName": "Joe Smith", "type": "<string>" }, "creationDate": "2024-01-01T00:00:00Z", "lastModifier": { "profilePicture": {}, "displayName": "Joe Smith", "type": "<string>" }, "lastModificationDate": "2024-01-01T00:00:00Z", "metadata": { "labels": [ "label1", "label2" ] }, "retentionPolicy": { "idProperties": {}, "expanded": true }, "permissions": { "idProperties": {}, "expanded": true } }, "history": { "previousVersion": { "idProperties": {}, "expanded": true }, "nextVersion": { "idProperties": {}, "expanded": true }, "lastUpdated": { "idProperties": {}, "expanded": true }, "latest": true, "createdBy": { "profilePicture": {}, "displayName": "Joe Smith", "type": "<string>" }, "createdDate": "2020-01-01T00:00:00Z", "contributors": { "idProperties": {}, "expanded": true }, "contentParentRef": { "idProperties": {}, "expanded": true }, "lastUpdatedRef": { "idProperties": {}, "expanded": true }, "nextVersionRef": { "idProperties": {}, "expanded": true }, "previousVersionRef": { "idProperties": {}, "expanded": true } }, "version": { "by": { "profilePicture": {}, "displayName": "Joe Smith", "type": "<string>" }, "when": "2020-01-01T00:00:00Z", "message": "A message", "number": 1, "minorEdit": true, "hidden": true, "syncRev": "123456", "content": { "idProperties": {}, "expanded": true }, "contentRef": { "idProperties": {}, "expanded": true } }, "ancestors": [], "position": 1, "operations": [ { "operation": "read", "targetType": "page" } ], "children": {}, "descendants": {}, "body": {}, "metadata": { "key": "value" }, "extensions": { "key": "value" }, "restrictions": { "use": { "operation": "use", "restrictions": [] } }, "relevantViewRestrictions": { "idProperties": {}, "expanded": true }, "versionRef": { "idProperties": {}, "expanded": true }, "containerRef": { "idProperties": {}, "expanded": true }, "historyRef": { "idProperties": {}, "expanded": true }, "spaceRef": { "idProperties": {}, "expanded": true } }
DEL

Remove attachment

This method will delete the attachment identified by attachmentId. It returns a boolean response indicating whether the operation was successful or not. If the specified attachment or version does not exist, or if the user does not have permission to remove the attachment, appropriate exceptions are thrown and mapped to their corresponding HTTP responses.

Request

Path parameters

attachmentId

string

Required
id

string

Required

Responses

Returns no response if the specified attachment is successfully removed.

DEL/rest/api/content/{id}/child/attachment/{attachmentId}
1 2 curl --request DELETE \ --url 'http://{baseurl}/confluence/rest/api/content/{id}/child/attachment/{attachmentId}'
DEL

Remove attachment version

This method will delete the specified version of an attachment identified by attachmentId and version. If the operation is successful, it returns a response indicating that no content is returned. If the specified attachment or version does not exist, or if the user does not have permission to remove the attachment, appropriate exceptions are thrown and mapped to their corresponding HTTP responses.

Request

Path parameters

attachmentId

string

Required
id

string

Required
version

integer

Required

Responses

Returns no content if the specified attachment version is successfully removed.

DEL/rest/api/content/{id}/child/attachment/{attachmentId}/version/{version}
1 2 curl --request DELETE \ --url 'http://{baseurl}/confluence/rest/api/content/{id}/child/attachment/{attachmentId}/version/{version}'
POST

Update binary data of an attachment

Update the binary data of an Attachment, and optionally the comment and the minor edit field.

This adds a new version of the attachment, containing the new binary data, filename, and content-type.

When updating the binary data of an attachment, the comment related to it together with the field that specifies if it's a minor edit can be updated as well, but are not required.

If an update is considered to be a minor edit, notifications will not be sent to the watchers of that content.

This resource expects a multipart post. The media-type multipart/form-data is defined in RFC 1867. Most client libraries have classes that make dealing with multipart posts simple. For instance, in Java the Apache HTTP Components library provides a MultiPartEntity that makes it simple to submit a multipart POST.

In order to protect against XSRF attacks, because this method accepts multipart/form-data, it has XSRF protection on it. This means you must submit a header of X-Atlassian-Token: nocheck with the request, otherwise it will be blocked.

The name of the multipart/form-data parameter that contains attachments must be 'file'.

Request

Path parameters

attachmentId

string

Required
id

string

Required

Request bodymultipart/form-data

The attachment to be updated.

file

string

comment

string

minorEdit

boolean

hidden

boolean

Responses

returns JSON representation of the updated attachment.

application/json

Content
POST/rest/api/content/{id}/child/attachment/{attachmentId}/data
1 2 3 curl --request POST \ --url 'http://{baseurl}/confluence/rest/api/content/{id}/child/attachment/{attachmentId}/data' \ --header 'Accept: application/json'
200Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 { "id": "123456", "type": "page", "status": "current", "title": "My Page", "links": {}, "space": { "id": 123456, "key": "TEST", "name": "Test Space", "status": "current", "icon": { "idProperties": {}, "expanded": true }, "description": {}, "homepage": { "idProperties": {}, "expanded": true }, "links": {}, "type": "global", "creator": { "profilePicture": {}, "displayName": "Joe Smith", "type": "<string>" }, "creationDate": "2024-01-01T00:00:00Z", "lastModifier": { "profilePicture": {}, "displayName": "Joe Smith", "type": "<string>" }, "lastModificationDate": "2024-01-01T00:00:00Z", "metadata": { "labels": [ "label1", "label2" ] }, "retentionPolicy": { "idProperties": {}, "expanded": true }, "permissions": { "idProperties": {}, "expanded": true } }, "history": { "previousVersion": { "idProperties": {}, "expanded": true }, "nextVersion": { "idProperties": {}, "expanded": true }, "lastUpdated": { "idProperties": {}, "expanded": true }, "latest": true, "createdBy": { "profilePicture": {}, "displayName": "Joe Smith", "type": "<string>" }, "createdDate": "2020-01-01T00:00:00Z", "contributors": { "idProperties": {}, "expanded": true }, "contentParentRef": { "idProperties": {}, "expanded": true }, "lastUpdatedRef": { "idProperties": {}, "expanded": true }, "nextVersionRef": { "idProperties": {}, "expanded": true }, "previousVersionRef": { "idProperties": {}, "expanded": true } }, "version": { "by": { "profilePicture": {}, "displayName": "Joe Smith", "type": "<string>" }, "when": "2020-01-01T00:00:00Z", "message": "A message", "number": 1, "minorEdit": true, "hidden": true, "syncRev": "123456", "content": { "idProperties": {}, "expanded": true }, "contentRef": { "idProperties": {}, "expanded": true } }, "ancestors": [], "position": 1, "operations": [ { "operation": "read", "targetType": "page" } ], "children": {}, "descendants": {}, "body": {}, "metadata": { "key": "value" }, "extensions": { "key": "value" }, "restrictions": { "use": { "operation": "use", "restrictions": [] } }, "relevantViewRestrictions": { "idProperties": {}, "expanded": true }, "versionRef": { "idProperties": {}, "expanded": true }, "containerRef": { "idProperties": {}, "expanded": true }, "historyRef": { "idProperties": {}, "expanded": true }, "spaceRef": { "idProperties": {}, "expanded": true } }

Rate this page: