This document describes the REST API and resources provided by Confluence. The REST APIs are for developers who want to integrate Confluence into their application and for administrators who want to script interactions with the Confluence server.
Confluence's REST APIs provide access to resources (data entities) via URI paths. To use a REST API, your application will make an HTTP request and parse the response. The response format is JSON. Your methods will be the standard HTTP methods like GET, PUT, POST and DELETE.
Because the REST API is based on open standards, you can use any web development language to access the API.
URIs for the Confluence REST API resource have the following structure:
With context: http://host:port/context/rest/api/resource-name
Or without context: http://host:port/rest/api/resource-name
Example with context: http://example.com:8080/confluence/rest/api/space/ds
Example without context: http://confluence.myhost.com:8095/rest/api/space/ds
In order to be minimise network traffic from the client perspective, our API uses a technique called expansion.
You can use the 'expand' query parameter to specify a comma-separated list of entities that you want expanded, identifying each entity by a given identifier. For example, the value "space,attachments" requests the expansion of entities for which the expand identifier is "space" and "attachments".
You can use the dot notation to specify expansion of entities within another entity. For example "body.view" would expand the content body and expand the view rendering of it.
This documents the current REST API provided by Confluence.parameter | value | description |
---|---|---|
to |
the representation to convert to |
Converts between content body representations.
Not all representations can be converted to/from other formats. Supported conversions:
Source Representation | Destination Representation Supported |
---|---|
storage | view,export_view,editor |
editor | storage |
view | None |
export_view | None |
acceptable request representations:
available response representations:
parameter | value | description |
---|---|---|
id |
Returns a paginated list of attachment Content entities within a single container.
Example request URIs:
http://example.com/rest/api/content/1234/attachments?start=0&limit=10
http://example.com/rest/api/content/1234/attachments?filename=myfile.txt&expand=version,container
parameter | value | description |
---|---|---|
expand |
Default: |
|
start |
||
limit |
Default: 50 |
|
filename |
||
mediaType |
available response representations:
available response representations:
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"
A simple example to attach a file called "myfile.txt" to the container with id "123", with a comment included:
curl -D- -u admin:admin -X POST -H "X-Atlassian-Token: nocheck" -F "file=@myfile.txt;comment=This is my File" http://myhost/rest/api/1/content/123/attachments
A example to attach a file called "myfile.txt" to the container with id "123", with a comment, and set the minorEdits flag to be true:
curl -D- -u admin:admin -X POST -H "X-Atlassian-Token: nocheck" -F "file=@myfile.txt;minorEdit=true;comment=This is my File" http://myhost/rest/api/1/content/123/attachments
An example to upload the same file, with no comment:
curl -D- -u admin:admin -X POST -H "X-Atlassian-Token: nocheck" -F "file=@myfile.txt" http://myhost/rest/api/1/content/123/attachments/456/data
Example request URIs:
http://example.com/rest/api/content/1234/attachments
available response representations:
available response representations:
available response representations:
parameter | value | description |
---|---|---|
id |
||
attachmentId |
the id of the attachment to update |
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.
Example request URI:
http://example.com/rest/api/content/1234/attachments/5678
acceptable request representations:
available response representations:
available response representations:
available response representations:
available response representations:
available response representations:
parameter | value | description |
---|---|---|
id |
||
attachmentId |
the id of the attachment to upload a new file for |
Update the binary data of an Attachment, and optionally the comment.
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"
A simple example to upload a file called "myfile.txt" to the Attachment with id "456" in a container with id "123", with the comment updated, and minorEdit set to true:
curl -D- -u admin:admin -X POST -H "X-Atlassian-Token: nocheck" -F "file=@myfile.txt;minorEdit=true;comment=This is my updated File" http://myhost/rest/api/1/content/123/attachments/456/data
An example to upload the same file, with no comment:
curl -D- -u admin:admin -X POST -H "X-Atlassian-Token: nocheck" -F "file=@myfile.txt" http://myhost/rest/api/1/content/123/attachments/456/data
Example request URI:
http://example.com/rest/api/content/1234/attachments/5678/data
available response representations:
available response representations:
available response representations:
Returns a piece of Content.
Example request: http://example.com/rest/api/content/1234?expand=space,body.view,version,container
parameter | value | description |
---|---|---|
type |
Default: page |
|
spaceKey |
||
title |
||
postingDay |
||
expand |
Default: |
A comma separated list of properties to expand on the content. Default value: history,space,version |
start |
||
limit |
Default: 25 |
available response representations:
available response representations:
parameter | value | description |
---|---|---|
id |
the id of the content |
Deletes a piece of Content.
Returns a piece of Content.
Example request: http://example.com/rest/api/content/1234?expand=space,body.view,version,container
parameter | value | description |
---|---|---|
expand |
Default: history,space,version |
A comma separated list of properties to expand on the content. Default value: history,space,version |
available response representations:
available response representations:
parameter | value | description |
---|---|---|
id |
the id of the content |
parameter | value | description |
---|---|---|
id |
a string containing the id of the content | |
hash |
the hash of the macro body | |
version |
the version of the content which the hash belongs |
Returns the body of a macro (in storage format) with the given hash. This resource is primarily used by connect applications that require the body of macro to perform their work.
The hash is generated by connect during render time of the local macro holder and is usually only relevant during the scope of one request. For optimisation purposes, this hash will usually live for multiple requests.
available response representations:
available response representations:
parameter | value | description |
---|---|---|
id |
A string containing the id of the labels content container |
parameter | value | description |
---|---|---|
prefix |
||
start |
||
limit |
Default: 200 |
available response representations:
available response representations:
Adds a list of labels to the specified content.
The body is the json representation of the list.
Example body:
[ { "prefix": "global", "name": "label2" },
{ "prefix": "global", "name": "label2" } ]
acceptable request representations:
available response representations:
available response representations:
parameter | value | description |
---|---|---|
id |
The {@link ContentType}(s) of the descendants returned is specified by the "expand" query parameter in the request
- this parameter can include expands for multiple descendant types.
If no types are included in the expand parameter, the map returned will just list the descendant types that are available
to be expanded for the {@link Content} referenced by the "id" path parameter.
Currently the only supported descendants are comment descendants of non-comment Content.
Example requests for a page with id "1234":parameter | value | description |
---|---|---|
expand |
Default: |
available response representations:
available response representations:
parameter | value | description |
---|---|---|
id |
||
id |
||
type |
The {@link ContentType}(s) of the descendants returned is specified by the "type" path parameter in the request.
Currently the only supported descendants are comment descendants of non-comment Content.
Example requests for a page with id "1234":parameter | value | description |
---|---|---|
expand |
Default: |
|
start |
||
limit |
Default: 25 |
available response representations:
available response representations:
parameter | value | description |
---|---|---|
spaceKey |
||
expand |
Default: |
|
start |
||
limit |
Default: 25 |
available response representations:
parameter | value | description |
---|---|---|
spaceKey |
Returns the content in this given space
Example request: http://example.com/rest/api/space/TEST/content/1234?expand=space,body.view,version,container
parameter | value | description |
---|---|---|
depth |
Default: all |
|
expand |
Default: |
|
start |
||
limit |
Default: 25 |
available response representations:
available response representations:
parameter | value | description |
---|---|---|
spaceKey |
a string containing the key of the space |
The incoming Space does not include an id, but must include a Key and Name, and should include a Description.
acceptable request representations:
available response representations:
parameter | value | description |
---|---|---|
spaceKey |
||
type |
Returns the content in this given space with the given type
Example request: http://example.com/rest/api/space/TEST/content/1234?type=page,expand=space,body.view,version,container
parameter | value | description |
---|---|---|
depth |
Default: all |
|
expand |
Default: |
|
start |
||
limit |
Default: 25 |
available response representations:
available response representations:
parameter | value | description |
---|---|---|
id |
The {@link ContentType}(s) of the children returned is specified by the "expand" query parameter in the request
- this parameter can include expands for multiple child types.
If no types are included in the expand parameter, the map returned will just list the child types that are available
to be expanded for the {@link Content} referenced by the "id" path parameter.
parameter | value | description |
---|---|---|
expand |
Default: |
available response representations:
available response representations:
parameter | value | description |
---|---|---|
id |
||
id |
||
type |
The {@link ContentType}(s) of the children returned is specified by the "type" path parameter in the request.
Example requests:parameter | value | description |
---|---|---|
expand |
Default: |
|
start |
||
limit |
Default: 25 |
available response representations:
available response representations: