Atlssian Confluence API
This project contains some Node.js modules which wraps Atlassian's Confluence APIs.
Features
This client wraps all Confluence Cloud REST APIs with nodejs, including:
- Audit
- Content
- Group
- Longtask
- Relation
- Search
- Settings
- Space
- Template
- User
Reference: https://developer.atlassian.com/cloud/confluence/rest/
Installation
$ npm install confluence-restapi
Usages
-
Define the client config, like:
var config =user: "*****"password: "*****"baseUrl: "https://******.atlassian.net/wiki/rest/api";More config options parameters, refer to: https://www.npmjs.com/package/node-rest-client
-
Create a client instance, like:
var ConfluenceAPI = ;var confluenceAPI = ConfluenceAPI; -
Call API with the above instance, like:
//demo1: get contentsvar params =start : 0limit : 5;confluenceAPIcontent;//demo2: create contentvar params =status : 'current';var request =ancestors:id : "1802243"body:"storage":"value": "<p>This page was created by RESTAPI. Creator: Sam.Li</p>""representation": "storage"space:key : "TES"status: "current"title: "This page was created at " +type: "page";confluenceAPIcontent;//demo3: get content by idvar contentId = tempContentId;var params =embeddedContentRender : "current"status: "current";confluenceAPIcontent;//demo4: update contentvar contentId = tempContentId;var params =conflictPolicy: "abort"status : 'current';var request =ancestors:id : "1802243"body:"storage":"value": "<p>This page was updated by RESTAPI. Creator: Sam.Li</p><p>Updated at: " + + "</p>""representation": "storage"space:key : "TES"status: "current"title: "This page was updated at " +type: "page"version:number: versionNum+1;confluenceAPIcontent;//demo5: search with CQLvar params =cql: "creator=admin and title ~ \"test*\""limit: 10start: 0;confluenceAPIsearch;//demo6: create attachmentvar contentId = "1802243";var params =status: "current";var attachFileName = "./attachment.txt";var form =file :value: fsoptions:filename: attachFileNamecontentType: 'text/plain'comment: "Create attachment"minorEdit: 'false';confluenceAPIcontent;
Lisence
Lisenced under MIT Lisence
Contact
Email: sanlai_lee@qq.com
QQ: 1427894034