- Scheme 98.5%
- Makefile 1.5%
| .github/workflows | ||
| confluence | ||
| docs | ||
| .gitignore | ||
| build.ss | ||
| Change.org | ||
| CLAUDE.md | ||
| confluence.ss | ||
| gerbil.pkg | ||
| Makefile | ||
| manifest.ss | ||
| README.md | ||
Gerbil Confluence Client
A comprehensive Confluence REST API client written in Gerbil Scheme, supporting all major Confluence Cloud REST API v1 endpoints.
Features
- Complete API Coverage: Support for 60+ Confluence REST API endpoints
- Content Management: Create, read, update, and delete pages and blog posts
- Space Management: List, create, update, and delete spaces
- Collaboration: Comments, labels, and attachments
- User & Group Management: Query users and groups
- Advanced Features: Content properties, restrictions, versioning, and audit logs
- Secure Authentication: Encrypted password storage using AES-256-CTR
- CLI Interface: Easy-to-use command-line interface for all operations
Installation
Build from Source
Prerequisites:
- Gerbil Scheme installed at
/opt/gerbil - Docker (for static builds)
make build
For static Linux builds:
make linux-static-docker
Install the binary:
make install
Configuration
Create a configuration file at ~/.confluence.yaml:
url: https://your-instance.atlassian.net
user: your-email@example.com
space: YOUR-SPACE-KEY
Setup encrypted authentication:
confluence config
This will prompt for your password and generate an encrypted secrets entry to add to your config file.
Usage
Content Operations
Create a Page
# Create a page from a file (file name becomes page title with hyphens replaced by spaces)
confluence create my-new-page.cml
Update a Page
# Update using just content ID (fetches current version automatically)
confluence update 123456 updated-content.cml
# Update with explicit version
confluence update-batch 5 123456 "Page Title" content.cml
Get Content
# Get content metadata
confluence get 123456
# Get content body
confluence body 123456
# Get content info (including children)
confluence info 123456
Delete Content
confluence remove-doc 123456
Search Content
# Simple text search
confluence search "search term"
# CQL search
confluence search "type=page AND space=DEV"
Space Operations
List Spaces
confluence list-spaces
Get Space Information
confluence get-space SPACEKEY
Create a Space
confluence create-space MYKEY "My Space Name" "Space description"
Delete a Space
confluence delete-space SPACEKEY
Label Operations
Get Labels
confluence get-labels 123456
Add Labels
# Add multiple labels (comma-separated)
confluence add-labels 123456 "label1,label2,label3"
Remove a Label
confluence remove-label 123456 labelname
Comment Operations
Get Comments
confluence get-comments 123456
Create a Comment
confluence create-comment 123456 "This is my comment text"
Attachment Operations
List Attachments
confluence get-attachments 123456
Content Hierarchy
Get Children
# Get immediate children of a page
confluence get-children 123456
Get Descendants
# Get all descendants at any level
confluence get-descendants 123456
User & Group Operations
Get Current User
confluence get-current-user
Get User Information
confluence get-user john.doe
List Groups
confluence list-groups
Get Group Information
confluence get-group developers
Version History
Get Content History
confluence get-history 123456
List All Versions
confluence list-versions 123456
System Information
confluence system-info
Content Format Conversion
Convert Wiki Markup to Storage Format
confluence convert my-page.cmd
Generic Format Converter
# Convert from wiki to storage format
confluence converter input.txt wiki storage
# Available formats: wiki, storage, view, editor, exported_view, styled_view
Markdown to Confluence
confluence md2c my-document.md
API Reference
Content API
create- Create new contentupdate/update-batch- Update existing contentget- Get content by IDbody- Get content bodysearch- Search content using CQLremove-doc- Delete contentget-children- Get child pagesget-descendants- Get all descendant pagesget-history- Get content historylist-versions- List all content versions
Space API
list-spaces- List all spacesget-space- Get space informationcreate-space- Create a new spaceupdate-space- Update a spacedelete-space- Delete a space- Space properties:
get-space-properties,get-space-property,create-space-property,update-space-property,delete-space-property - Space settings:
get-space-settings,update-space-settings
Label API
get-labels- Get labels for contentadd-labels- Add labels to contentremove-label- Remove a label from content
Attachment API
get-attachments- List attachments for contentget-attachment- Get specific attachment
Comment API
get-comments- Get comments for contentcreate-comment- Create a comment
Content Properties API
get-content-properties- List content propertiesget-content-property- Get specific propertycreate-content-property- Create propertyupdate-content-property- Update propertydelete-content-property- Delete property
Restrictions API
get-content-restrictions- Get all restrictionsget-restrictions-by-operation- Get restrictions for specific operation
User API
get-current-user- Get current user informationget-user- Get user by username/key/account IDget-user-groups- Get groups for a user
Group API
list-groups- List all groupsget-group- Get group informationget-group-members- Get group members
Search API
search- Text or CQL searchsearch-by-cql- Advanced CQL searchgeneral-search- General search across all types
Template API
get-content-templates- Get content templatesget-blueprint-templates- Get blueprint templatesget-template- Get specific template
System API
system-info- Get system information
Audit API
get-audit-records- Get audit log records
Programmatic API
All CLI commands are available as Gerbil functions. Import the client module:
(import :ober/confluence/client)
;; List spaces
(list-spaces)
;; Get a space
(get-space "MYSPACE")
;; Create content
(create "my-page.cml")
;; Search with CQL
(search "type=page AND label=documentation")
;; Get labels
(get-labels "123456")
;; Add labels
(add-labels "123456" '("important" "reviewed"))
Available Functions
Space Functions
(list-spaces #!key (limit 25) (start 0) (expand []))(get-space space-key #!key (expand []))(create-space key name description #!key (private #f))(update-space space-key name description #!key (homepage-id #f))(delete-space space-key)(get-space-content space-key #!key (type "page") (limit 25) (start 0) (expand []))(get-space-properties space-key #!key (limit 10) (start 0) (expand []))(get-space-property space-key key)(create-space-property space-key key value)(update-space-property space-key key value)(delete-space-property space-key key)(get-space-settings space-key)(update-space-settings space-key settings)
Content Functions
(get id)(get-more id)(create content-file)(update id content-file)(update-batch version id title content-file)(remove-doc id)(search query)(body id)
Content Hierarchy Functions
(get-content-children id #!key (type "page") (limit 25) (start 0) (expand []))(get-content-descendants id #!key (type "page") (limit 25) (start 0) (expand []))
Label Functions
(get-labels id #!key (limit 200) (start 0))(add-labels id labels)- labels is a list of label names(remove-label id label)
Attachment Functions
(get-attachments id #!key (limit 50) (start 0) (expand []))(get-attachment id attachment-id #!key (expand []))
Comment Functions
(get-comments id #!key (limit 25) (start 0) (expand []))(create-comment parent-id comment-text)
Property Functions
(get-content-properties id #!key (limit 10) (start 0) (expand []))(get-content-property id key)(create-content-property id key value)(update-content-property id key value)(delete-content-property id key)
User Functions
(get-current-user #!key (expand []))(get-user #!key (username #f) (key #f) (account-id #f) (expand []))(get-user-groups #!key (username #f) (key #f) (account-id #f) (limit 200) (start 0))
Group Functions
(list-groups #!key (limit 200) (start 0))(get-group group-name #!key (expand []))(get-group-members group-name #!key (limit 200) (start 0) (expand []))
Restriction Functions
(get-content-restrictions id #!key (expand []))(get-restrictions-by-operation id operation #!key (expand []))
Version/History Functions
(get-content-history id #!key (expand []))(get-content-version id version-number #!key (expand []))(list-content-versions id #!key (limit 200) (start 0))
Audit Functions
(get-audit-records #!key (start-date #f) (end-date #f) (search-string #f) (limit 1000) (start 0))
System Functions
(get-system-info)
Template Functions
(get-content-templates #!key (space-key #f) (limit 25) (start 0) (expand []))(get-blueprint-templates #!key (space-key #f) (limit 25) (start 0) (expand []))(get-template template-id)
Search Functions
(search query)- Simple text search or CQL search(search-by-cql cql #!key (cql-context #f) (limit 25) (start 0) (expand []))(general-search query #!key (limit 20))
Content Listing Functions
(list-content #!key (type "page") (space-key #f) (title #f) (status "current") (posting-day #f) (limit 25) (start 0) (expand []) (order-by #f))
Format Conversion Functions
(convert markdown-file)(converter in-file in-format out-format)(md2c markdown-file)
API Version
This client uses Confluence Cloud REST API v1. The API version is documented in the OpenAPI specification at docs/swagger.v3.json.
Expand Parameters
Many API endpoints support an expand parameter to include additional data in responses. Common expand values include:
space- Include space informationversion- Include version informationhistory- Include history informationancestors- Include ancestor pagesbody.storage- Include content body in storage formatbody.view- Include content body in view formatchildren.page- Include child pageschildren.comment- Include commentschildren.attachment- Include attachmentsmetadata.labels- Include labelsmetadata.properties- Include content propertiesrestrictions.read.restrictions.user- Include read restrictionsrestrictions.update.restrictions.user- Include update restrictions
Example:
(get-space "MYSPACE" expand: '("description.view" "homepage"))
Development
Project Structure
.
├── confluence/
│ ├── client.ss # API client implementation
│ └── confluence.ss # CLI interface
├── docs/
│ ├── swagger.v3.json # OpenAPI specification
│ └── Swagger.org # API documentation
├── Makefile # Build configuration
├── gerbil.pkg # Package configuration
└── README.md # This file
Building
# Install dependencies
make deps
# Build the project
make build
# Clean build artifacts
make clean
Testing
Currently, there are no automated tests. Manual testing can be done using the CLI commands against a Confluence instance.
Contributing
Contributions are welcome! Please ensure:
- Code follows existing style conventions
- New API endpoints match the Confluence REST API specification
- CLI commands are added for new functionality
- Documentation is updated
License
© ober 2021-2024