REST Interface V2

Quickstart: REST Upload

Docs come with a REST Interface for upload documents. This allows continuous delivery of documents using a continuous integration server such as Bamboo or Jenkins. So, documents can be kept on the latest version in Confluence.

 

REST URL for uploading a packaged doc (-javadoc.jar / .zip) and CREATE a new item in a specific category:

Method: PUT URL: /rest/docs/2.0/repository/{CATEGORY_ID}/{DOC_NAME}

 

REST URL for uploading a packaged doc (-javadoc.jar / .zip) and UPDATE an existing item: Each document is identified by its unique key. The key consists of two alphanumeric strings separated by a dash (cxxxx-dxxxx).

Method: POST URL: /rest/docs/2.0/repository/{DOC-KEY}

 

CURL Example

The following is a command-line sample of how to CREATE a Javadoc "lib-javadoc.jar" in the specific category with the identifier "c1075". The confluence installation is available at "http://confluence.example.org".

curl -u username:password --upload-file lib-javadoc.jar http://confluence.example.org/rest/docs/2.0/repository/c1075/testDoc

 

This sample demonstrates how to UPDATE an existing doc using the curl command. The value "c1075-d1082" in the URL is the key of the document to be updated.

 

Watch the CURL-Upload Video: https://youtu.be/iHJRdzhd8HA

Python Script

This is a python sample of how to UPDATE a doc:

 

Here, the corresponding command-line call for executing the python script above:

 

Endpoints

The following is a list of all supported REST endpoints of the Docs Plugin.

Get Repository Details

Return a JSON object representing the menu structure of the docs repository.

 

Create Doc

Upload and create a new doc archive (.zip / .jar) under the defined category.

 

Update Doc

Upload a doc archive (.zip / .jar) and UPDATE the specified (existing) doc.

 

Delete Doc

Delete a specific doc.

 

Rename Doc

Rename a doc.

 

Load Doc Details

Get Details about a specific doc.

 

Load Category Details

Get Details about a specific Category.

 

Create Category

Create a new category (menu item) in the repository.

 

Set a category SpaceKey for permission adjustments. (new in version 2.2)

 

Delete Category

Delete a category (menu item).

 

Export Doc as ZIP Archive

Export doc as ZIP Archive. (new in version 2.5.3)

 

Find Category by Name

Find all categories by name. (new in version 2.5.3)

 

Find Doc in a Category by Name

Find all docs in a category by name. (new in version 2.5.3)