Skip to end of metadata
Go to start of metadata

Under development.

Contents

Introduction

conflcmd is a simple command-line tool (which uses pyconfluence) that allows one to manage Confluence content. conflcmd uses the REST API (Confluence 6.x).

Usage

usage: conflcmd [<options>] <serverurl> <cmd> [<args>]

Manage content on Confluence site. Unless indicated, if <path> is
"-", input is read from stdin.

Common options:
-P                  Ask for password.
-u <username>       Account to use.

Commands:
add-attachment <spacekey> <pagename> <attachmentname> <path> <comment>
    Add attachment. NIY.

create-page <spacekey> <parentpagename> <pagename> <path>
    Create page. Set parentpagename to "" to create top-level page.

delete-attachment <spacekey> <pagename> <attachmentname>
    Delete attachment. NIY.

delete-page <spacekey> <pagename>
    Delete page. NIY.

get-attachment <spacekey> <pagename> <attachmentname>
    Get attachment.

get-page <spacekey> <pagename>
    Get page contents.

get-page-view <spacekey> <pagename>
    Get rendered page contents.

list-attachments <spacekey> <pagename>
    List page attachments.

list-pages <spacekey>
    List pages.

list-spaces
    List space keys.

update-attachment <spacekey> <pagename> <attachmentname> <path> <comment>
    Update existing attachment.

update-page <spacekey> <pagename> <path> <comment>
    Update existing page.

Examples

If access is restricted, use the -u to pass username and -P to be asked the password. This is usually required to create, delete, and update.

List pages in space "TEST":

conflcmd https://localhost/confluence list-pages TEST

Get page contents in space "TEST":

conflcmd https://localhost/confluence get-page TEST Test

Get rendered page contents in space "TEST":

conflcmd https://localhost/confluence get-page-view TEST Test

Create a page in space "TEST":

conflcmd -u john -P https://localhost/confluence create-page TEST "" "Test2" test.html

Notes:

  • -u is used to specify the account to use
  • -P tells conflcmd to ask for the password (safer than putting it on the command line)
  • set parentpagename to "" to create a top-level page (i.e., not a child page)
  • the content is taken from the test.html file

Create a page as a child of another in space "TEST":

conflcmd https://localhost/confluence create-page TEST "Test2" "Test3" test.html

Update page "Hello" content in space "TEST":

conflcmd -u john -P https://localhost/confluence update-page TEST Hello hello.html ""

Notes:

  • the content is taken from the hello.html file
  • the change comment is empty ""

Update page "Hello" content in space "TEST" from stdin:

echo "<h1>Hello</h1><p>Hey there!!!</p>" | conflcmd -u john -P https://localhost/confluence update-page TEST Hello - ""

Update attachment on "Hello" page in space "TEST":

conflcmd -u john -P https://localhost/confluence update-attachment TEST Hello report.pdf new_report.pdf ""

Notes:

  • attachment named report.pdf is being updated
  • the content is taken from new_report.pdf


  • No labels