File size: 9,940 Bytes
56d74b6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | Confluence module
=================
Get page info
-------------
.. code-block:: python
# Check page exists
confluence.page_exists(space, title)
# Provide content by type (page, blog, comment)
confluence.get_page_child_by_type(page_id, type='page', start=None, limit=None)
# Provide content id from search result by title and space
confluence.get_page_id(space, title)
# Provide space key from content id
confluence.get_page_space(page_id)
# Returns the list of labels on a piece of Content
confluence.get_page_by_title(space, title, start=None, limit=None)
# Get page by ID
# Example request URI(s):
# http://example.com/confluence/rest/api/content/1234?expand=space,body.view,version,container
# http://example.com/confluence/rest/api/content/1234?status=any
# page_id: Content ID
# status: (str) list of Content statuses to filter results on. Default value: [current]
# version: (int)
# expand: OPTIONAL: A comma separated list of properties to expand on the content.
# Default value: history,space,version
# We can also specify some extensions such as extensions.inlineProperties
# (for getting inline comment-specific properties) or extensions.resolution
# for the resolution status of each comment in the results
confluence.get_page_by_id(self, page_id, expand=None, status=None, version=None)
# The list of labels on a piece of Content
confluence.get_page_labels(page_id, prefix=None, start=None, limit=None)
# Get draft page by ID
confluence.get_draft_page_by_id(page_id, status='draft')
# Get all page by label
confluence.get_all_pages_by_label(label, start=0, limit=50)
# Get all pages from Space
# content_type can be 'page' or 'blogpost'. Defaults to 'page'
# expand is a comma separated list of properties to expand on the content.
# max limit is 100. For more you have to loop over start values.
confluence.get_all_pages_from_space(space, start=0, limit=100, status=None, expand=None, content_type='page')
# Get list of pages from trash
confluence.get_all_pages_from_space_trash(space, start=0, limit=500, status='trashed', content_type='page')
# Get list of draft pages from space
# Use case is cleanup old drafts from Confluence
confluence.get_all_draft_pages_from_space(space, start=0, limit=500, status='draft')
# Search list of draft pages by space key
# Use case is cleanup old drafts from Confluence
confluence.get_all_draft_pages_from_space_through_cql(space, start=0, limit=500, status='draft')
# Info about all restrictions by operation
confluence.get_all_restrictions_for_content(content_id)
Page actions
------------
.. code-block:: python
# Create page from scratch
confluence.create_page(space, title, body, parent_id=None, type='page', representation='storage', editor='v2')
# This method removes a page, if it has recursive flag, method removes including child pages
confluence.remove_page(page_id, status=None, recursive=False)
# Remove any content
confluence.remove_content(content_id):
# Remove page from trash
confluence.remove_page_from_trash(page_id)
# Remove page as draft
confluence.remove_page_as_draft(page_id)
# Update page if already exist
confluence.update_page(page_id, title, body, parent_id=None, type='page', representation='storage', minor_edit=False)
# Update page or create page if it is not exists
confluence.update_or_create(parent_id, title, body, representation='storage')
# Append body to page if already exist
confluence.append_page(self, page_id, title, append_body, parent_id=None, type='page', representation='storage', minor_edit=False)
# Set the page (content) property e.g. add hash parameters
confluence.set_page_property(page_id, data)
# Delete the page (content) property e.g. delete key of hash
confluence.delete_page_property(page_id, page_property)
# Move page
confluence.move_page(space_key, page_id, target_title, position="append")
# Get the page (content) property e.g. get key of hash
confluence.get_page_property(page_id, page_property_key)
# Get the page (content) properties
confluence.get_page_properties(page_id)
# Get page ancestors
confluence.get_page_ancestors(page_id)
# Attach (upload) a file to a page, if it exists it will update the
# automatically version the new file and keep the old one
confluence.attach_file(filename, name=None, content_type=None, page_id=None, title=None, space=None, comment=None)
# Attach (upload) a content to a page, if it exists it will update the
# automatically version the new file and keep the old one
confluence.attach_content(content, name=None, content_type=None, page_id=None, title=None, space=None, comment=None)
# Remove completely a file if version is None or delete version
confluence.delete_attachment(page_id, filename, version=None)
# Remove completely a file if version is None or delete version
confluence.delete_attachment_by_id(attachment_id, version)
# Keep last versions
confluence.remove_page_attachment_keep_version(page_id, filename, keep_last_versions)
# Get attachment history
confluence.get_attachment_history(attachment_id, limit=200, start=0)
# Get attachment for content
confluence.get_attachments_from_content(page_id, start=0, limit=50, expand=None, filename=None, media_type=None)
# Check has unknown attachment error on page
confluence.has_unknown_attachment_error(page_id)
# Export page as PDF
# api_version needs to be set to 'cloud' when exporting from Confluence Cloud
.
confluence.export_page(page_id)
# Set a label on the page
confluence.set_page_label(page_id, label)
# Delete Confluence page label
confluence.remove_page_label(page_id, label)
# Add comment into page
confluence.add_comment(page_id, text)
Template actions
----------------
.. code-block:: python
# Updating a content template
template_id = "<string>"
name = "<string>"
body = {"value": "<string>", "representation": "view"}
template_type = "page"
description = "<string>"
labels = [{"prefix": "<string>", "name": "<string>", "id": "<string>", "label": "<string>"}]
space = "<key_string>"
confluence.create_or_update_template(name, body, template_type, template_id, description, labels, space)
# Creating a new content template
name = "<string>"
body = {"value": "<string>", "representation": "view"}
template_type = "page"
description = "<string>"
labels = [{"prefix": "<string>", "name": "<string>", "id": "<string>", "label": "<string>"}]
space = "<key_string>"
confluence.create_or_update_template(name, body, template_type, description=description, labels=labels, space=space)
# Get a template by its ID
confluence.get_template_by_id(template_id)
# Get all global content templates
confluence.get_all_templates_from_space()
# Get content templates in a space
confluence.get_all_templates_from_space(space)
# Get all global blueprint templates
confluence.get_all_blueprints_from_space()
# Get all blueprint templates in a space
confluence.get_all_blueprints_from_space(space)
# Removing a template
confluence.remove_template(template_id)
Get spaces info
---------------
.. code-block:: python
# Get all spaces with provided limit
# additional info, e.g. metadata, icon, description, homepage
confluence.get_all_spaces(start=0, limit=500, expand=None)
# Get information about a space through space key
confluence.get_space(space_key, expand='description.plain,homepage')
# Get space content (configuring by the expand property)
confluence.get_space_content(space_key, depth="all", start=0, limit=500, content_type=None, expand="body.storage")
# Get Space permissions set based on json-rpc call
confluence.get_space_permissions(space_key)
Users and Groups
----------------
.. code-block:: python
# Get all groups from Confluence User management
confluence.get_all_groups(start=0, limit=1000)
# Get a paginated collection of users in the given group
confluence.get_group_members(group_name='confluence-users', start=0, limit=1000)
# Get information about a user through username
confluence.get_user_details_by_username(username, expand=None)
# Get information about a user through user key
confluence.get_user_details_by_userkey(userkey, expand=None)
CQL
---
.. code-block:: python
# Get results from cql search result with all related fields
confluence.cql(cql, start=0, limit=None, expand=None, include_archived_spaces=None, excerpt=None)
Other actions
-------------
.. code-block:: python
# Clean all caches from cache management
confluence.clean_all_caches()
# Clean caches from cache management
# e.g.
# com.gliffy.cache.gon
# org.hibernate.cache.internal.StandardQueryCache_v5
confluence.clean_package_cache(cache_name='com.gliffy.cache.gon')
# Convert to Confluence XHTML format from wiki style
confluence.convert_wiki_to_storage(wiki)
# Get page history
confluence.history(page_id)
# Get content history by version number. It works as experimental method
confluence.get_content_history_by_version_number(content_id, version_number)
# Remove content history. It works as experimental method
confluence.remove_content_history(page_id, version_number)
# Compare content and check is already updated or not
confluence.is_page_content_is_already_updated(page_id, body)
# Add inline task setting checkbox method
confluence.set_inline_tasks_checkbox(page_id, task_id, status)
|