npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@illia.kudria/confluence-api

v1.4.1

Published

Confluence API wrapper for NodeJS

Downloads

3

Readme

Confluence API

This project contains a Node.js module which wraps Atlassian's Confluence API.

Getting Started

Install confluence-api via npm:

$ npm install @illia.kudria/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. REST API V2 is used by default. For instance:

var Confluence = require("confluence-api");
var config = {
    username: "testuser",
    password: "test-user-pw-or-rest-api-token",
    baseUrl:  "https://confluence-api-test.atlassian.net/wiki",
    useApiV1: true, // set to use REST API V1, optional
    version: 4 // Confluence major version, optional
};
var confluence = new Confluence(config);
confluence.getPageById("page-id", function(err, data) {
    // do something interesting with data; for instance,
    // data.body.storage.value contains the stored markup for the first
    console.log(data);
});

Confluence currently exposes the following API...

Confluence

Kind: global class this: {Confluence}

new Confluence(config)

Construct Confluence.

| 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.useApiV2 | boolean | Default true, Optional | | config.version | number | Optional |


REST API V2 METHODS

confluence.getSpaces(callback)

Get spaces.

Kind: instance method of Confluence

| Param | Type | |----------|------------------------| | callback | function |

confluence.getSpaceById(id, callback)

Get space by id.

Kind: instance method of Confluence

| Param | Type | Value | |----------|------------------------|-----------------| | id | string | ID of the space | | callback | function | |

confluence.createPage(data, callback)

Creates a page in the space.

Kind: instance method of Confluence

| Param | Type | Value | |--------------------------|-----------------------|--------------------------------------------------------------------------------------------------------| | data | object | data of new page | | data.spaceId | string | ID of the space | | data.status | string | the status of the page, published or draft | | data.title | string | title of the page, required if page status is not draft | | data.parentId | string | the parent content ID of the page | | data.body | object | | | data.body.representation | string | type of content representation used for the value field. Valid values: storage, atlas_doc_format, wiki | | data.body.value | string | body of the page, in the format found in the representation field | | callback | function | |

confluence.getPageById(id, callback)

Get page by id.

Kind: instance method of Confluence

| Param | Type | Value | |----------|------------------------|----------------| | id | string | ID of the page | | callback | function | |

confluence.updatePage(data, callback)

Update a page by id.

Kind: instance method of Confluence

| Param | Type | Value | |--------------------------|-----------------------|--------------------------------------------------------------------------------------------------------| | data | object | page data | | data.id | string | ID of the page | | data.status | string | the updated status of the page. Valid values: current, draft | | data.title | string | title of the page | | data.body | object | | | data.body.representation | string | type of content representation used for the value field. Valid values: storage, atlas_doc_format, wiki | | data.body.value | string | body of the page, in the format found in the representation field | | data.version | object | | | data.version.number | number | the new version of the updated page | | data.version.message | string | an optional message to be stored with the version | | callback | function | |

confluence.deletePage(id, callback)

Delete a page by id.

Kind: instance method of Confluence

| Param | Type | Value | |----------|------------------------|----------------| | id | string | ID of the page | | callback | function | |

confluence.getPageVersions(id, callback)

Returns the versions of specific page.

Kind: instance method of Confluence

| Param | Type | Value | |----------|------------------------|----------------| | id | string | ID of the page | | callback | function | |


REST API V1 METHODS

confluence.getSpace(space, callback)

Get space information.

Kind: instance method of Confluence

| Param | Type | | --- | --- | | space | string | | callback | function |

confluence.getSpaceHomePage(space, callback)

Get space home page.

Kind: instance method of Confluence

| Param | Type | | --- | --- | | space | string | | callback | function |

confluence.getContentById(id, callback)

Get stored content for a specific space and page title.

Kind: instance method of Confluence

| Param | Type | | --- | --- | | id | string | | callback | function |

confluence.getCustomContentById(options, callback)

Get stored content for a specific page id with optional custom expanders.

Kind: instance method of Confluence

| Param | Type | Description | | --- | --- | --- | | options | object | for the custom content request | | callback | function | |

confluence.getContentByPageTitle(space, title, callback)

Get stored content for a specific space and page title.

Kind: instance method of Confluence

| Param | Type | | --- | --- | | space | string | | title | string | | callback | function |

confluence.postContent(space, title, content, parentId, callback, representation)

Post content to a new page.

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 | | callback | function | | | representation | string | Optional |

confluence.putContent(space, id, version, title, content, callback, minorEdit, representation)

Put/update stored content for a page.

Kind: instance method of Confluence

| Param | Type | Description | | --- | --- | --- | | space | string | | | id | string | | | version | number | | | title | string | | | content | string | | | callback | function | | | minorEdit | boolean | Optional | | representation | string | Optional |

confluence.deleteContent(id, callback)

Delete a page.

Kind: instance method of Confluence

| Param | Type | | --- | --- | | id | string | | callback | function |

confluence.getAttachments(space, id, callback)

Get attachments

Kind: instance method of Confluence

| Param | Type | | --- | --- | | space | string | | id | string | | callback | function |

confluence.createAttachment(space, id, filepath, callback)

This allows you to post attachments to the pages you create.

Kind: instance method of Confluence

| Param | Type | Description | | --- | --- | --- | | space | string | | | id | string | | | filepath | string | absolute path of the file you are sending | | callback | function | |

confluence.updateAttachmentData(space, id, attachmentId, filepath, callback)

This allows you to update posted attachments data

Kind: instance method of Confluence

| Param | Type | | --- | --- | | space | string | | id | string | | attachmentId | string | | filepath | string | | callback | function |

confluence.getLabels(id, callback)

Get labels from content

Kind: instance method of Confluence

| Param | Type | | --- | --- | | id | string | | callback | function |

confluence.postLabels(id, labels, callback)

Post content labels to a existing page.

Kind: instance method of Confluence

| Param | Type | | --- | --- | | id | string | | labels | Array.<{prefix:string, name:string}> | | callback | function |

confluence.deleteLabel(id, label, callback)

Delete a label from a page.

Kind: instance method of Confluence

| Param | Type | | --- | --- | | id | string | | label | string | | callback | function |

confluence.search(query, callback)

Search by query

Kind: instance method of Confluence

| Param | Type | | --- | --- | | query | string | | callback | function |

request

Node.js wrapper for Atlassian's Confluence API. See https://developer.atlassian.com/confdev/confluence-rest-api

Copyright (c) 2015, John Duane Released under the MIT License