← 返回
沟通协作 Key

Snowsand Confluence

Interact with Confluence Cloud via REST API. Use for space management, page operations (list, view, create, update, delete), content search (CQL queries), pa...
通过 REST API 管理 Confluence Cloud,支持空间与页面操作(增删改查)及 CQL 内容搜索。
snowsand-enterprises
沟通协作 clawhub v1.0.0 1 版本 99825.2 Key: 需要
★ 0
Stars
📥 571
下载
💾 5
安装
1
版本
#latest

概述

Confluence Cloud Integration

Confluence Cloud REST API v2 integration for wiki/documentation management, including spaces, pages, attachments, comments, and labels.

Authentication

Confluence Cloud uses API token authentication. Required environment variables:

  • CONFLUENCE_BASE_URL - Your Confluence instance (e.g., https://yourcompany.atlassian.net)
  • CONFLUENCE_USER_EMAIL - Atlassian account email
  • CONFLUENCE_API_TOKEN - API token from https://id.atlassian.com/manage-profile/security/api-tokens

Test connection:

curl -s -u "$CONFLUENCE_USER_EMAIL:$CONFLUENCE_API_TOKEN" "$CONFLUENCE_BASE_URL/wiki/api/v2/spaces?limit=1" | jq .

Quick Reference

All operations use the scripts/confluence.py script:

OperationCommand
--------------------
Spaces
List spacesconfluence.py spaces
Get space by IDconfluence.py space SPACE_ID
Get space by keyconfluence.py space-by-key PROJ
Create spaceconfluence.py create-space --name "My Space" --key MYSP
Pages
List pagesconfluence.py pages --space-id SPACE_ID
Get pageconfluence.py page PAGE_ID
Create pageconfluence.py create-page --space-id ID --title "Title" --body "

Content

"
Update pageconfluence.py update-page PAGE_ID --body "

New content

"
Delete pageconfluence.py delete-page PAGE_ID
Page Tree
Get childrenconfluence.py children PAGE_ID
Get ancestorsconfluence.py ancestors PAGE_ID
Search
CQL searchconfluence.py search "type=page AND space=PROJ"
Attachments
List attachmentsconfluence.py attachments PAGE_ID
Get attachmentconfluence.py attachment ATT_ID
Upload fileconfluence.py upload PAGE_ID /path/to/file.pdf
Downloadconfluence.py download ATT_ID -o output.pdf
Delete attachmentconfluence.py delete-attachment ATT_ID
Comments
List commentsconfluence.py comments PAGE_ID
Get commentconfluence.py comment COMMENT_ID
Create commentconfluence.py create-comment PAGE_ID "Comment text"
Update commentconfluence.py update-comment COMMENT_ID "New text"
Delete commentconfluence.py delete-comment COMMENT_ID
Labels
Get labelsconfluence.py labels PAGE_ID
Add labelsconfluence.py add-labels PAGE_ID "label1,label2"
Remove labelconfluence.py remove-label PAGE_ID labelname
User
Current userconfluence.py me

Common Workflows

Space Management

# List all spaces
confluence.py spaces

# List global spaces only
confluence.py spaces --type global

# Get space by key
confluence.py space-by-key PROJ

# Create a new space
confluence.py create-space --name "Project Documentation" --key DOCS --description "Team docs"

# Create a private space
confluence.py create-space --name "Private Notes" --key PRIV --private

Page Operations

# List pages in a space (need space ID, not key)
# First get the space ID:
confluence.py space-by-key PROJ
# Then list pages:
confluence.py pages --space-id 12345678

# Filter pages by title
confluence.py pages --title "Meeting Notes"

# Get page with body content
confluence.py page 98765432 --body-format storage

# Get page with labels
confluence.py page 98765432 --include-labels

# Get specific version
confluence.py page 98765432 --version 5

Creating Pages

Pages use Confluence Storage Format (XHTML-based):

# Simple page
confluence.py create-page --space-id 12345678 --title "New Page" \
  --body "<p>Hello World</p>"

# Page with formatting
confluence.py create-page --space-id 12345678 --title "Formatted Page" \
  --body "<h1>Heading</h1><p>Paragraph with <strong>bold</strong> text.</p><ul><li>Item 1</li><li>Item 2</li></ul>"

# Child page (under a parent)
confluence.py create-page --space-id 12345678 --title "Child Page" \
  --parent-id 98765432 --body "<p>This is a child page</p>"

# Draft page
confluence.py create-page --space-id 12345678 --title "Draft" \
  --status draft --body "<p>Work in progress</p>"

Updating Pages

# Update page content
confluence.py update-page 98765432 --body "<p>Updated content</p>"

# Update with new title
confluence.py update-page 98765432 --title "New Title" --body "<p>Content</p>"

# Update with version message
confluence.py update-page 98765432 --body "<p>Fixed typo</p>" \
  --message "Corrected spelling errors"

Deleting Pages

# Move to trash (recoverable)
confluence.py delete-page 98765432

# Permanently delete (purge)
confluence.py delete-page 98765432 --purge

Page Tree Navigation

# Get child pages
confluence.py children 98765432

# Get parent chain (ancestors)
confluence.py ancestors 98765432

Content Search (CQL)

Confluence Query Language (CQL) supports powerful filtering:

# Search by type
confluence.py search "type=page"

# Search in specific space
confluence.py search "type=page AND space=PROJ"

# Full-text search
confluence.py search "text ~ 'meeting notes'"

# Recently modified
confluence.py search "type=page AND lastModified > now('-7d')"

# By label
confluence.py search "type=page AND label=important"

# By creator
confluence.py search "type=page AND creator=currentUser()"

# Combined query
confluence.py search "type=page AND space=PROJ AND text ~ 'api' AND lastModified > now('-30d')"

Attachments

# List attachments on a page
confluence.py attachments 98765432

# Filter by filename
confluence.py attachments 98765432 --filename "report.pdf"

# Filter by media type
confluence.py attachments 98765432 --media-type "image/png"

# Upload a file
confluence.py upload 98765432 /path/to/document.pdf

# Upload with comment
confluence.py upload 98765432 /path/to/file.pdf --comment "Q3 report"

# Download attachment
confluence.py download att123456 -o downloaded_file.pdf

# Delete attachment (move to trash)
confluence.py delete-attachment att123456

# Permanently delete
confluence.py delete-attachment att123456 --purge

Comments

# List comments on a page
confluence.py comments 98765432

# Get comment with body
confluence.py comment comm123456 --body-format storage

# Add a comment
confluence.py create-comment 98765432 "<p>Great work!</p>"

# Update a comment
confluence.py update-comment comm123456 "<p>Updated comment</p>"

# Delete a comment
confluence.py delete-comment comm123456

Labels

# Get labels for a page
confluence.py labels 98765432

# Add labels
confluence.py add-labels 98765432 "documentation,api,important"

# Remove a label
confluence.py remove-label 98765432 "draft"

Storage Format Reference

Confluence uses Storage Format (XHTML-based) for page content. See references/storage-format.md for details.

Common Elements

<!-- Headings -->
<h1>Heading 1</h1>
<h2>Heading 2</h2>

<!-- Paragraphs -->
<p>Regular paragraph</p>
<p><strong>Bold</strong> and <em>italic</em> text</p>

<!-- Lists -->
<ul>
  <li>Unordered item</li>
</ul>
<ol>
  <li>Ordered item</li>
</ol>

<!-- Links -->
<a href="https://example.com">External link</a>
<ac:link><ri:page ri:content-title="Other Page" /></ac:link>

<!-- Code block -->
<ac:structured-macro ac:name="code">
  <ac:parameter ac:name="language">python</ac:parameter>
  <ac:plain-text-body><![CDATA[print("Hello")]]></ac:plain-text-body>
</ac:structured-macro>

<!-- Info panel -->
<ac:structured-macro ac:name="info">
  <ac:rich-text-body><p>Info message</p></ac:rich-text-body>
</ac:structured-macro>

<!-- Table -->
<table>
  <tr><th>Header</th></tr>
  <tr><td>Cell</td></tr>
</table>

CQL Reference

See references/cql.md for the full CQL reference.

Common CQL Patterns

QueryDescription
--------------------
type=pageAll pages
type=blogpostAll blog posts
space=KEYContent in space
text ~ "keyword"Full-text search
title ~ "keyword"Title search
label=labelnameHas label
creator=currentUser()Created by me
lastModified > now('-7d')Modified last week

Error Handling

Common errors:

  • 401 Unauthorized: Check CONFLUENCE_USER_EMAIL and CONFLUENCE_API_TOKEN
  • 403 Forbidden: User lacks permission for this operation
  • 404 Not Found: Space, page, or content doesn't exist
  • 400 Bad Request: Invalid parameters or malformed storage format

Raw API Access

For operations not covered by the script:

# V2 API (preferred)
curl -s -u "$CONFLUENCE_USER_EMAIL:$CONFLUENCE_API_TOKEN" \
  "$CONFLUENCE_BASE_URL/wiki/api/v2/pages?limit=5" | jq .

# V1 API (legacy, some features)
curl -s -u "$CONFLUENCE_USER_EMAIL:$CONFLUENCE_API_TOKEN" \
  "$CONFLUENCE_BASE_URL/wiki/rest/api/content?type=page&limit=5" | jq .

# POST with body
curl -s -X POST -u "$CONFLUENCE_USER_EMAIL:$CONFLUENCE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"spaceId":"12345","title":"Test","body":{"representation":"storage","value":"<p>Hello</p>"}}' \
  "$CONFLUENCE_BASE_URL/wiki/api/v2/pages" | jq .

API docs:

  • V2: https://developer.atlassian.com/cloud/confluence/rest/v2/intro/
  • V1: https://developer.atlassian.com/cloud/confluence/rest/v1/intro/

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-20 04:03 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

communication-collaboration

Himalaya

lamelas
{"answer":"通过IMAP/SMTP管理邮件的CLI。可在终端使用 `himalaya` 收发、回复、转发、搜索及整理邮件。支持多账户与MML(MIME元语言)编写邮件。"}
★ 68 📥 45,587
communication-collaboration

imap-smtp-email

gzlicanyi
使用IMAP/SMTP读取和发送邮件;检查新/未读邮件、获取内容、搜索邮箱、标记已读/未读、发送带附件的邮件。支持...
★ 114 📥 52,421
developer-tools

Snowsand Bitbucket

snowsand-enterprises
通过 REST API 与 Bitbucket Cloud 交互,支持仓库管理、拉取请求操作(列表、查看、创建、评论、批准、合并)及分支管理。
★ 0 📥 542