Confluence API wrapper for NodeJS Rewrite in typescript from https://github.com/johnpduane/confluence-api
npm install @hyperingenuity/confluence-api
$ npm install confluence-api
`Create an instance of Confluence by providing a username and password (or token) and a baseUrl used for all future requests. Confluence uses basic http authentication. For instance:
`javascript
import Confluence from "confluence-api";
let config = {
username: "testuser",
password: "test-user-pw-or-rest-api-token",
baseUrl: "https://confluence-api-test.atlassian.net/wiki",
version: 4 // Confluence major version, optional
};
const confluence = new Confluence(config);
let data = await confluence.getContentByPageTitle("space-name", "page-title");
// do something interesting with data; for instance,
// data.results[0].body.storage.value contains the stored markup for the first
// page found in space 'space-name' matching page title 'page-title'``Confluence currently exposes the following API...
{Confluence}* Confluence
* new Confluence(config)
* .getSpaces(space, callback)
* .getSpace(space, callback)
* .getSpaceHomePage(space, callback)
* .getContentById(id, callback)
* .getCustomContentById(options, callback)
* .getContentByPageTitle(space, title, callback)
* .postContent(space, title, content, parentId, callback, representation)
* .putContent(space, id, version, title, content, callback, minorEdit, representation)
* .deleteContent(id, callback)
* .getAttachments(space, id, callback)
* .createAttachment(space, id, filepath, callback)
* .updateAttachmentData(space, id, attachmentId, filepath, callback)
* .getLabels(id, callback)
* .postLabels(id, labels, callback)
* .deleteLabel(id, label, callback)
* .search(query, callback)
* .getContentChildByContentId(id, child_type)
* .getContentDescendantByContentId(id, child_type)
* .getPageAsPdf(id)
| Param | Type | Description |
| --- | --- | --- |
| config | Object | |
| config.username | string | |
| config.password | string | The password or REST API Token for the user (docs) |
| config.baseUrl | string | |
| config.version | number | Optional |
Kind: instance method of Confluence
Kind: instance method of Confluence
| Param | Type |
| --- | --- |
| space | string |
Kind: instance method of Confluence
| Param | Type |
| --- | --- |
| space | string |
Kind: instance method of Confluence
| Param | Type |
| --- | --- |
| id | string |
Kind: instance method of Confluence
| Param | Type | Description |
| --- | --- | --- |
| options | object | for the custom content request |
Kind: instance method of Confluence
| Param | Type |
| --- | --- |
| space | string |
| title | string |
Kind: instance method of Confluence
| Param | Type | Description |
| --- | --- | --- |
| space | string | |
| title | string | |
| content | string | |
| parentId | number | A null value will cause the page to be added under the space's home page |
| representation | string | Optional |
Kind: instance method of Confluence
| Param | Type | Description |
| --- | --- | --- |
| space | string | |
| id | string | |
| version | number | |
| title | string | |
| content | string | |
| minorEdit | boolean | Optional |
| representation | string | Optional |
Kind: instance method of Confluence
| Param | Type |
| --- | --- |
| id | string |
Kind: instance method of Confluence
| Param | Type |
| --- | --- |
| space | string |
| id | string |
Kind: instance method of Confluence
| Param | Type | Description |
| --- | --- | --- |
| space | string | |
| id | string | |
| filepath | string | absolute path of the file you are sending |
Kind: instance method of Confluence
| Param | Type |
| --- | --- |
| space | string |
| id | string |
| attachmentId | string |
| filepath | string |
Kind: instance method of Confluence
| Param | Type |
| --- | --- |
| id | string |
Kind: instance method of Confluence
| Param | Type |
| --- | --- |
| id | string |
| labels | Array.<{prefix:string, name:string}> |
Kind: instance method of Confluence
| Param | Type |
| --- | --- |
| id | string |
| label | string |
Kind: instance method of Confluence
| Param | Type |
| --- | --- |
| query | string |
Kind: instance method of Confluence
| Param | Type |
| --- | --- |
| id | string |
| child_type | string |
Kind: instance method of Confluence
| Param | Type |
| --- | --- |
| id | string |
| child_type | string |
Returns pdf buffer that can be:
- written with fs.writeFile
- be handled with an another pdf library such as pdf-lib
Kind: instance method of Confluence
| Param | Type |
| --- | --- |
| id | string |
Copyright (c) 2015, John Duane
Newly features have been implemented by loopingz team freely inspired from haalcala work and atlassian-python-api contributors work
Released under the MIT License