Atlassian Confluence Cloud

Atlassian Confluence Cloud allows users to interact with confluence entities like content, space, users, and groups. Users can also manage the space permissions.

Utilities · Atlassian Confluence Cloud

Details

IDAtlassian Confluence Cloud
ProviderAtlassian
CategoryUtilities
From Version6.2.0
Docker Imagedemisto/btfl-soup:1.0.1.10120494
Supported ModulesAgentix XSIAM

README

Atlassian Confluence Cloud allows users to interact with confluence entities like content, space, users and groups. Users can also manage the space permissions.
This integration was integrated and tested with version 1000.0.0-847bdcbfcd00 of Atlassian Confluence Cloud.

Configure Atlassian Confluence Cloud in Cortex

Parameter Description Required
Site Name (e.g., https://${site-name}.atlassian.net) Site name of the Confluence cloud the user wants to connect to. True
Email The Atlassian account email. True
API Token   True
Use system proxy settings   False
Trust any certificate (not secure)   False
Events Fetch Interval   False
Max number of events per fetch   False
Fetch Events   False

Authentication Methods

Basic Authentication (Email + API Token)

  1. Provide your Email address
  2. Provide your API Token (generate from Atlassian API Token management)

OAuth 2.0 Authentication

OAuth 2.0 provides a more secure authentication method using the Atlassian Developer Console.

Required OAuth Scopes (must be configured in the Atlassian Developer Console for your OAuth app):

Scope Description
read:audit-log:confluence Required for event fetching — Read Confluence audit log records
read:confluence-content.all Read all Confluence content
read:confluence-space.summary Read space summaries
read:confluence-user Read user information
read:confluence-groups Read group information
write:confluence-content Write content
write:confluence-space Write space data
offline_access Enables refresh token for unattended access

Note: The read:audit-log:confluence scope is specifically required for the event fetching functionality (fetch-events and confluence-cloud-get-events commands). Without this scope, event collection will fail.

Commands

You can execute these commands from the CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.

confluence-cloud-space-create


Creates a new space.

Note: If no permissions are specified, the default space permissions defined by the Confluence cloud account admin will be used.

Create Space with permissions

  • The command arguments ‘permission_account_id’, ‘permission_group_name’, and ‘permission_operations’ can be used to limit access of the space to one individual or one group.

    For Example: !confluence-cloud-space-create unique_key=”Demo” name=”DemoSpace” permission_account_id=”123af245667” permission_group_name=”administrators” permission_operations=”read:space,write:page”

  • To limit access of the space to a specific number of people or groups, ‘advanced_permissions’ should contain a valid JSON.

    A valid JSON schema can be found here.

Base Command

confluence-cloud-space-create

Input

Argument Name Description Required
unique_key The key for the new space. It can contain any alphanumeric character (a-z, 0-9). The maximum length is 255 characters.

Note: unique_key cannot change after the space is created.
Required
name The name of the new space. The maximum length is 200 characters. Required
description The description of the new space. Optional
is_private_space Whether the user wants to create a private space.

Note: If this option is set to true, permission cannot be applied.

Default is false.
Optional
permission_account_id The account ID of the user to whom permission should be granted.

Note: To retrieve the account ID, execute the confluence-cloud-user-list command.
Optional
permission_group_name The group name to whom permission should be granted.

Note: To retrieve the group name, execute the confluence-cloud-group-list command.
Optional
permission_operations A comma-separated list of the permissions that should be applied.

Note: Requires either permission_account_id or permission_group_name.

Format accepted: operation1:targetType1, operation2:targetType2

For example: read:space, create:page

Possible values for operations: create, read, delete, export, administer.
Possible values for targetType: space, page, blogpost, comment, attachment.
Optional
advanced_permissions Specify ‘advanced_permissions’ to grant access to multiple users or groups. ‘advanced_permissions’ has priority over ‘permission_operations’.

Note: Add backslash(\) before quotes.

For example: [ { "subjects": { "user": { "results": [ { "accountId": "5ff2e30b4d2179006ea18449" } ] }, "group": { "results": [ { "name": "administrators" } ] } }, "operation": { "operation": "read", "targetType": "space" }, "anonymousAccess": false, "unlicensedAccess": false } ]

To prepare a valid JSON for advanced_permissions, navigate to https://developer.atlassian.com/cloud/confluence/rest/api-group-space/#api-wiki-rest-api-space-post and see the permission parameter in it.
Optional

Context Output

Path Type Description
ConfluenceCloud.Space.id Number ID of the space.
ConfluenceCloud.Space.key String Key of the space.
ConfluenceCloud.Space.name String Name of the space.
ConfluenceCloud.Space.description.view.value String The description of the space in view format.
ConfluenceCloud.Space.description.view.representation String Representation format of the description in view format.
ConfluenceCloud.Space.description.plain.value String The description of the space in plain format.
ConfluenceCloud.Space.description.plain.representation String Representation format of the description in plain format.
ConfluenceCloud.Space.homepage.id String ID of the homepage of the space.
ConfluenceCloud.Space.homepage.type String Type of the homepage of the space.
ConfluenceCloud.Space.homepage.status String Status of the homepage of the space.
ConfluenceCloud.Space.homepage.title String Title of the homepage of the space.
ConfluenceCloud.Space.homepage.extensions.position Number The content extension position.
ConfluenceCloud.Space.homepage._links.self String Link to the homepage of the space.
ConfluenceCloud.Space.homepage._links.tinyui String Tiny link to the homepage of the space.
ConfluenceCloud.Space.homepage._links.editui String Edit the user interface link to the homepage of the space.
ConfluenceCloud.Space.homepage._links.webui String Web user interface link to the homepage of the space.
ConfluenceCloud.Space.type String Type of the space.
ConfluenceCloud.Space.permissions.id Number ID of the space permission.
ConfluenceCloud.Space.permissions.subjects.user.results.type String Type of the user to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.results.accountId String Account ID of the user to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.results.accountType String Account type of the user to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.results.email String Email of the user to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.results.publicName String Public name of the user to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.results.profilePicture.path String Path of the user’s profile picture to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.results.profilePicture.width Number Width in pixels of the user’s profile picture to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.results.profilePicture.height Number Height in pixels of the user’s profile picture to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.results.profilePicture.isDefault Boolean Whether the profile picture of the user is default picture to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.results.displayName String Display name of the user to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.results.isExternalCollaborator Boolean Whether the user is an external collaborator user.
ConfluenceCloud.Space.permissions.subjects.user.results._links.self String Link to the user to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.size Number Size of the list of users for a given space.
ConfluenceCloud.Space.permissions.subjects.group.results.type String Type of the group to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.group.results.name String Name of the group to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.group.results.id String ID of the group to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.group.results._links.self String Link to the group to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.group.size Number Size of the list of groups for the given space.
ConfluenceCloud.Space.permissions.operation.operation String Name of the permission operation.
ConfluenceCloud.Space.permissions.operation.targetType String The space or content type that the operation applies to.
ConfluenceCloud.Space.permissions.anonymousAccess Boolean Whether anonymous users have permission to use the operation.
ConfluenceCloud.Space.permissions.unlicensedAccess Boolean Whether unlicensed users have access from JIRA Service Desk when used with the read space operation.
ConfluenceCloud.Space.status String Status of the space.
ConfluenceCloud.Space._links.webui String Web user interface link of the space.
ConfluenceCloud.Space._links.context String Context link of the space.
ConfluenceCloud.Space._links.self String Link to the space.
ConfluenceCloud.Space._links.collection String Collection link of the space.
ConfluenceCloud.Space._links.base String Base link to the space.

Command Example

!confluence-cloud-space-create name="hello_world" unique_key="helloworld111"

Context Example

{
    "ConfluenceCloud": {
        "Space": {
            "_expandable": {
                "lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=helloworld111",
                "settings": "/rest/api/space/helloworld111/settings",
                "theme": "/rest/api/space/helloworld111/theme"
            },
            "_links": {
                "base": "https://xsoar-bd.atlassian.net/wiki",
                "collection": "/rest/api/space",
                "context": "/wiki",
                "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/space/helloworld111",
                "webui": "/spaces/helloworld111"
            },
            "description": {
                "plain": {
                    "representation": "plain"
                }
            },
            "homepage": {
                "_expandable": {
                    "children": "/rest/api/content/16711835/child",
                    "container": "/rest/api/space/helloworld111",
                    "descendants": "/rest/api/content/16711835/descendant",
                    "history": "/rest/api/content/16711835/history",
                    "restrictions": "/rest/api/content/16711835/restriction/byOperation",
                    "space": "/rest/api/space/helloworld111"
                },
                "_links": {
                    "editui": "/pages/resumedraft.action?draftId=16711835",
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/16711835",
                    "tinyui": "/x/mwD-/",
                    "webui": "/spaces/helloworld111/overview"
                },
                "extensions": {
                    "position": 797
                },
                "id": "16711835",
                "status": "current",
                "title": "hello_world Home",
                "type": "page"
            },
            "id": 16711682,
            "key": "helloworld111",
            "name": "hello_world",
            "permissions": [
                {
                    "anonymousAccess": false,
                    "id": 16711685,
                    "operation": {
                        "operation": "create",
                        "targetType": "attachment"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/administrators"
                                    },
                                    "id": "10453df5-f7fc-47be-8ca7-bc2949c1bd5b",
                                    "name": "administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711686,
                    "operation": {
                        "operation": "delete",
                        "targetType": "page"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/confluence-users"
                                    },
                                    "id": "e50e7fe6-7961-4775-9bbf-99e4b50f8701",
                                    "name": "confluence-users",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711687,
                    "operation": {
                        "operation": "restrict_content",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/site-admins"
                                    },
                                    "id": "b7e24fd2-0faa-4eaa-9f87-b764ae157ae7",
                                    "name": "site-admins",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711688,
                    "operation": {
                        "operation": "delete",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/confluence-users"
                                    },
                                    "id": "e50e7fe6-7961-4775-9bbf-99e4b50f8701",
                                    "name": "confluence-users",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711689,
                    "operation": {
                        "operation": "delete",
                        "targetType": "blogpost"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/confluence-users"
                                    },
                                    "id": "e50e7fe6-7961-4775-9bbf-99e4b50f8701",
                                    "name": "confluence-users",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711690,
                    "operation": {
                        "operation": "delete",
                        "targetType": "attachment"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/confluence-users"
                                    },
                                    "id": "e50e7fe6-7961-4775-9bbf-99e4b50f8701",
                                    "name": "confluence-users",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711691,
                    "operation": {
                        "operation": "export",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/system-administrators"
                                    },
                                    "id": "2fda36d1-e4e0-4307-bc5f-ed0044f6ff2c",
                                    "name": "system-administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711693,
                    "operation": {
                        "operation": "restrict_content",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/system-administrators"
                                    },
                                    "id": "2fda36d1-e4e0-4307-bc5f-ed0044f6ff2c",
                                    "name": "system-administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711694,
                    "operation": {
                        "operation": "create",
                        "targetType": "attachment"
                    },
                    "subjects": {
                        "user": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                                    },
                                    "accountId": "5ff2e30b4d2179006ea18449",
                                    "accountType": "atlassian",
                                    "displayName": "John Doe",
                                    "email": "dummy.dummy@dummy.com",
                                    "isExternalCollaborator": false,
                                    "profilePicture": {
                                        "height": 48,
                                        "isDefault": false,
                                        "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                                        "width": 48
                                    },
                                    "publicName": "John Doe",
                                    "type": "known"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711695,
                    "operation": {
                        "operation": "delete",
                        "targetType": "comment"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/confluence-users"
                                    },
                                    "id": "e50e7fe6-7961-4775-9bbf-99e4b50f8701",
                                    "name": "confluence-users",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711696,
                    "operation": {
                        "operation": "create",
                        "targetType": "comment"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/confluence-users"
                                    },
                                    "id": "e50e7fe6-7961-4775-9bbf-99e4b50f8701",
                                    "name": "confluence-users",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711697,
                    "operation": {
                        "operation": "create",
                        "targetType": "page"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/system-administrators"
                                    },
                                    "id": "2fda36d1-e4e0-4307-bc5f-ed0044f6ff2c",
                                    "name": "system-administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711698,
                    "operation": {
                        "operation": "create",
                        "targetType": "blogpost"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/site-admins"
                                    },
                                    "id": "b7e24fd2-0faa-4eaa-9f87-b764ae157ae7",
                                    "name": "site-admins",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711699,
                    "operation": {
                        "operation": "create",
                        "targetType": "blogpost"
                    },
                    "subjects": {
                        "user": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                                    },
                                    "accountId": "5ff2e30b4d2179006ea18449",
                                    "accountType": "atlassian",
                                    "displayName": "John Doe",
                                    "email": "dummy.dummy@dummy.com",
                                    "isExternalCollaborator": false,
                                    "profilePicture": {
                                        "height": 48,
                                        "isDefault": false,
                                        "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                                        "width": 48
                                    },
                                    "publicName": "John Doe",
                                    "type": "known"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711700,
                    "operation": {
                        "operation": "create",
                        "targetType": "page"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/administrators"
                                    },
                                    "id": "10453df5-f7fc-47be-8ca7-bc2949c1bd5b",
                                    "name": "administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711701,
                    "operation": {
                        "operation": "delete",
                        "targetType": "comment"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9"
                                    },
                                    "id": "5178e800-9b33-4b4b-9854-1fdd6776bd42",
                                    "name": "trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711702,
                    "operation": {
                        "operation": "create",
                        "targetType": "comment"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9"
                                    },
                                    "id": "5178e800-9b33-4b4b-9854-1fdd6776bd42",
                                    "name": "trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711704,
                    "operation": {
                        "operation": "read",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/confluence-users"
                                    },
                                    "id": "e50e7fe6-7961-4775-9bbf-99e4b50f8701",
                                    "name": "confluence-users",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711705,
                    "operation": {
                        "operation": "administer",
                        "targetType": "space"
                    },
                    "subjects": {
                        "user": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                                    },
                                    "accountId": "5ff2e30b4d2179006ea18449",
                                    "accountType": "atlassian",
                                    "displayName": "John Doe",
                                    "email": "dummy.dummy@dummy.com",
                                    "isExternalCollaborator": false,
                                    "profilePicture": {
                                        "height": 48,
                                        "isDefault": false,
                                        "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                                        "width": 48
                                    },
                                    "publicName": "John Doe",
                                    "type": "known"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711706,
                    "operation": {
                        "operation": "delete",
                        "targetType": "attachment"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/site-admins"
                                    },
                                    "id": "b7e24fd2-0faa-4eaa-9f87-b764ae157ae7",
                                    "name": "site-admins",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711708,
                    "operation": {
                        "operation": "administer",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9"
                                    },
                                    "id": "5178e800-9b33-4b4b-9854-1fdd6776bd42",
                                    "name": "trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711709,
                    "operation": {
                        "operation": "read",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9"
                                    },
                                    "id": "5178e800-9b33-4b4b-9854-1fdd6776bd42",
                                    "name": "trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711710,
                    "operation": {
                        "operation": "create",
                        "targetType": "attachment"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/site-admins"
                                    },
                                    "id": "b7e24fd2-0faa-4eaa-9f87-b764ae157ae7",
                                    "name": "site-admins",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711711,
                    "operation": {
                        "operation": "restrict_content",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/administrators"
                                    },
                                    "id": "10453df5-f7fc-47be-8ca7-bc2949c1bd5b",
                                    "name": "administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711714,
                    "operation": {
                        "operation": "delete",
                        "targetType": "page"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/system-administrators"
                                    },
                                    "id": "2fda36d1-e4e0-4307-bc5f-ed0044f6ff2c",
                                    "name": "system-administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711715,
                    "operation": {
                        "operation": "read",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/system-administrators"
                                    },
                                    "id": "2fda36d1-e4e0-4307-bc5f-ed0044f6ff2c",
                                    "name": "system-administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711716,
                    "operation": {
                        "operation": "delete",
                        "targetType": "comment"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/system-administrators"
                                    },
                                    "id": "2fda36d1-e4e0-4307-bc5f-ed0044f6ff2c",
                                    "name": "system-administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711717,
                    "operation": {
                        "operation": "delete",
                        "targetType": "blogpost"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/system-administrators"
                                    },
                                    "id": "2fda36d1-e4e0-4307-bc5f-ed0044f6ff2c",
                                    "name": "system-administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711718,
                    "operation": {
                        "operation": "create",
                        "targetType": "blogpost"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/administrators"
                                    },
                                    "id": "10453df5-f7fc-47be-8ca7-bc2949c1bd5b",
                                    "name": "administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711719,
                    "operation": {
                        "operation": "create",
                        "targetType": "comment"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/system-administrators"
                                    },
                                    "id": "2fda36d1-e4e0-4307-bc5f-ed0044f6ff2c",
                                    "name": "system-administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711720,
                    "operation": {
                        "operation": "delete",
                        "targetType": "blogpost"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9"
                                    },
                                    "id": "5178e800-9b33-4b4b-9854-1fdd6776bd42",
                                    "name": "trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711721,
                    "operation": {
                        "operation": "administer",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/administrators"
                                    },
                                    "id": "10453df5-f7fc-47be-8ca7-bc2949c1bd5b",
                                    "name": "administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711722,
                    "operation": {
                        "operation": "delete",
                        "targetType": "page"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9"
                                    },
                                    "id": "5178e800-9b33-4b4b-9854-1fdd6776bd42",
                                    "name": "trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711723,
                    "operation": {
                        "operation": "delete",
                        "targetType": "space"
                    },
                    "subjects": {
                        "user": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                                    },
                                    "accountId": "5ff2e30b4d2179006ea18449",
                                    "accountType": "atlassian",
                                    "displayName": "John Doe",
                                    "email": "dummy.dummy@dummy.com",
                                    "isExternalCollaborator": false,
                                    "profilePicture": {
                                        "height": 48,
                                        "isDefault": false,
                                        "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                                        "width": 48
                                    },
                                    "publicName": "John Doe",
                                    "type": "known"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711725,
                    "operation": {
                        "operation": "delete",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/site-admins"
                                    },
                                    "id": "b7e24fd2-0faa-4eaa-9f87-b764ae157ae7",
                                    "name": "site-admins",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711726,
                    "operation": {
                        "operation": "delete",
                        "targetType": "attachment"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/administrators"
                                    },
                                    "id": "10453df5-f7fc-47be-8ca7-bc2949c1bd5b",
                                    "name": "administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711727,
                    "operation": {
                        "operation": "export",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9"
                                    },
                                    "id": "5178e800-9b33-4b4b-9854-1fdd6776bd42",
                                    "name": "trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711728,
                    "operation": {
                        "operation": "create",
                        "targetType": "page"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9"
                                    },
                                    "id": "5178e800-9b33-4b4b-9854-1fdd6776bd42",
                                    "name": "trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711729,
                    "operation": {
                        "operation": "delete",
                        "targetType": "page"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/administrators"
                                    },
                                    "id": "10453df5-f7fc-47be-8ca7-bc2949c1bd5b",
                                    "name": "administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711730,
                    "operation": {
                        "operation": "create",
                        "targetType": "attachment"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/confluence-users"
                                    },
                                    "id": "e50e7fe6-7961-4775-9bbf-99e4b50f8701",
                                    "name": "confluence-users",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711731,
                    "operation": {
                        "operation": "delete",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/administrators"
                                    },
                                    "id": "10453df5-f7fc-47be-8ca7-bc2949c1bd5b",
                                    "name": "administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711732,
                    "operation": {
                        "operation": "delete",
                        "targetType": "page"
                    },
                    "subjects": {
                        "user": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                                    },
                                    "accountId": "5ff2e30b4d2179006ea18449",
                                    "accountType": "atlassian",
                                    "displayName": "John Doe",
                                    "email": "dummy.dummy@dummy.com",
                                    "isExternalCollaborator": false,
                                    "profilePicture": {
                                        "height": 48,
                                        "isDefault": false,
                                        "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                                        "width": 48
                                    },
                                    "publicName": "John Doe",
                                    "type": "known"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711733,
                    "operation": {
                        "operation": "delete",
                        "targetType": "blogpost"
                    },
                    "subjects": {
                        "user": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                                    },
                                    "accountId": "5ff2e30b4d2179006ea18449",
                                    "accountType": "atlassian",
                                    "displayName": "John Doe",
                                    "email": "dummy.dummy@dummy.com",
                                    "isExternalCollaborator": false,
                                    "profilePicture": {
                                        "height": 48,
                                        "isDefault": false,
                                        "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                                        "width": 48
                                    },
                                    "publicName": "John Doe",
                                    "type": "known"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711735,
                    "operation": {
                        "operation": "administer",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/system-administrators"
                                    },
                                    "id": "2fda36d1-e4e0-4307-bc5f-ed0044f6ff2c",
                                    "name": "system-administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711737,
                    "operation": {
                        "operation": "delete",
                        "targetType": "comment"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/site-admins"
                                    },
                                    "id": "b7e24fd2-0faa-4eaa-9f87-b764ae157ae7",
                                    "name": "site-admins",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711738,
                    "operation": {
                        "operation": "create",
                        "targetType": "blogpost"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/confluence-users"
                                    },
                                    "id": "e50e7fe6-7961-4775-9bbf-99e4b50f8701",
                                    "name": "confluence-users",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711739,
                    "operation": {
                        "operation": "create",
                        "targetType": "comment"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/site-admins"
                                    },
                                    "id": "b7e24fd2-0faa-4eaa-9f87-b764ae157ae7",
                                    "name": "site-admins",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711740,
                    "operation": {
                        "operation": "delete",
                        "targetType": "attachment"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9"
                                    },
                                    "id": "5178e800-9b33-4b4b-9854-1fdd6776bd42",
                                    "name": "trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711741,
                    "operation": {
                        "operation": "administer",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/confluence-users"
                                    },
                                    "id": "e50e7fe6-7961-4775-9bbf-99e4b50f8701",
                                    "name": "confluence-users",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711742,
                    "operation": {
                        "operation": "administer",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/site-admins"
                                    },
                                    "id": "b7e24fd2-0faa-4eaa-9f87-b764ae157ae7",
                                    "name": "site-admins",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711743,
                    "operation": {
                        "operation": "export",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/administrators"
                                    },
                                    "id": "10453df5-f7fc-47be-8ca7-bc2949c1bd5b",
                                    "name": "administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711744,
                    "operation": {
                        "operation": "restrict_content",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9"
                                    },
                                    "id": "5178e800-9b33-4b4b-9854-1fdd6776bd42",
                                    "name": "trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711745,
                    "operation": {
                        "operation": "delete",
                        "targetType": "comment"
                    },
                    "subjects": {
                        "user": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                                    },
                                    "accountId": "5ff2e30b4d2179006ea18449",
                                    "accountType": "atlassian",
                                    "displayName": "John Doe",
                                    "email": "dummy.dummy@dummy.com",
                                    "isExternalCollaborator": false,
                                    "profilePicture": {
                                        "height": 48,
                                        "isDefault": false,
                                        "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                                        "width": 48
                                    },
                                    "publicName": "John Doe",
                                    "type": "known"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711746,
                    "operation": {
                        "operation": "delete",
                        "targetType": "attachment"
                    },
                    "subjects": {
                        "user": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                                    },
                                    "accountId": "5ff2e30b4d2179006ea18449",
                                    "accountType": "atlassian",
                                    "displayName": "John Doe",
                                    "email": "dummy.dummy@dummy.com",
                                    "isExternalCollaborator": false,
                                    "profilePicture": {
                                        "height": 48,
                                        "isDefault": false,
                                        "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                                        "width": 48
                                    },
                                    "publicName": "John Doe",
                                    "type": "known"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711747,
                    "operation": {
                        "operation": "read",
                        "targetType": "space"
                    },
                    "subjects": {
                        "user": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                                    },
                                    "accountId": "5ff2e30b4d2179006ea18449",
                                    "accountType": "atlassian",
                                    "displayName": "John Doe",
                                    "email": "dummy.dummy@dummy.com",
                                    "isExternalCollaborator": false,
                                    "profilePicture": {
                                        "height": 48,
                                        "isDefault": false,
                                        "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                                        "width": 48
                                    },
                                    "publicName": "John Doe",
                                    "type": "known"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711748,
                    "operation": {
                        "operation": "create",
                        "targetType": "blogpost"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9"
                                    },
                                    "id": "5178e800-9b33-4b4b-9854-1fdd6776bd42",
                                    "name": "trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711749,
                    "operation": {
                        "operation": "create",
                        "targetType": "attachment"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/system-administrators"
                                    },
                                    "id": "2fda36d1-e4e0-4307-bc5f-ed0044f6ff2c",
                                    "name": "system-administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711750,
                    "operation": {
                        "operation": "read",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/site-admins"
                                    },
                                    "id": "b7e24fd2-0faa-4eaa-9f87-b764ae157ae7",
                                    "name": "site-admins",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711751,
                    "operation": {
                        "operation": "delete",
                        "targetType": "blogpost"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/administrators"
                                    },
                                    "id": "10453df5-f7fc-47be-8ca7-bc2949c1bd5b",
                                    "name": "administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711752,
                    "operation": {
                        "operation": "create",
                        "targetType": "comment"
                    },
                    "subjects": {
                        "user": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                                    },
                                    "accountId": "5ff2e30b4d2179006ea18449",
                                    "accountType": "atlassian",
                                    "displayName": "John Doe",
                                    "email": "dummy.dummy@dummy.com",
                                    "isExternalCollaborator": false,
                                    "profilePicture": {
                                        "height": 48,
                                        "isDefault": false,
                                        "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                                        "width": 48
                                    },
                                    "publicName": "John Doe",
                                    "type": "known"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711754,
                    "operation": {
                        "operation": "delete",
                        "targetType": "page"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/site-admins"
                                    },
                                    "id": "b7e24fd2-0faa-4eaa-9f87-b764ae157ae7",
                                    "name": "site-admins",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711755,
                    "operation": {
                        "operation": "delete",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/system-administrators"
                                    },
                                    "id": "2fda36d1-e4e0-4307-bc5f-ed0044f6ff2c",
                                    "name": "system-administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711756,
                    "operation": {
                        "operation": "restrict_content",
                        "targetType": "space"
                    },
                    "subjects": {
                        "user": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                                    },
                                    "accountId": "5ff2e30b4d2179006ea18449",
                                    "accountType": "atlassian",
                                    "displayName": "John Doe",
                                    "email": "dummy.dummy@dummy.com",
                                    "isExternalCollaborator": false,
                                    "profilePicture": {
                                        "height": 48,
                                        "isDefault": false,
                                        "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                                        "width": 48
                                    },
                                    "publicName": "John Doe",
                                    "type": "known"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711757,
                    "operation": {
                        "operation": "restrict_content",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/confluence-users"
                                    },
                                    "id": "e50e7fe6-7961-4775-9bbf-99e4b50f8701",
                                    "name": "confluence-users",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711758,
                    "operation": {
                        "operation": "create",
                        "targetType": "blogpost"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/system-administrators"
                                    },
                                    "id": "2fda36d1-e4e0-4307-bc5f-ed0044f6ff2c",
                                    "name": "system-administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711760,
                    "operation": {
                        "operation": "create",
                        "targetType": "attachment"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9"
                                    },
                                    "id": "5178e800-9b33-4b4b-9854-1fdd6776bd42",
                                    "name": "trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711761,
                    "operation": {
                        "operation": "delete",
                        "targetType": "attachment"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/system-administrators"
                                    },
                                    "id": "2fda36d1-e4e0-4307-bc5f-ed0044f6ff2c",
                                    "name": "system-administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711762,
                    "operation": {
                        "operation": "archive",
                        "targetType": "page"
                    },
                    "subjects": {
                        "user": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                                    },
                                    "accountId": "5ff2e30b4d2179006ea18449",
                                    "accountType": "atlassian",
                                    "displayName": "John Doe",
                                    "email": "dummy.dummy@dummy.com",
                                    "isExternalCollaborator": false,
                                    "profilePicture": {
                                        "height": 48,
                                        "isDefault": false,
                                        "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                                        "width": 48
                                    },
                                    "publicName": "John Doe",
                                    "type": "known"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711763,
                    "operation": {
                        "operation": "read",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/administrators"
                                    },
                                    "id": "10453df5-f7fc-47be-8ca7-bc2949c1bd5b",
                                    "name": "administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711764,
                    "operation": {
                        "operation": "export",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/site-admins"
                                    },
                                    "id": "b7e24fd2-0faa-4eaa-9f87-b764ae157ae7",
                                    "name": "site-admins",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711765,
                    "operation": {
                        "operation": "create",
                        "targetType": "comment"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/administrators"
                                    },
                                    "id": "10453df5-f7fc-47be-8ca7-bc2949c1bd5b",
                                    "name": "administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711767,
                    "operation": {
                        "operation": "create",
                        "targetType": "page"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/confluence-users"
                                    },
                                    "id": "e50e7fe6-7961-4775-9bbf-99e4b50f8701",
                                    "name": "confluence-users",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711768,
                    "operation": {
                        "operation": "create",
                        "targetType": "page"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/site-admins"
                                    },
                                    "id": "b7e24fd2-0faa-4eaa-9f87-b764ae157ae7",
                                    "name": "site-admins",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711769,
                    "operation": {
                        "operation": "create",
                        "targetType": "page"
                    },
                    "subjects": {
                        "user": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                                    },
                                    "accountId": "5ff2e30b4d2179006ea18449",
                                    "accountType": "atlassian",
                                    "displayName": "John Doe",
                                    "email": "dummy.dummy@dummy.com",
                                    "isExternalCollaborator": false,
                                    "profilePicture": {
                                        "height": 48,
                                        "isDefault": false,
                                        "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                                        "width": 48
                                    },
                                    "publicName": "John Doe",
                                    "type": "known"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711770,
                    "operation": {
                        "operation": "delete",
                        "targetType": "blogpost"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/site-admins"
                                    },
                                    "id": "b7e24fd2-0faa-4eaa-9f87-b764ae157ae7",
                                    "name": "site-admins",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711771,
                    "operation": {
                        "operation": "export",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/confluence-users"
                                    },
                                    "id": "e50e7fe6-7961-4775-9bbf-99e4b50f8701",
                                    "name": "confluence-users",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711772,
                    "operation": {
                        "operation": "delete",
                        "targetType": "space"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9"
                                    },
                                    "id": "5178e800-9b33-4b4b-9854-1fdd6776bd42",
                                    "name": "trusted-users-9704e596-7b55-4a8b-a77b-f617d67cffd9",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711773,
                    "operation": {
                        "operation": "export",
                        "targetType": "space"
                    },
                    "subjects": {
                        "user": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                                    },
                                    "accountId": "5ff2e30b4d2179006ea18449",
                                    "accountType": "atlassian",
                                    "displayName": "John Doe",
                                    "email": "dummy.dummy@dummy.com",
                                    "isExternalCollaborator": false,
                                    "profilePicture": {
                                        "height": 48,
                                        "isDefault": false,
                                        "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                                        "width": 48
                                    },
                                    "publicName": "John Doe",
                                    "type": "known"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                },
                {
                    "anonymousAccess": false,
                    "id": 16711774,
                    "operation": {
                        "operation": "delete",
                        "targetType": "comment"
                    },
                    "subjects": {
                        "group": {
                            "results": [
                                {
                                    "_links": {
                                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/administrators"
                                    },
                                    "id": "10453df5-f7fc-47be-8ca7-bc2949c1bd5b",
                                    "name": "administrators",
                                    "type": "group"
                                }
                            ],
                            "size": 1
                        }
                    },
                    "unlicensedAccess": false
                }
            ],
            "status": "current",
            "type": "global"
        }
    }
}

Human Readable Output

Space

ID Name Type Status
16711682 hello_world global current

confluence-cloud-content-create


Creates a page or blogpost for a given space.

Note: To view the expansion of content properties, execute confluence-cloud-content-list and confluence-cloud-content-search commands.

Base Command

confluence-cloud-content-create

Input

Argument Name Description Required
title The title of the content.

Note: The maximum title length is 255 characters.
Required
type The type of the new content.
Possible values: page, blogpost.
Required
space_key The space key that the content is being created in. Required
status The status of the new content.
Possible values: current, trashed, draft.

Note: The term ‘current’ refers to the content that is currently active.

Default is current.
Optional
body_value The body of the new content.

Note: ‘body_value’ must be a string. In order to reflect ‘body_value’, ‘body_representation’ is required.
Optional
body_representation The content format type.
Possible values: view, export_view, styled_view, storage, editor2, anonymous_export_view.
Optional
ancestor_id The ID of the parent content to create the child content.

Note: Supported for content type page only. To retrieve the ancestor_id, execute the confluence-cloud-content-search command using the query=”type=page” argument.
Optional

Context Output

Path Type Description
ConfluenceCloud.Content.id String The ID of the content.
ConfluenceCloud.Content.type String Type of the content.
ConfluenceCloud.Content.status String Status of the content.
ConfluenceCloud.Content.title String Title of the content.
ConfluenceCloud.Content.childTypes.attachment.value Boolean Whether the attachment has the given content.
ConfluenceCloud.Content.childTypes.attachment._links.self String Link to the attachment with the given content.
ConfluenceCloud.Content.childTypes.comment.value Boolean Whether a comment is associated with the given content.
ConfluenceCloud.Content.childTypes.comment._links.self String Link to the comment associated with the given content.
ConfluenceCloud.Content.childTypes.page.value Boolean Whether the page is associated with the given content.
ConfluenceCloud.Content.childTypes.page._links.self String Link to the page associated with given content.
ConfluenceCloud.Content.space.id Number ID of the space that the content is being created in.
ConfluenceCloud.Content.space.key String Key of the space that the content is being created in.
ConfluenceCloud.Content.space.name String Name of the space that the content is being created in.
ConfluenceCloud.Content.space.type String Type of the space that the content is being created in.
ConfluenceCloud.Content.space.status String Status of the space that the content is being created in.
ConfluenceCloud.Content.space._links.webui String Web user interface link to the space that the content is being created in.
ConfluenceCloud.Content.space._links.self String Link to the space that the content is being created in.
ConfluenceCloud.Content.history.latest Boolean Whether the content is the latest content.
ConfluenceCloud.Content.history.createdBy.type String Type of the user who created the content.
ConfluenceCloud.Content.history.createdBy.accountId String Account ID of the user creating the content.
ConfluenceCloud.Content.history.createdBy.accountType String Account type of the user creating the content.
ConfluenceCloud.Content.history.createdBy.email String Email of the user creating the content.
ConfluenceCloud.Content.history.createdBy.publicName String Public name of the user creating the content.
ConfluenceCloud.Content.history.createdBy.profilePicture.path String Profile picture path of the user creating the content.
ConfluenceCloud.Content.history.createdBy.profilePicture.width Number Width in pixels of the profile picture of the user.
ConfluenceCloud.Content.history.createdBy.profilePicture.height Number Height in pixels of the profile picture of the user.
ConfluenceCloud.Content.history.createdBy.profilePicture.isDefault Boolean Whether the profile picture is the default profile picture.
ConfluenceCloud.Content.history.createdBy.displayName String Display name of the user who created the content.
ConfluenceCloud.Content.history.createdBy.isExternalCollaborator Boolean Whether the user is an external collaborator.
ConfluenceCloud.Content.history.createdBy._links.self String Link to the creator of the content.
ConfluenceCloud.Content.history.createdDate Date Date and time, in ISO 8601 format, when the content was created.
ConfluenceCloud.Content.history._links.self String Link to the history of the content
ConfluenceCloud.Content.version.by.type String Type of the user who last updated the content.
ConfluenceCloud.Content.version.by.accountId String Account ID of the user who last updated the content.
ConfluenceCloud.Content.version.by.accountType String Account type of the user who last updated the content.
ConfluenceCloud.Content.version.by.email String Email of the user who last updated the content.
ConfluenceCloud.Content.version.by.publicName String Public name of the user who last updated the content.
ConfluenceCloud.Content.version.by.profilePicture.path String Profile picture of the user who last updated the content.
ConfluenceCloud.Content.version.by.profilePicture.width Number Width in pixels of the profile picture of the user who last updated the content.
ConfluenceCloud.Content.version.by.profilePicture.height Number Height in pixels of the profile picture of the user who last updated the content.
ConfluenceCloud.Content.version.by.profilePicture.isDefault Boolean Whether the profile picture is the default profile picture.
ConfluenceCloud.Content.version.by.displayName String Display name of the user who last updated the content.
ConfluenceCloud.Content.version.by.isExternalCollaborator Boolean Whether the user is an external collaborator.
ConfluenceCloud.Content.version.by._links.self String Link to the user who last updated the content.
ConfluenceCloud.Content.version.when Date Date and time, in ISO 8601 format, when the content was updated.
ConfluenceCloud.Content.version.friendlyWhen String Displays when the content was created.
ConfluenceCloud.Content.version.message String Message of the updated content.
ConfluenceCloud.Content.version.number Number Version number of the updated content.
ConfluenceCloud.Content.version.minorEdit Boolean Whether the edit was minor.
ConfluenceCloud.Content.version.confRev String The revision ID provided by Confluence to be used as a revision in Synchrony.
ConfluenceCloud.Content.version.contentTypeModified Boolean True if the content type is modified in the version. (e.g., page to blog)
ConfluenceCloud.Content.version._links.self String Link to the new version of the content.
ConfluenceCloud.Content.ancestors.id String ID of the parent page of the content.
ConfluenceCloud.Content.ancestors.type String Type of the parent page of the content.
ConfluenceCloud.Content.ancestors.status String Status of the parent page of the content.
ConfluenceCloud.Content.ancestors.title String Title of the parent page of the content.
ConfluenceCloud.Content.ancestors.extensions.position Number The content extension position.
ConfluenceCloud.Content.ancestors._links.self String Link to the parent page of the content.
ConfluenceCloud.Content.ancestors._links.tinyui String Tiny link to the parent page of the content.
ConfluenceCloud.Content.ancestors._links.editui String Edit user interface link to the parent page of the content.
ConfluenceCloud.Content.ancestors._links.webui String Web user interface link to the parent page of the content.
ConfluenceCloud.Content.container.id Number ID of the container of the content.
ConfluenceCloud.Content.container.key String Key of the container of the content.
ConfluenceCloud.Content.container.name String Name of the container of the content.
ConfluenceCloud.Content.container.type String Type of the container of the content.
ConfluenceCloud.Content.container.status String Status of the container of the content.
ConfluenceCloud.Content.container._links.webui String Web user interface link to the container of the content.
ConfluenceCloud.Content.container._links.self String Link to the container of the content.
ConfluenceCloud.Content.body.storage.value String The body of the new content.
ConfluenceCloud.Content.body.storage.representation String Representation format of the content.
ConfluenceCloud.Content.extensions.position Number The content extension position.
ConfluenceCloud.Content._links.editui String Edit user interface link of the content.
ConfluenceCloud.Content._links.webui String Web user interface link of the content.
ConfluenceCloud.Content._links.context String Context link of the content.
ConfluenceCloud.Content._links.self String Link to the content.
ConfluenceCloud.Content._links.tinyui String Tiny link of the content.
ConfluenceCloud.Content._links.collection String Collection link of the content.
ConfluenceCloud.Content._links.base String Base link to the content.

Command Example

!confluence-cloud-content-create title="XSOAR_Page_234567" type=page space_key="XSOAR"

Context Example

{
    "ConfluenceCloud": {
        "Content": {
            "_expandable": {
                "children": "/rest/api/content/16711862/child",
                "descendants": "/rest/api/content/16711862/descendant",
                "restrictions": "/rest/api/content/16711862/restriction/byOperation"
            },
            "_links": {
                "base": "https://xsoar-bd.atlassian.net/wiki",
                "collection": "/rest/api/content",
                "context": "/wiki",
                "editui": "/pages/resumedraft.action?draftId=16711862",
                "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/16711862",
                "tinyui": "/x/tgD-/",
                "webui": "/spaces/XSOAR/pages/16711862/XSOAR_Page_234567"
            },
            "body": {
                "storage": {
                    "_expandable": {
                        "content": "/rest/api/content/16711862"
                    },
                    "representation": "storage"
                }
            },
            "container": {
                "_expandable": {
                    "lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=XSOAR",
                    "settings": "/rest/api/space/XSOAR/settings",
                    "theme": "/rest/api/space/XSOAR/theme"
                },
                "_links": {
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/space/XSOAR",
                    "webui": "/spaces/XSOAR"
                },
                "history": {
                    "createdBy": {
                        "_links": {
                            "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                        },
                        "accountId": "5ff2e30b4d2179006ea18449",
                        "accountType": "atlassian",
                        "displayName": "John Doe",
                        "email": "dummy.dummy@dummy.com",
                        "isExternalCollaborator": false,
                        "profilePicture": {
                            "height": 48,
                            "isDefault": false,
                            "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                            "width": 48
                        },
                        "publicName": "John Doe",
                        "type": "known"
                    },
                    "createdDate": "2021-08-06T06:18:11.470Z"
                },
                "id": 2064386,
                "key": "XSOAR",
                "name": "XSOAR_Project",
                "status": "current",
                "type": "global"
            },
            "extensions": {
                "position": 618
            },
            "history": {
                "_links": {
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/16711862/history"
                },
                "createdBy": {
                    "_links": {
                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                    },
                    "accountId": "5ff2e30b4d2179006ea18449",
                    "accountType": "atlassian",
                    "displayName": "John Doe",
                    "email": "dummy.dummy@dummy.com",
                    "isExternalCollaborator": false,
                    "profilePicture": {
                        "height": 48,
                        "isDefault": false,
                        "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                        "width": 48
                    },
                    "publicName": "John Doe",
                    "type": "known"
                },
                "createdDate": "2021-09-02T06:36:33.937Z",
                "latest": true
            },
            "id": "16711862",
            "space": {
                "_expandable": {
                    "lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=XSOAR",
                    "settings": "/rest/api/space/XSOAR/settings",
                    "theme": "/rest/api/space/XSOAR/theme"
                },
                "_links": {
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/space/XSOAR",
                    "webui": "/spaces/XSOAR"
                },
                "id": 2064386,
                "key": "XSOAR",
                "name": "XSOAR_Project",
                "status": "current",
                "type": "global"
            },
            "status": "current",
            "title": "XSOAR_Page_234567",
            "type": "page",
            "version": {
                "_expandable": {
                    "content": "/rest/api/content/16711862"
                },
                "_links": {
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/16711862/version/1"
                },
                "by": {
                    "_links": {
                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                    },
                    "accountId": "5ff2e30b4d2179006ea18449",
                    "accountType": "atlassian",
                    "displayName": "John Doe",
                    "email": "dummy.dummy@dummy.com",
                    "isExternalCollaborator": false,
                    "profilePicture": {
                        "height": 48,
                        "isDefault": false,
                        "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                        "width": 48
                    },
                    "publicName": "John Doe",
                    "type": "known"
                },
                "confRev": "confluence$content$16711862.2",
                "contentTypeModified": false,
                "friendlyWhen": "just a moment ago",
                "minorEdit": false,
                "number": 1,
                "when": "2021-09-02T06:36:33.937Z"
            }
        }
    }
}

Human Readable Output

Content

ID Title Type Status Space Name Created By Created At
16711862 XSOAR_Page_234567 page current XSOAR_Project John Doe 2021-09-02T06:36:33.937Z

confluence-cloud-comment-create


Creates a comment for the given content.

Note: To view the expansion of content properties, execute the confluence-cloud-content-list and confluence-cloud-content-search commands.

Base Command

confluence-cloud-comment-create

Input

Argument Name Description Required
status The status of the new content.
Possible values: current, trashed, draft.

Note: The term ‘current’ refers to the comment that is currently active.

Default is current.
Optional
body_value The body of the new content.

Note: ‘body_value’ must be a string.
Required
body_representation The content format type.
Possible values: storage, editor2, editor.
Required
ancestor_id The ID of the parent comment for which to create the child comment.

Note: To retrieve the ancestor_id, execute the confluence-cloud-content-search command using the query=”type=comment” argument.
Optional
container_id The ID of the container for which to create a comment.

Note: To retrieve the container_id, execute the confluence-cloud-content-list command.
Required
container_type The type of the container.
Possible values: page, blogpost.
Optional

Context Output

Path Type Description
ConfluenceCloud.Comment.id String The ID of the comment.
ConfluenceCloud.Comment.type String Type of the comment.
ConfluenceCloud.Comment.status String Status of the comment.
ConfluenceCloud.Comment.title String Title of the comment.
ConfluenceCloud.Comment.childTypes.attachment.value Boolean Whether the attachment has the given comment.
ConfluenceCloud.Comment.childTypes.attachment._links.self String Link to the attachment with the given comment.
ConfluenceCloud.Comment.childTypes.comment.value Boolean Whether a comment is associated with the given comment.
ConfluenceCloud.Comment.childTypes.comment._links.self String Link to the comment associated with the given comment.
ConfluenceCloud.Comment.childTypes.page.value Boolean Whether the page is associated with the given comment.
ConfluenceCloud.Comment.childTypes.page._links.self String Link to the page associated with the given comment.
ConfluenceCloud.Comment.space.id Number ID of the space that the comment is being created in.
ConfluenceCloud.Comment.space.key String Key of the space that the comment is being created in.
ConfluenceCloud.Comment.space.name String Name of the space that the comment is being created in.
ConfluenceCloud.Comment.space.type String Type of the space that the comment is being created in.
ConfluenceCloud.Comment.space.status String Status of the space that the comment is being created in.
ConfluenceCloud.Comment.space._links.webui String Web user interface link to the space that the comment is being created in.
ConfluenceCloud.Comment.space._links.self String Link to the space that the comment is being created in.
ConfluenceCloud.Comment.history.latest Boolean Whether the comment is the latest comment.
ConfluenceCloud.Comment.history.createdBy.type String Type of the user who created the comment.
ConfluenceCloud.Comment.history.createdBy.accountId String Account ID of the user creating the comment.
ConfluenceCloud.Comment.history.createdBy.accountType String Account type of the user creating the comment.
ConfluenceCloud.Comment.history.createdBy.email String Email of the user creating the comment.
ConfluenceCloud.Comment.history.createdBy.publicName String Public name of the user creating the comment.
ConfluenceCloud.Comment.history.createdBy.profilePicture.path String Profile picture path of the user creating the comment.
ConfluenceCloud.Comment.history.createdBy.profilePicture.width Number Width in pixels of the profile picture of the user.
ConfluenceCloud.Comment.history.createdBy.profilePicture.height Number Height in pixels of the profile picture of the user.
ConfluenceCloud.Comment.history.createdBy.profilePicture.isDefault Boolean Whether the profile picture is default.
ConfluenceCloud.Comment.history.createdBy.displayName String Display name of the user who created the comment.
ConfluenceCloud.Comment.history.createdBy.isExternalCollaborator Boolean Whether the user is an external collaborator.
ConfluenceCloud.Comment.history.createdBy._links.self String Link to the creator of the comment.
ConfluenceCloud.Comment.history.createdDate Date Date and time, in ISO 8601 format, when the comment was created.
ConfluenceCloud.Comment.history._links.self String Link to the history of the comment.
ConfluenceCloud.Comment.version.by.type String Type of the user who last updated the comment.
ConfluenceCloud.Comment.version.by.accountId String Account ID of the user who last updated the comment.
ConfluenceCloud.Comment.version.by.accountType String Account type of the user who last updated the comment.
ConfluenceCloud.Comment.version.by.email String Email of the user who last updated the comment.
ConfluenceCloud.Comment.version.by.publicName String Public name of the user who last updated the comment.
ConfluenceCloud.Comment.version.by.profilePicture.path String Profile picture of the user who last updated the comment.
ConfluenceCloud.Comment.version.by.profilePicture.width Number Width in pixels of the profile picture of the user who last updated the comment.
ConfluenceCloud.Comment.version.by.profilePicture.height Number Height in pixels of the profile picture of the user who last updated the comment.
ConfluenceCloud.Comment.version.by.profilePicture.isDefault Boolean Whether the profile picture is the default profile picture.
ConfluenceCloud.Comment.version.by.displayName String Display name of the user who last updated the comment.
ConfluenceCloud.Comment.version.by.isExternalCollaborator Boolean Whether the user is an external collaborator.
ConfluenceCloud.Comment.version.by._links.self String Link to the user who last updated the comment.
ConfluenceCloud.Comment.version.when Date Date and time, in ISO 8601 format, when the comment was updated.
ConfluenceCloud.Comment.version.friendlyWhen String Displays when the content was created.
ConfluenceCloud.Comment.version.message String Message of the updated comment.
ConfluenceCloud.Comment.version.number Number Version number of the updated comment.
ConfluenceCloud.Comment.version.minorEdit Boolean Whether the edit was minor.
ConfluenceCloud.Comment.version.confRev String The revision ID provided by Confluence to be used as a revision in Synchrony.
ConfluenceCloud.Comment.version.contentTypeModified Boolean True if the comment type is modified in the version. (e.g., page to blog)
ConfluenceCloud.Comment.version._links.self String Link to the new version of the comment.
ConfluenceCloud.Comment.ancestors.id String ID of the parent page of the comment.
ConfluenceCloud.Comment.ancestors.type String Type of the parent page of the comment.
ConfluenceCloud.Comment.ancestors.status String Status of the parent page of the comment.
ConfluenceCloud.Comment.ancestors.title String Title of the parent page of the comment.
ConfluenceCloud.Comment.ancestors.extensions.location String Location of the comment.
ConfluenceCloud.Comment.ancestors._links.self String Link to the parent page of the comment.
ConfluenceCloud.Comment.ancestors._links.tinyui String Tiny link to the parent page of the comment.
ConfluenceCloud.Comment.ancestors._links.editui String Edit user interface link to the parent page of the comment.
ConfluenceCloud.Comment.ancestors._links.webui String Web user interface link to the parent page of the comment.
ConfluenceCloud.Comment.container.id Number ID of the container of the comment.
ConfluenceCloud.Comment.container.key String Key of the container of the comment.
ConfluenceCloud.Comment.container.name String Name of the container of the comment.
ConfluenceCloud.Comment.container.type String Type of the container of the comment.
ConfluenceCloud.Comment.container.status String Status of the container of the comment.
ConfluenceCloud.Comment.container._links.webui String Web user interface link to the container of the comment.
ConfluenceCloud.Comment.container._links.self String Link to the container of the comment.
ConfluenceCloud.Comment.body.storage.value String The body of the new comment.
ConfluenceCloud.Comment.body.storage.representation String Representation format of the comment.
ConfluenceCloud.Comment.extensions.location String Location of the comment.
ConfluenceCloud.Comment._links.editui String Edit user interface link of the comment.
ConfluenceCloud.Comment._links.webui String Web user interface link of the comment.
ConfluenceCloud.Comment._links.context String Context link of the comment.
ConfluenceCloud.Comment._links.self String Link to the comment.
ConfluenceCloud.Comment._links.tinyui String Tiny link of the comment.
ConfluenceCloud.Comment._links.collection String Collection link of the comment.
ConfluenceCloud.Comment._links.base String Base link to the comment.

Command Example

!confluence-cloud-comment-create body_value="hello" body_representation="storage" container_id=2031630

Context Example

{
    "ConfluenceCloud": {
        "Comment": {
            "_expandable": {
                "children": "/rest/api/content/16711873/child",
                "descendants": "/rest/api/content/16711873/descendant",
                "restrictions": "/rest/api/content/16711873/restriction/byOperation"
            },
            "_links": {
                "base": "https://xsoar-bd.atlassian.net/wiki",
                "collection": "/rest/api/content",
                "context": "/wiki",
                "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/16711873",
                "webui": "/spaces/XSOAR/blog/2021/08/06/2031630/XSOAR_blogpost?focusedCommentId=16711873#comment-16711873"
            },
            "body": {
                "storage": {
                    "_expandable": {
                        "content": "/rest/api/content/16711873"
                    },
                    "representation": "storage",
                    "value": "hello"
                }
            },
            "container": {
                "_expandable": {
                    "children": "/rest/api/content/2031630/child",
                    "container": "/rest/api/space/XSOAR",
                    "descendants": "/rest/api/content/2031630/descendant",
                    "restrictions": "/rest/api/content/2031630/restriction/byOperation",
                    "space": "/rest/api/space/XSOAR"
                },
                "_links": {
                    "editui": "/pages/resumedraft.action?draftId=2031630",
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/2031630",
                    "tinyui": "/x/DgAf",
                    "webui": "/spaces/XSOAR/blog/2021/08/06/2031630/XSOAR_blogpost"
                },
                "history": {
                    "_links": {
                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/2031630/history"
                    },
                    "createdBy": {
                        "_links": {
                            "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                        },
                        "accountId": "5ff2e30b4d2179006ea18449",
                        "accountType": "atlassian",
                        "displayName": "John Doe",
                        "email": "dummy.dummy@dummy.com",
                        "isExternalCollaborator": false,
                        "profilePicture": {
                            "height": 48,
                            "isDefault": false,
                            "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                            "width": 48
                        },
                        "publicName": "John Doe",
                        "type": "known"
                    },
                    "createdDate": "2021-08-06T06:59:04.777Z",
                    "latest": true
                },
                "id": "2031630",
                "status": "current",
                "title": "XSOAR_blogpost",
                "type": "blogpost",
                "version": {
                    "_expandable": {
                        "content": "/rest/api/content/2031630"
                    },
                    "_links": {
                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/2031630/version/1"
                    },
                    "by": {
                        "_links": {
                            "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                        },
                        "accountId": "5ff2e30b4d2179006ea18449",
                        "accountType": "atlassian",
                        "displayName": "John Doe",
                        "email": "dummy.dummy@dummy.com",
                        "isExternalCollaborator": false,
                        "profilePicture": {
                            "height": 48,
                            "isDefault": false,
                            "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                            "width": 48
                        },
                        "publicName": "John Doe",
                        "type": "known"
                    },
                    "confRev": "confluence$content$2031630.4",
                    "contentTypeModified": false,
                    "friendlyWhen": "Aug 06, 2021",
                    "minorEdit": false,
                    "number": 1,
                    "syncRev": "0.confluence$content$2031630.3",
                    "syncRevSource": "synchrony-ack",
                    "when": "2021-08-06T06:59:04.777Z"
                }
            },
            "extensions": {
                "location": "footer"
            },
            "history": {
                "_links": {
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/16711873/history"
                },
                "createdBy": {
                    "_links": {
                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                    },
                    "accountId": "5ff2e30b4d2179006ea18449",
                    "accountType": "atlassian",
                    "displayName": "John Doe",
                    "email": "dummy.dummy@dummy.com",
                    "isExternalCollaborator": false,
                    "profilePicture": {
                        "height": 48,
                        "isDefault": false,
                        "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                        "width": 48
                    },
                    "publicName": "John Doe",
                    "type": "known"
                },
                "createdDate": "2021-09-02T06:36:36.737Z",
                "latest": true
            },
            "id": "16711873",
            "space": {
                "_expandable": {
                    "lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=XSOAR",
                    "settings": "/rest/api/space/XSOAR/settings",
                    "theme": "/rest/api/space/XSOAR/theme"
                },
                "_links": {
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/space/XSOAR",
                    "webui": "/spaces/XSOAR"
                },
                "id": 2064386,
                "key": "XSOAR",
                "name": "XSOAR_Project",
                "status": "current",
                "type": "global"
            },
            "status": "current",
            "title": "Re: XSOAR_blogpost",
            "type": "comment",
            "version": {
                "_expandable": {
                    "content": "/rest/api/content/16711873"
                },
                "_links": {
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/16711873/version/1"
                },
                "by": {
                    "_links": {
                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                    },
                    "accountId": "5ff2e30b4d2179006ea18449",
                    "accountType": "atlassian",
                    "displayName": "John Doe",
                    "email": "dummy.dummy@dummy.com",
                    "isExternalCollaborator": false,
                    "profilePicture": {
                        "height": 48,
                        "isDefault": false,
                        "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                        "width": 48
                    },
                    "publicName": "John Doe",
                    "type": "known"
                },
                "contentTypeModified": false,
                "friendlyWhen": "just a moment ago",
                "minorEdit": false,
                "number": 1,
                "when": "2021-09-02T06:36:36.737Z"
            }
        }
    }
}

Human Readable Output

Comment

ID Title Type Status Space Name Created By Created At
16711873 Re: XSOAR_blogpost comment current XSOAR_Project John Doe 2021-09-02T06:36:36.737Z

confluence-cloud-space-list


Returns a list of all Confluence spaces.

Base Command

confluence-cloud-space-list

Input

Argument Name Description Required
limit Number of records to retrieve in the response.

Note: The minimum value supported is 0 and the maximum value supported is int32.

Default is 50.
Optional
offset The starting index of the returned spaces.

Note: The minimum value supported is 0 and the maximum value supported is int32.

Default is 0.
Optional
space_key The space key to retrieve the specific space.

Note: Supports a comma-separated list of values.
Optional
space_id The space ID to retrieve the specific space.

Note: Supports a comma-separated list of values.
Optional
status Filter the results to list the spaces based on their status.
Possible values: current, archived.

Note: The term ‘current’ refers to the space that is currently active.
Optional
type Filter the results to list the spaces based on their type.
Possible values: global, personal.
Optional
favourite Filter the results to the favorite spaces of the current user.
Possible values: true, false.
Optional
expand Indicates which properties to expand.
For reference, visit https://developer.atlassian.com/cloud/confluence/rest/api-group-space/#api-wiki-rest-api-space-get.

Note: To separate multiple values, use commas. Expanded properties will be populated in context data only.
Optional

Context Output

Path Type Description
ConfluenceCloud.Space.id Number ID of the space.
ConfluenceCloud.Space.key String Key of the space.
ConfluenceCloud.Space.name String Name of the space.
ConfluenceCloud.Space.description.view.value String The description of the space in view format.
ConfluenceCloud.Space.description.view.representation String Representation format of the description in view format.
ConfluenceCloud.Space.description.plain.value String The description of the space in plain format.
ConfluenceCloud.Space.description.plain.representation String Representation format of the description in plain format.
ConfluenceCloud.Space.homepage.id String ID of the homepage of the space.
ConfluenceCloud.Space.homepage.type String Type of the homepage of the space.
ConfluenceCloud.Space.homepage.status String Status of the homepage of the space.
ConfluenceCloud.Space.homepage.title String Title of the homepage of the space.
ConfluenceCloud.Space.homepage.extensions.position Number The content extension position.
ConfluenceCloud.Space.homepage._links.self String Link to the homepage of the space.
ConfluenceCloud.Space.homepage._links.tinyui String Tiny link to the homepage of the space.
ConfluenceCloud.Space.homepage._links.editui String Edit the user interface link to the homepage of the space.
ConfluenceCloud.Space.homepage._links.webui String Web user interface link to the homepage of the space.
ConfluenceCloud.Space.type String Type of the space.
ConfluenceCloud.Space.permissions.id Number ID of the space permission.
ConfluenceCloud.Space.permissions.subjects.user.results.type String Type of the user to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.results.accountId String Account ID of the user to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.results.accountType String Account type of the user to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.results.email String Email of the user to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.results.publicName String Public name to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.results.profilePicture.path String Path of the user’s profile picture to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.results.profilePicture.width Number Width in pixels of the user’s profile picture to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.results.profilePicture.height Number Height in pixels of the user’s profile picture to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.results.profilePicture.isDefault Boolean Whether the profile picture of the user is the default profile picture to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.results.displayName String Display name of the user to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.results.isExternalCollaborator Boolean Whether the user is an external collaborator user.
ConfluenceCloud.Space.permissions.subjects.user.results._links.self String Link to the user to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.user.size Number Size of the list of users for a given space.
ConfluenceCloud.Space.permissions.subjects.group.results.type String Type of the group to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.group.results.name String Name of the group to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.group.results.id String ID of the group to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.group.results._links.self String Link to the group to whom the space permission applies.
ConfluenceCloud.Space.permissions.subjects.group.size Number Size of the list of groups for the given space.
ConfluenceCloud.Space.permissions.operation.operation String Name of the permission operation.
ConfluenceCloud.Space.permissions.operation.targetType String The space or content type that the operation applies to.
ConfluenceCloud.Space.permissions.anonymousAccess Boolean Whether anonymous users have permission to use the operation.
ConfluenceCloud.Space.permissions.unlicensedAccess Boolean Whether unlicensed users have access from JIRA Service Desk when used with the read space operation.
ConfluenceCloud.Space.status String Status of the space.
ConfluenceCloud.Space._links.webui String Web user interface link of the space.
ConfluenceCloud.Space._links.context String Context link of the space.
ConfluenceCloud.Space._links.self String Link to the space.
ConfluenceCloud.Space._links.collection String Collection link of the space.
ConfluenceCloud.Space._links.base String Base link to the space.

Command Example

!confluence-cloud-space-list limit=2

Context Example

{
    "ConfluenceCloud": {
        "Space": [
            {
                "_expandable": {
                    "homepage": "/rest/api/content/12943822",
                    "lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=unique2",
                    "settings": "/rest/api/space/unique2/settings",
                    "theme": "/rest/api/space/unique2/theme"
                },
                "_links": {
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/space/unique2",
                    "webui": "/spaces/unique2"
                },
                "history": {
                    "createdBy": {
                        "_links": {
                            "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                        },
                        "accountId": "5ff2e30b4d2179006ea18449",
                        "accountType": "atlassian",
                        "displayName": "John Doe",
                        "email": "dummy.dummy@dummy.com",
                        "isExternalCollaborator": false,
                        "profilePicture": {
                            "height": 48,
                            "isDefault": false,
                            "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                            "width": 48
                        },
                        "publicName": "John Doe",
                        "type": "known"
                    },
                    "createdDate": "2021-08-26T08:50:12.879Z"
                },
                "id": 12943669,
                "key": "unique2",
                "name": "11Nam quis nulla. Integer malesuada. In in enim a arcu imperdiet malesuada. Sed vel lectus. Donec odio urna, tempus molestie, porttitor ut, iaculis quis, sem. Phasellus rhoncus. Aenean id metus id velit",
                "status": "current",
                "type": "global"
            },
            {
                "_expandable": {
                    "homepage": "/rest/api/content/12976407",
                    "lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=unique22",
                    "settings": "/rest/api/space/unique22/settings",
                    "theme": "/rest/api/space/unique22/theme"
                },
                "_links": {
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/space/unique22",
                    "webui": "/spaces/unique22"
                },
                "history": {
                    "createdBy": {
                        "_links": {
                            "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                        },
                        "accountId": "5ff2e30b4d2179006ea18449",
                        "accountType": "atlassian",
                        "displayName": "John Doe",
                        "email": "dummy.dummy@dummy.com",
                        "isExternalCollaborator": false,
                        "profilePicture": {
                            "height": 48,
                            "isDefault": false,
                            "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                            "width": 48
                        },
                        "publicName": "John Doe",
                        "type": "known"
                    },
                    "createdDate": "2021-08-26T13:19:25.526Z"
                },
                "id": 12976314,
                "key": "unique22",
                "name": "11Nam quis nulla. Integer malesuada. In in enim a arcu imperdiet malesuada. Sed vel lectus. Donec odio urna, tempus molestie, porttitor ut, iaculis quis, sem. Phasellus rhoncus. Aenean id metus id velit",
                "status": "current",
                "type": "global"
            }
        ]
    }
}

Human Readable Output

Space(s)

ID Space Key Name Type Status Created By Created At
12943669 unique2 11Nam quis nulla. Integer malesuada. In in enim a arcu imperdiet malesuada. Sed vel lectus. Donec odio urna, tempus molestie, porttitor ut, iaculis quis, sem. Phasellus rhoncus. Aenean id metus id velit global current John Doe 2021-08-26T08:50:12.879Z
12976314 unique22 11Nam quis nulla. Integer malesuada. In in enim a arcu imperdiet malesuada. Sed vel lectus. Donec odio urna, tempus molestie, porttitor ut, iaculis quis, sem. Phasellus rhoncus. Aenean id metus id velit global current John Doe 2021-08-26T13:19:25.526Z

confluence-cloud-content-list


Returns the list of content of Confluence.

Base Command

confluence-cloud-content-list

Input

Argument Name Description Required
limit Number of records to retrieve in the response.

Note: The minimum value supported is 0 and the maximum value supported is int32.

Default is 50.
Optional
offset The starting index of the returned content.

Note: The minimum value supported is 0 and the maximum value supported is int32.

Default is 0.
Optional
space_key The space key to retrieve the contents of a specific space. Optional
type The type to retrieve the contents.
Possible values: page, blogpost.

Default is page.
Optional
sort_order Order in which the response will be sorted.
Possible values: asc, desc.

Note: If ‘sort_key’ is specified, the default value for ‘sort_order’ is ascending.
Optional
sort_key Key based on which the response will be sorted.

Note: If ‘sort_order’ is specified, ‘sort_key’ is required.
Optional
creation_date The date from which to return the content created on that specific date.
Formats accepted: 2 days, 2 weeks, 2 months, 2 years, yyyy-mm-dd.
Optional
status Filter the results to a set of content based on their status. If set to any, content with any status is returned.
Possible values: any, current, trashed, draft, archived.

Note: The term ‘current’ refers to the content that is currently active.
Optional
expand Indicates which properties to expand.
For reference, visit https://developer.atlassian.com/cloud/confluence/rest/api-group-content/#api-wiki-rest-api-content-get.

Note: To separate multiple values, use commas. Expanded properties will be populated in context data only.
Optional

Context Output

Path Type Description
ConfluenceCloud.Content.id String The ID of the content.
ConfluenceCloud.Content.type String Type of the content.
ConfluenceCloud.Content.status String Status of the content.
ConfluenceCloud.Content.title String Title of the content.
ConfluenceCloud.Content.childTypes.attachment.value Boolean Whether the attachment has the given content.
ConfluenceCloud.Content.childTypes.attachment._links.self String Link to the attachment with the given content.
ConfluenceCloud.Content.childTypes.comment.value Boolean Whether a comment is associated with the given content.
ConfluenceCloud.Content.childTypes.comment._links.self String Link to the comment associated with the given content.
ConfluenceCloud.Content.childTypes.page.value Boolean Whether the page is associated with the given content.
ConfluenceCloud.Content.childTypes.page._links.self String Link to page associated with given content.
ConfluenceCloud.Content.space.id Number ID of the space that the content is being created in.
ConfluenceCloud.Content.space.key String Key of the space that the content is being created in.
ConfluenceCloud.Content.space.name String Name of the space that the content is being created in.
ConfluenceCloud.Content.space.type String Type of the space that the content is being created in.
ConfluenceCloud.Content.space.status String Status of the space that the content is being created in.
ConfluenceCloud.Content.space._links.webui String Web user interface link to the space that the content is being created in.
ConfluenceCloud.Content.space._links.self String Link to the space that the content is being created in.
ConfluenceCloud.Content.history.latest Boolean Whether the content is the latest content.
ConfluenceCloud.Content.history.createdBy.type String Type of the user who created the content.
ConfluenceCloud.Content.history.createdBy.accountId String Account ID of the user creating the content.
ConfluenceCloud.Content.history.createdBy.accountType String Account type of the user creating the content.
ConfluenceCloud.Content.history.createdBy.email String Email of the user creating the content.
ConfluenceCloud.Content.history.createdBy.publicName String Public name of the user creating the content.
ConfluenceCloud.Content.history.createdBy.profilePicture.path String Profile picture path of the user creating the content.
ConfluenceCloud.Content.history.createdBy.profilePicture.width Number Width in pixels of the profile picture of the user.
ConfluenceCloud.Content.history.createdBy.profilePicture.height Number Height in pixels of the profile picture of the user.
ConfluenceCloud.Content.history.createdBy.profilePicture.isDefault Boolean Whether the profile picture is the default profile picture.
ConfluenceCloud.Content.history.createdBy.displayName String Display name of the user who created the content.
ConfluenceCloud.Content.history.createdBy.isExternalCollaborator Boolean Whether the user is an external collaborator.
ConfluenceCloud.Content.history.createdBy._links.self String Link to the creator of the content.
ConfluenceCloud.Content.history.createdDate Date Date and time, in ISO 8601 format, when the content was created.
ConfluenceCloud.Content.history._links.self String Link to the history of the content.
ConfluenceCloud.Content.version.by.type String Type of the user who last updated the content.
ConfluenceCloud.Content.version.by.accountId String Account ID of the user who last updated the content.
ConfluenceCloud.Content.version.by.accountType String Account type of the user who last updated the content.
ConfluenceCloud.Content.version.by.email String Email of the user who last updated the content.
ConfluenceCloud.Content.version.by.publicName String Public name of the user who last updated the content.
ConfluenceCloud.Content.version.by.profilePicture.path String Profile picture path of the user who last updated the content.
ConfluenceCloud.Content.version.by.profilePicture.width Number Width in pixels of the profile picture of the user who last updated the content.
ConfluenceCloud.Content.version.by.profilePicture.height Number Height in pixels of the profile picture of the user who last updated the content.
ConfluenceCloud.Content.version.by.profilePicture.isDefault Boolean Whether the profile picture is the default profile picture.
ConfluenceCloud.Content.version.by.displayName String Display name of the user who last updated the content.
ConfluenceCloud.Content.version.by.isExternalCollaborator Boolean Whether the user is an external collaborator.
ConfluenceCloud.Content.version.by._links.self String Link to the user who last updated the content.
ConfluenceCloud.Content.version.when Date Date and time, in ISO 8601 format, when the content was updated.
ConfluenceCloud.Content.version.friendlyWhen String Displays when the content was created.
ConfluenceCloud.Content.version.message String Message of the updated content.
ConfluenceCloud.Content.version.number Number Version number of the updated content.
ConfluenceCloud.Content.version.minorEdit Boolean Whether the edit was minor.
ConfluenceCloud.Content.version.confRev String The revision ID provided by Confluence to be used as a revision in Synchrony
ConfluenceCloud.Content.version.contentTypeModified Boolean True if the content type is modified in the version. (e.g., page to blog)
ConfluenceCloud.Content.version._links.self String Link to the new version of the content.
ConfluenceCloud.Content.ancestors.id String ID of the parent page of the content.
ConfluenceCloud.Content.ancestors.type String Type of the parent page of the content.
ConfluenceCloud.Content.ancestors.status String Status of the parent page of the content.
ConfluenceCloud.Content.container.id Number ID of the container of the content.
ConfluenceCloud.Content.container.key String Key of the container of the content.
ConfluenceCloud.Content.container.name String Name of the container of the content.
ConfluenceCloud.Content.container.type String Type of the container of the content.
ConfluenceCloud.Content.container.status String Status of the container of the content.
ConfluenceCloud.Content.container._links.webui String Web user interface link to the container of the content.
ConfluenceCloud.Content.container._links.self String Link to the container of the content.
ConfluenceCloud.Content.body.storage.value String The body of the new content.
ConfluenceCloud.Content.body.storage.representation String Representation format of the content.
ConfluenceCloud.Content.extensions.position Number The content extension position.
ConfluenceCloud.Content._links.editui String Edit the user interface link of the content.
ConfluenceCloud.Content._links.webui String Web user interface link of the content.
ConfluenceCloud.Content._links.self String Link to the content.
ConfluenceCloud.Content._links.tinyui String Tiny link of the content.

Command Example

!confluence-cloud-content-list limit=2

Context Example

{
    "ConfluenceCloud": {
        "Content": [
            {
                "_expandable": {
                    "children": "/rest/api/content/65639/child",
                    "descendants": "/rest/api/content/65639/descendant",
                    "restrictions": "/rest/api/content/65639/restriction/byOperation"
                },
                "_links": {
                    "editui": "/pages/resumedraft.action?draftId=65639",
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/65639",
                    "tinyui": "/x/ZwAB",
                    "webui": "/spaces/~680738455/pages/65639/demo"
                },
                "childTypes": {
                    "attachment": {
                        "_links": {
                            "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/65639/child/attachment"
                        },
                        "value": false
                    },
                    "comment": {
                        "_links": {
                            "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/65639/child/comment"
                        },
                        "value": true
                    },
                    "page": {
                        "_links": {
                            "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/65639/child/page"
                        },
                        "value": true
                    }
                },
                "container": {
                    "_expandable": {
                        "lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=~680738455",
                        "settings": "/rest/api/space/~680738455/settings",
                        "theme": "/rest/api/space/~680738455/theme"
                    },
                    "_links": {
                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/space/~680738455",
                        "webui": "/spaces/~680738455"
                    },
                    "id": 65538,
                    "key": "~680738455",
                    "name": "John Doe",
                    "status": "current",
                    "type": "personal"
                },
                "extensions": {
                    "position": "none"
                },
                "history": {
                    "_links": {
                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/65639/history"
                    },
                    "createdBy": {
                        "_links": {
                            "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                        },
                        "accountId": "5ff2e30b4d2179006ea18449",
                        "accountType": "atlassian",
                        "displayName": "John Doe",
                        "email": "dummy.dummy@dummy.com",
                        "isExternalCollaborator": false,
                        "profilePicture": {
                            "height": 48,
                            "isDefault": false,
                            "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                            "width": 48
                        },
                        "publicName": "John Doe",
                        "type": "known"
                    },
                    "createdDate": "2021-08-02T09:53:05.077Z",
                    "latest": true
                },
                "id": "65639",
                "space": {
                    "_expandable": {
                        "lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=~680738455",
                        "settings": "/rest/api/space/~680738455/settings",
                        "theme": "/rest/api/space/~680738455/theme"
                    },
                    "_links": {
                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/space/~680738455",
                        "webui": "/spaces/~680738455"
                    },
                    "id": 65538,
                    "key": "~680738455",
                    "name": "John Doe",
                    "status": "current",
                    "type": "personal"
                },
                "status": "current",
                "title": "demo",
                "type": "page",
                "version": {
                    "_expandable": {
                        "content": "/rest/api/content/65639"
                    },
                    "_links": {
                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/65639/version/4"
                    },
                    "by": {
                        "_links": {
                            "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                        },
                        "accountId": "5ff2e30b4d2179006ea18449",
                        "accountType": "atlassian",
                        "displayName": "John Doe",
                        "email": "dummy.dummy@dummy.com",
                        "isExternalCollaborator": false,
                        "profilePicture": {
                            "height": 48,
                            "isDefault": false,
                            "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                            "width": 48
                        },
                        "publicName": "John Doe",
                        "type": "known"
                    },
                    "confRev": "confluence$content$65639.32",
                    "contentTypeModified": false,
                    "friendlyWhen": "yesterday at 11:39 AM",
                    "minorEdit": false,
                    "number": 4,
                    "syncRev": "0.confluence$content$65639.30",
                    "syncRevSource": "synchrony-ack",
                    "when": "2021-09-01T06:09:38.912Z"
                }
            },
            {
                "_expandable": {
                    "children": "/rest/api/content/65656/child",
                    "descendants": "/rest/api/content/65656/descendant",
                    "restrictions": "/rest/api/content/65656/restriction/byOperation"
                },
                "_links": {
                    "editui": "/pages/resumedraft.action?draftId=65656",
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/65656",
                    "tinyui": "/x/eAAB",
                    "webui": "/spaces/~680738455/pages/65656/Product+requirements"
                },
                "ancestors": [
                    {
                        "_expandable": {
                            "children": "/rest/api/content/65639/child",
                            "container": "/rest/api/space/~680738455",
                            "descendants": "/rest/api/content/65639/descendant",
                            "history": "/rest/api/content/65639/history",
                            "restrictions": "/rest/api/content/65639/restriction/byOperation",
                            "space": "/rest/api/space/~680738455"
                        },
                        "_links": {
                            "editui": "/pages/resumedraft.action?draftId=65639",
                            "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/65639",
                            "tinyui": "/x/ZwAB",
                            "webui": "/spaces/~680738455/pages/65639/demo"
                        },
                        "extensions": {
                            "position": "none"
                        },
                        "id": "65639",
                        "status": "current",
                        "title": "demo",
                        "type": "page"
                    }
                ],
                "childTypes": {
                    "attachment": {
                        "_links": {
                            "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/65656/child/attachment"
                        },
                        "value": false
                    },
                    "comment": {
                        "_links": {
                            "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/65656/child/comment"
                        },
                        "value": true
                    },
                    "page": {
                        "_links": {
                            "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/65656/child/page"
                        },
                        "value": false
                    }
                },
                "container": {
                    "_expandable": {
                        "lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=~680738455",
                        "settings": "/rest/api/space/~680738455/settings",
                        "theme": "/rest/api/space/~680738455/theme"
                    },
                    "_links": {
                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/space/~680738455",
                        "webui": "/spaces/~680738455"
                    },
                    "id": 65538,
                    "key": "~680738455",
                    "name": "John Doe",
                    "status": "current",
                    "type": "personal"
                },
                "extensions": {
                    "position": 499279072
                },
                "history": {
                    "_links": {
                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/65656/history"
                    },
                    "createdBy": {
                        "_links": {
                            "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                        },
                        "accountId": "5ff2e30b4d2179006ea18449",
                        "accountType": "atlassian",
                        "displayName": "John Doe",
                        "email": "dummy.dummy@dummy.com",
                        "isExternalCollaborator": false,
                        "profilePicture": {
                            "height": 48,
                            "isDefault": false,
                            "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                            "width": 48
                        },
                        "publicName": "John Doe",
                        "type": "known"
                    },
                    "createdDate": "2021-08-02T09:53:05.312Z",
                    "latest": true
                },
                "id": "65656",
                "space": {
                    "_expandable": {
                        "lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=~680738455",
                        "settings": "/rest/api/space/~680738455/settings",
                        "theme": "/rest/api/space/~680738455/theme"
                    },
                    "_links": {
                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/space/~680738455",
                        "webui": "/spaces/~680738455"
                    },
                    "id": 65538,
                    "key": "~680738455",
                    "name": "John Doe",
                    "status": "current",
                    "type": "personal"
                },
                "status": "current",
                "title": "Product requirements",
                "type": "page",
                "version": {
                    "_expandable": {
                        "content": "/rest/api/content/65656"
                    },
                    "_links": {
                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/65656/version/1"
                    },
                    "by": {
                        "_links": {
                            "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                        },
                        "accountId": "5ff2e30b4d2179006ea18449",
                        "accountType": "atlassian",
                        "displayName": "John Doe",
                        "email": "dummy.dummy@dummy.com",
                        "isExternalCollaborator": false,
                        "profilePicture": {
                            "height": 48,
                            "isDefault": false,
                            "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                            "width": 48
                        },
                        "publicName": "John Doe",
                        "type": "known"
                    },
                    "confRev": "confluence$content$65656.5",
                    "contentTypeModified": false,
                    "friendlyWhen": "Aug 02, 2021",
                    "minorEdit": false,
                    "number": 1,
                    "syncRev": "0.confluence$content$65656.2",
                    "syncRevSource": "synchrony-ack",
                    "when": "2021-08-02T09:53:05.312Z"
                }
            }
        ]
    }
}

Human Readable Output

Content(s)

ID Title Type Status Space Name Created By Created At Version
65639 demo page current John Doe John Doe 2021-08-02T09:53:05.077Z 2
65656 Product requirements page current John Doe John Doe 2021-08-02T09:53:05.312Z 2

confluence-cloud-content-delete


Delete the content depending on the content’s type and status.


Note: If the content’s type is page or blogpost, it should be moved to trash before deleting permanently.

Base Command

confluence-cloud-content-delete

Input

Argument Name Description Required
content_id The ID of the content to be deleted. Required
deletion_type The deletion type for the content to be deleted.
Possible values: move to trash (current), permanent delete (trashed), permanent delete draft (draft).
Optional

Context Output

There is no context output for this command.

Command Example

!confluence-cloud-content-delete content_id="3704312"

Human Readable Output

Content with Id 3704312 is deleted successfully.

confluence-cloud-content-update


Update the existing content with new content.

Note: Updating draft content is currently not supported.

Base Command

confluence-cloud-content-update

Input

Argument Name Description Required
content_id The ID of the content to be updated. Required
status The updated status of the content.
Possible values: current, trashed, historical, draft.

Note: The term ‘current’ refers to the content that is currently active.

Default is current.
Optional
version The new version for the updated content. Set the version to the current version number incremented by one. If the status changed to ‘draft’, then it must be 1.

Note: To retrieve the current version, execute the confluence-cloud-content-search command using the query=”id={content_id}” argument.
Required
title The updated title of the content. If the field is not changing, set the title to the current title.

Note: The maximum title length is 255 characters.
Required
type The type of content. Set the type to the current type of the content.
Possible values: page, blogpost, comment, attachment.
Required
body_value The body of the content in the relevant format. Optional
body_representation The content format type.
Possible values: view, export_view, styled_view, storage, editor2, anonymous_export_view.

Note: If type is comment, possible values are editor, editor2 or storage.
Optional

Context Output

Path Type Description
ConfluenceCloud.Content.id String The ID of the content.
ConfluenceCloud.Content.type String Type of the content.
ConfluenceCloud.Content.status String Status of the content.
ConfluenceCloud.Content.title String Title of the content.
ConfluenceCloud.Content.childTypes.attachment.value Boolean Whether the attachment has the given content.
ConfluenceCloud.Content.childTypes.attachment._links.self String Link to the attachment with the given content.
ConfluenceCloud.Content.childTypes.comment.value Boolean Whether a comment is associated with the given content.
ConfluenceCloud.Content.childTypes.comment._links.self String Link to the comment associated with the given content.
ConfluenceCloud.Content.childTypes.page.value Boolean Whether the page is associated with the given content.
ConfluenceCloud.Content.childTypes.page._links.self String Link to the page associated with the given content.
ConfluenceCloud.Content.space.id Number ID of the space that the content is being created in.
ConfluenceCloud.Content.space.key String Key of the space that the content is being created in.
ConfluenceCloud.Content.space.name String Name of the space that the content is being created in.
ConfluenceCloud.Content.space.type String Type of the space that the content is being created in.
ConfluenceCloud.Content.space.status String Status of the space that the content is being created in.
ConfluenceCloud.Content.space._links.webui String Web user interface link to the space that the content is being created in.
ConfluenceCloud.Content.space._links.self String Link to the space that the content is being created in.
ConfluenceCloud.Content.history.latest Boolean Whether the content is the latest content.
ConfluenceCloud.Content.history.createdBy.type String Type of the user who created the content.
ConfluenceCloud.Content.history.createdBy.accountId String Account ID of the user creating the content.
ConfluenceCloud.Content.history.createdBy.accountType String Account type of the user creating the content.
ConfluenceCloud.Content.history.createdBy.email String Email of the user creating the content.
ConfluenceCloud.Content.history.createdBy.publicName String Public name of the user creating the content.
ConfluenceCloud.Content.history.createdBy.profilePicture.path String Profile picture path of the user creating the content.
ConfluenceCloud.Content.history.createdBy.profilePicture.width Number Width in pixels of the profile picture of the user.
ConfluenceCloud.Content.history.createdBy.profilePicture.height Number Height in pixels of the profile picture of the user.
ConfluenceCloud.Content.history.createdBy.profilePicture.isDefault Boolean Whether the profile picture is default.
ConfluenceCloud.Content.history.createdBy.displayName String Display name of the user who created the content.
ConfluenceCloud.Content.history.createdBy.isExternalCollaborator Boolean Whether the user is an external collaborator.
ConfluenceCloud.Content.history.createdBy._links.self String Link to the creator of the content.
ConfluenceCloud.Content.history.createdDate Date Date and time, in ISO 8601 format, when the content was created.
ConfluenceCloud.Content.history._links.self String Link to the history of the content.
ConfluenceCloud.Content.version.by.type String Type of the user who last updated the content.
ConfluenceCloud.Content.version.by.accountId String Account ID of the user who last updated the content.
ConfluenceCloud.Content.version.by.accountType String Account type of the user who last updated the content.
ConfluenceCloud.Content.version.by.email String Email of the user who last updated the content.
ConfluenceCloud.Content.version.by.publicName String Public name of the user who last updated the content.
ConfluenceCloud.Content.version.by.profilePicture.path String Profile picture path of the user who last updated the content.
ConfluenceCloud.Content.version.by.profilePicture.width Number Width in pixels of the profile picture of the user who last updated the content.
ConfluenceCloud.Content.version.by.profilePicture.height Number Height in pixels of the profile picture of the user who last updated the content.
ConfluenceCloud.Content.version.by.profilePicture.isDefault Boolean Whether the profile picture is default.
ConfluenceCloud.Content.version.by.displayName String Display name of the user who last updated the content.
ConfluenceCloud.Content.version.by.isExternalCollaborator Boolean Whether the user is an external collaborator.
ConfluenceCloud.Content.version.by._links.self String Link to the user who last updated the content.
ConfluenceCloud.Content.version.when Date Date and time, in ISO 8601 format, when the content was updated.
ConfluenceCloud.Content.version.friendlyWhen String Display the information of when the content was created.
ConfluenceCloud.Content.version.message String Message of the updated content.
ConfluenceCloud.Content.version.number Number Version number of the updated content.
ConfluenceCloud.Content.version.minorEdit Boolean Whether the edit was minor.
ConfluenceCloud.Content.version.confRev String The revision ID provided by Confluence to be used as a revision in Synchrony.
ConfluenceCloud.Content.version.contentTypeModified Boolean True if the content type is modified in the version. (e.g. page to blog)
ConfluenceCloud.Content.version._links.self String Link to the new version of the content.
ConfluenceCloud.Content.ancestors.id String ID of the parent page of the content.
ConfluenceCloud.Content.ancestors.type String Type of the parent page of the content.
ConfluenceCloud.Content.ancestors.status String Status of the parent page of the content.
ConfluenceCloud.Content.ancestors.title String Title of the parent page of the content.
ConfluenceCloud.Content.ancestors.extensions.position Number The content extension position.
ConfluenceCloud.Content.ancestors._links.self String Link to the parent page of the content.
ConfluenceCloud.Content.ancestors._links.tinyui String Tiny link to the parent page of the content.
ConfluenceCloud.Content.ancestors._links.editui String Edit the user interface link to the parent page of the content.
ConfluenceCloud.Content.ancestors._links.webui String Web user interface link to the parent page of the content.
ConfluenceCloud.Content.container.id Number ID of the container of the content.
ConfluenceCloud.Content.container.key String Key of the container of the content.
ConfluenceCloud.Content.container.name String Name of the container of the content.
ConfluenceCloud.Content.container.type String Type of the container of the content.
ConfluenceCloud.Content.container.status String Status of the container of the content.
ConfluenceCloud.Content.container._links.webui String Web user interface link to the container of the content.
ConfluenceCloud.Content.container._links.self String Link to the container of the content.
ConfluenceCloud.Content.body.storage.value String The body of the new content.
ConfluenceCloud.Content.body.storage.representation String Representation format of the content.
ConfluenceCloud.Content.extensions.position Number The content extension position.
ConfluenceCloud.Content._links.editui String Edit the user interface link of the content.
ConfluenceCloud.Content._links.webui String Web user interface link of the content.
ConfluenceCloud.Content._links.context String Context link of the content.
ConfluenceCloud.Content._links.self String Link to the content.
ConfluenceCloud.Content._links.tinyui String Tiny link of the content.
ConfluenceCloud.Content._links.collection String Collection link of the content.
ConfluenceCloud.Content._links.base String Base link to the content.

Command Example

!confluence-cloud-content-update content_id=2097159 title="testing123" type=page version=5

Context Example

{
    "ConfluenceCloud": {
        "Content": {
            "_expandable": {
                "children": "/rest/api/content/2097159/child",
                "descendants": "/rest/api/content/2097159/descendant",
                "restrictions": "/rest/api/content/2097159/restriction/byOperation"
            },
            "_links": {
                "base": "https://xsoar-bd.atlassian.net/wiki",
                "collection": "/rest/api/content",
                "context": "/wiki",
                "editui": "/pages/resumedraft.action?draftId=2097159",
                "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/2097159",
                "tinyui": "/x/BwAg",
                "webui": "/spaces/XSOAR/pages/2097159/testing123"
            },
            "body": {
                "storage": {
                    "_expandable": {
                        "content": "/rest/api/content/2097159"
                    },
                    "representation": "storage"
                }
            },
            "container": {
                "_expandable": {
                    "lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=XSOAR",
                    "settings": "/rest/api/space/XSOAR/settings",
                    "theme": "/rest/api/space/XSOAR/theme"
                },
                "_links": {
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/space/XSOAR",
                    "webui": "/spaces/XSOAR"
                },
                "history": {
                    "createdBy": {
                        "_links": {
                            "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                        },
                        "accountId": "5ff2e30b4d2179006ea18449",
                        "accountType": "atlassian",
                        "displayName": "John Doe",
                        "email": "dummy.dummy@dummy.com",
                        "isExternalCollaborator": false,
                        "profilePicture": {
                            "height": 48,
                            "isDefault": false,
                            "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                            "width": 48
                        },
                        "publicName": "John Doe",
                        "type": "known"
                    },
                    "createdDate": "2021-08-06T06:18:11.470Z"
                },
                "id": 2064386,
                "key": "XSOAR",
                "name": "XSOAR_Project",
                "status": "current",
                "type": "global"
            },
            "extensions": {
                "position": "none"
            },
            "history": {
                "_links": {
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/2097159/history"
                },
                "createdBy": {
                    "_links": {
                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                    },
                    "accountId": "5ff2e30b4d2179006ea18449",
                    "accountType": "atlassian",
                    "displayName": "John Doe",
                    "email": "dummy.dummy@dummy.com",
                    "isExternalCollaborator": false,
                    "profilePicture": {
                        "height": 48,
                        "isDefault": false,
                        "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                        "width": 48
                    },
                    "publicName": "John Doe",
                    "type": "known"
                },
                "createdDate": "2021-08-06T06:23:36.076Z",
                "latest": true
            },
            "id": "2097159",
            "space": {
                "_expandable": {
                    "lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=XSOAR",
                    "settings": "/rest/api/space/XSOAR/settings",
                    "theme": "/rest/api/space/XSOAR/theme"
                },
                "_links": {
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/space/XSOAR",
                    "webui": "/spaces/XSOAR"
                },
                "id": 2064386,
                "key": "XSOAR",
                "name": "XSOAR_Project",
                "status": "current",
                "type": "global"
            },
            "status": "current",
            "title": "testing123",
            "type": "page",
            "version": {
                "_expandable": {
                    "content": "/rest/api/content/2097159"
                },
                "_links": {
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/content/2097159/version/4"
                },
                "by": {
                    "_links": {
                        "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5ff2e30b4d2179006ea18449"
                    },
                    "accountId": "5ff2e30b4d2179006ea18449",
                    "accountType": "atlassian",
                    "displayName": "John Doe",
                    "email": "dummy.dummy@dummy.com",
                    "isExternalCollaborator": false,
                    "profilePicture": {
                        "height": 48,
                        "isDefault": false,
                        "path": "/wiki/aa-avatar/5ff2e30b4d2179006ea18449",
                        "width": 48
                    },
                    "publicName": "John Doe",
                    "type": "known"
                },
                "confRev": "confluence$content$2097159.25",
                "contentTypeModified": false,
                "friendlyWhen": "38 minutes ago",
                "minorEdit": false,
                "number": 4,
                "syncRev": "0.confluence$content$2097159.22",
                "syncRevSource": "synchrony-ack",
                "when": "2021-09-02T05:58:18.823Z"
            }
        }
    }
}

Human Readable Output

Content

ID Title Type Status Space Name Created By Created At
2097159 testing123 page current XSOAR_Project John Doe 2021-08-06T06:23:36.076Z

confluence-cloud-content-search


Retrieves a list of content using the Confluence Query Language (CQL).

For more information on CQL, see: https://developer.atlassian.com/cloud/confluence/advanced-searching-using-cql/.

Base Command

confluence-cloud-content-search

Input

Argument Name Description Required
query The CQL (Confluence Query Language) string that is used to find the requested content. Required
limit Number of records to retrieve in the response.

Note: The minimum value supported is 0 and the maximum value supported is int32. Default is 50.
Optional
content_status Filter the result based on the content status.
Possible values: current, draft, archived.

Note: Supports multiple comma-separated values. Possible values are: .
Optional
next_page_token Retrieves the next page records for the given query (next_page_token retrieved in previous content response). Optional
expand Indicates which properties to expand.
For reference, visit https://developer.atlassian.com/cloud/confluence/rest/api-group-content/#api-wiki-rest-api-content-search-get.

Note: To separate multiple values, use commas. Expanded properties will be populated in context data only.
Optional

Context Output

Path Type Description
ConfluenceCloud.Content.id String The ID of the content.
ConfluenceCloud.Content.type String Type of the content.
ConfluenceCloud.Content.status String Status of the content.
ConfluenceCloud.Content.title String Title of the content.
ConfluenceCloud.Content.childTypes.attachment.value Boolean Whether the attachment has the given content.
ConfluenceCloud.Content.childTypes.attachment._links.self String Link to the attachment with the given content.
ConfluenceCloud.Content.childTypes.comment.value Boolean Whether a comment is associated with the given content.
ConfluenceCloud.Content.childTypes.comment._links.self String Link to the comment associated with the given content.
ConfluenceCloud.Content.childTypes.page.value Boolean Whether the page is associated with the given content.
ConfluenceCloud.Content.childTypes.page._links.self String Link to the page associated with the given content.
ConfluenceCloud.Content.space.id Number ID of the space that the content is being created in.
ConfluenceCloud.Content.space.key String Key of the space that the content is being created in.
ConfluenceCloud.Content.space.name String Name of the space that the content is being created in.
ConfluenceCloud.Content.space.type String Type of the space that the content is being created in.
ConfluenceCloud.Content.space.status String Status of the space that the content is being created in.
ConfluenceCloud.Content.space._links.webui String Web user interface link to the space that the content is being created in.
ConfluenceCloud.Content.space._links.self String Link to the space that the content is being created in.
ConfluenceCloud.Content.history.latest Boolean Whether the content is the latest content.
ConfluenceCloud.Content.history.createdBy.type String Type of the user who created the content.
ConfluenceCloud.Content.history.createdBy.accountId String Account ID of the user creating the content.
ConfluenceCloud.Content.history.createdBy.accountType String Account type of the user creating the content.
ConfluenceCloud.Content.history.createdBy.email String Email of the user creating the content.
ConfluenceCloud.Content.history.createdBy.publicName String Public name of the user creating the content.
ConfluenceCloud.Content.history.createdBy.profilePicture.path String Profile picture path of the user creating the content.
ConfluenceCloud.Content.history.createdBy.profilePicture.width Number Width in pixels of the profile picture of the user.
ConfluenceCloud.Content.history.createdBy.profilePicture.height Number Height in pixels of the profile picture of the user.
ConfluenceCloud.Content.history.createdBy.profilePicture.isDefault Boolean Whether the profile picture is the default profile picture.
ConfluenceCloud.Content.history.createdBy.displayName String Display name of the user who created the content.
ConfluenceCloud.Content.history.createdBy.isExternalCollaborator Boolean Whether the user is an external collaborator.
ConfluenceCloud.Content.history.createdBy._links.self String Link to the creator of the content.
ConfluenceCloud.Content.history.createdDate Date Date and time, in ISO 8601 format, when the content was created (e.g., 2024-01-15T12:34:56Z).
ConfluenceCloud.Content.history._links.self String Link to the history of the content.
ConfluenceCloud.Content.version.by.type String Type of the user who last updated the content.
ConfluenceCloud.Content.version.by.accountId String Account ID of the user who last updated the content.
ConfluenceCloud.Content.version.by.accountType String Account type of the user who last updated the content.
ConfluenceCloud.Content.version.by.email String Email of the user who last updated the content.
ConfluenceCloud.Content.version.by.publicName String Public name of the user who last updated the content.
ConfluenceCloud.Content.version.by.profilePicture.path String Profile picture path of the user who last updated the content.
ConfluenceCloud.Content.version.by.profilePicture.width Number Width in pixels of the profile picture of the user who last updated the content.
ConfluenceCloud.Content.version.by.profilePicture.height Number Height in pixels of the profile picture of the user who last updated the content.
ConfluenceCloud.Content.version.by.profilePicture.isDefault Boolean Whether the profile picture is the default profile picture.
ConfluenceCloud.Content.version.by.displayName String Display name of the user who last updated the content.
ConfluenceCloud.Content.version.by.isExternalCollaborator Boolean Whether the user is an external collaborator.
ConfluenceCloud.Content.version.by._links.self String Link to the user who last updated the content.
ConfluenceCloud.Content.version.when Date Date and time, in ISO 8601 format, when the content was updated (e.g., 2024-01-15T12:34:56Z).
ConfluenceCloud.Content.version.friendlyWhen String Displays when the content was created.
ConfluenceCloud.Content.version.message String Message of the updated content.
ConfluenceCloud.Content.version.number Number Version number of the updated content.
ConfluenceCloud.Content.version.minorEdit Boolean Whether the edit was minor.
ConfluenceCloud.Content.version.confRev String The revision ID provided by Confluence to be used as a revision in Synchrony.
ConfluenceCloud.Content.version.contentTypeModified Boolean True if the content type is modified in the version. (e.g., page to blog).
ConfluenceCloud.Content.version._links.self String Link to the new version of the content.
ConfluenceCloud.Content.ancestors.id String ID of the parent page of the content.
ConfluenceCloud.Content.ancestors.type String Type of the parent page of the content.
ConfluenceCloud.Content.ancestors.status String Status of the parent page of the content.
ConfluenceCloud.Content.container.id Number ID of the container of the content.
ConfluenceCloud.Content.container.key String Key of the container of the content.
ConfluenceCloud.Content.container.name String Name of the container of the content.
ConfluenceCloud.Content.container.type String Type of the container of the content.
ConfluenceCloud.Content.container.status String Status of the container of the content.
ConfluenceCloud.Content.container._links.webui String Web user interface link to the container of the content.
ConfluenceCloud.Content.container._links.self String Link to the container of the content.
ConfluenceCloud.Content.body.storage.value String The body of the new content.
ConfluenceCloud.Content.body.storage.representation String Representation format of the content.
ConfluenceCloud.Content.extensions.position Number The content extension position.
ConfluenceCloud.Content._links.editui String Edit the user interface link of the content.
ConfluenceCloud.Content._links.webui String Web user interface link of the content.
ConfluenceCloud.Content._links.self String Link to the content.
ConfluenceCloud.Content._links.tinyui String Tiny link of the content.
ConfluenceCloud.PageToken.name String The command name.
ConfluenceCloud.PageToken.next_token String The next page token.

confluence-cloud-user-list


Returns a list of users.

Base Command

confluence-cloud-user-list

Input

Argument Name Description Required
limit Number of records to retrieve in the response.

Note: The minimum value supported is 0 and the maximum value supported is int32.

Default is 50.
Optional
offset The starting index of the returned users.

Note: The minimum value supported is 0 and the maximum value supported is int32.

Default is 0.
Optional

Context Output

Path Type Description
ConfluenceCloud.User.type String Type of the user.
ConfluenceCloud.User.accountId String Account ID of the user.
ConfluenceCloud.User.accountType String Account type of the user.
ConfluenceCloud.User.publicName String The public name or nickname of the user.
ConfluenceCloud.User.profilePicture.path String Path of the user’s profile picture.
ConfluenceCloud.User.profilePicture.width Number Width in pixels of the user’s profile picture.
ConfluenceCloud.User.profilePicture.height Number Height in pixels of the user’s profile picture.
ConfluenceCloud.User.profilePicture.isDefault Boolean Whether the profile picture is the default profile picture.
ConfluenceCloud.User.displayName String Display name of the user.
ConfluenceCloud.User.isExternalCollaborator Boolean Whether the user is an external collaborator user.
ConfluenceCloud.User._links.self String Link to the user.

Command Example

!confluence-cloud-user-list limit=2

Context Example

{
    "ConfluenceCloud": {
        "User": [
            {
                "_links": {
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5d9afe0010f4800c341a2bba"
                },
                "accountId": "5d9afe0010f4800c341a2bba",
                "displayName": "Opsgenie Incident Timeline",
                "isExternalCollaborator": false,
                "profilePicture": {
                    "height": 48,
                    "isDefault": false,
                    "path": "/wiki/aa-avatar/5d9afe0010f4800c341a2bba",
                    "width": 48
                },
                "publicName": "Opsgenie Incident Timeline",
                "type": "known"
            },
            {
                "_links": {
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/api/user?accountId=5d9b2860cd50b80dcea8a5b7"
                },
                "accountId": "5d9b2860cd50b80dcea8a5b7",
                "displayName": "Opsgenie Incident Timeline",
                "isExternalCollaborator": false,
                "profilePicture": {
                    "height": 48,
                    "isDefault": false,
                    "path": "/wiki/aa-avatar/5d9b2860cd50b80dcea8a5b7",
                    "width": 48
                },
                "publicName": "Opsgenie Incident Timeline",
                "type": "known"
            }
        ]
    }
}

Human Readable Output

User(s)

Account ID Name User Type
5d9afe0010f4800c341a2bba Opsgenie Incident Timeline known
5d9b2860cd50b80dcea8a5b7 Opsgenie Incident Timeline known

confluence-cloud-group-list


Returns all user groups.

Base Command

confluence-cloud-group-list

Input

Argument Name Description Required
limit Number of records to retrieve in the response.

Note: The minimum value supported is 0 and the maximum value supported is int32.

Default is 50.
Optional
offset The starting index of the returned groups.

Note: The minimum value supported is 0 and the maximum value supported is int32.

Default is 0.
Optional
access_type The group permission level for which to filter results.
Possible values: user, admin, site-admin.
Optional

Context Output

Path Type Description
ConfluenceCloud.Group.type String Type of the group.
ConfluenceCloud.Group.name String Name of the group.
ConfluenceCloud.Group.id String ID of the group.
ConfluenceCloud.Group._links.self String Link to the group.

Command Example

!confluence-cloud-group-list limit=2

Context Example

{
    "ConfluenceCloud": {
        "Group": [
            {
                "_links": {
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/administrators"
                },
                "id": "10453df5-f7fc-47be-8ca7-bc2949c1bd5b",
                "name": "administrators",
                "type": "group"
            },
            {
                "_links": {
                    "self": "https://xsoar-bd.atlassian.net/wiki/rest/experimental/group/confluence-users"
                },
                "id": "e50e7fe6-7961-4775-9bbf-99e4b50f8701",
                "name": "confluence-users",
                "type": "group"
            }
        ]
    }
}

Human Readable Output

Group(s)

ID Name
10453df5-f7fc-47be-8ca7-bc2949c1bd5b administrators
e50e7fe6-7961-4775-9bbf-99e4b50f8701 confluence-users

confluence-cloud-get-events


Retrieves a list of events from the Atlassian Confluence Cloud instance.

Base Command

confluence-cloud-get-events

Input

Argument Name Description Required
should_push_events Set this argument to True in order to create events, otherwise the command will only display them. Possible values are: true, false. Default is false. Optional
start_date Filters the results to the records on or after the start date. The start date must be specified as epoch time in milliseconds. Optional
limit The maximum number of records to return per page. Note, this may be restricted by fixed system limits. Optional

Context Output

Path Type Description
ConfluenceCloud.Event.author.type String The type of author who created this event.
ConfluenceCloud.Event.author.displayName String The display nName of the author who created this event.
ConfluenceCloud.Event.author.operations String Nullable. Author’s operations.
ConfluenceCloud.Event.author.username String Username of the author of this event.
ConfluenceCloud.Event.author.userKey String User key of the author of this event.
ConfluenceCloud.Event.author.accountId String Account ID of the author of this event.
ConfluenceCloud.Event.author.accountType String Type of account of the author of this event.
ConfluenceCloud.Event.author.externalCollaborator Boolean Deprecated. Is the author of this event an external collaborator.
ConfluenceCloud.Event.author.isExternalCollaborator Boolean Deprecated. Is the author of this event an external collaborator.
ConfluenceCloud.Event.author.publicName String The public name of the author of this event.
ConfluenceCloud.Event.remoteAddress String The remote address from which the event was performed.
ConfluenceCloud.Event.creationDate Number The creation date-time of the audit record, as a timestamp.
ConfluenceCloud.Event.summary Strings Summary of the audit.
ConfluenceCloud.Event.description String Description of the audit.
ConfluenceCloud.Event.category String Category of the event.
ConfluenceCloud.Event.sysAdmin Boolean Was the event created by a system administrator.
ConfluenceCloud.Event.superAdmin Boolean Was the event created by a super administrator.
ConfluenceCloud.Event.affectedObject.name String Name of the object affected by the event.
ConfluenceCloud.Event.affectedObject.objectType String Type of the object affected by the event.
ConfluenceCloud.Event.changedValues.name String Name of the changed value.
ConfluenceCloud.Event.changedValues.oldValue String The old value before the change the event describes.
ConfluenceCloud.Event.changedValues.hiddenOldValue String The old hidden value before the change the event describes.
ConfluenceCloud.Event.changedValues.newValue String The new value after the change the event describes.
ConfluenceCloud.Event.changedValues.hiddenNewValue String The new hidden value after the change the event describes.
ConfluenceCloud.Event.associatedObjects.name String Name of the associated object.
ConfluenceCloud.Event.associatedObjects.objectType String Type of the associated object.

Command Example

!confluence-cloud-get-events limit=1

Context Example

{
    "ConfluenceCloud": {
        "Event": [
            {
                "author": {
                    "type": "user",
                    "displayName": "<string>",
                    "operations": {},
                    "username": "<string>",
                    "userKey": "<string>",
                    "accountId": "<string>",
                    "accountType": "<string>",
                    "externalCollaborator": true,
                    "isExternalCollaborator": true,
                    "publicName": "<string>"
                },
                "remoteAddress": "<string>",
                "creationDate": 59,
                "summary": "<string>",
                "description": "<string>",
                "category": "<string>",
                "sysAdmin": true,
                "superAdmin": true,
                "affectedObject": {
                    "name": "<string>",
                    "objectType": "<string>"
                },
                "changedValues": [
                    {
                        "name": "<string>",
                        "oldValue": "<string>",
                        "hiddenOldValue": "<string>",
                        "newValue": "<string>",
                        "hiddenNewValue": "<string>"
                    }
                ],
                "associatedObjects": [
                    {
                        "name": "<string>",
                        "objectType": "<string>"
                    }
                ]
            }
        ]
    }
}

confluence-cloud-content-get


Retrieves a piece of content (e.g., page, blogpost) from Confluence Cloud by its ID.

Base Command

confluence-cloud-content-get

Input

Argument Name Description Required
content_id The ID of the content to retrieve. Required

Context Output

Path Type Description
ConfluenceCloud.Content.id String The content ID.
ConfluenceCloud.Content.type String The type of the content (e.g., page, blogpost).
ConfluenceCloud.Content.ari String The Atlassian Resource Identifier (ARI) for the content.
ConfluenceCloud.Content.base64EncodedAri String The Base64 encoded ARI of the content.
ConfluenceCloud.Content.status String The status of the content (e.g., current, archived, draft).
ConfluenceCloud.Content.title String The title of the content.
ConfluenceCloud.Content.body Unknown The body of the content.
ConfluenceCloud.Content.body.storage.value String The raw storage-format value of the content body (may contain HTML/XML).
ConfluenceCloud.Content.body.storage.representation String The representation format of the body (e.g., storage, view).
ConfluenceCloud.Content.body.storage.embeddedContent Unknown A list of embedded content objects in the body.
ConfluenceCloud.Content.body.storage._expandable String Link to the content resource for the body.
ConfluenceCloud.Content.extensions.position Number Position of the content in the page tree or order.
ConfluenceCloud.Content._links.editui String Link to edit the content in the UI.
ConfluenceCloud.Content._links.webui String Web UI link to the content.
ConfluenceCloud.Content._links.edituiv2 String Link to edit the content in the new UI.
ConfluenceCloud.Content._links.context String Context path of the Confluence instance.
ConfluenceCloud.Content._links.self String REST API self link for the content.
ConfluenceCloud.Content._links.tinyui String Tiny link to the content.
ConfluenceCloud.Content._links.collection String Link to the collection of content resources.
ConfluenceCloud.Content._links.base String Base URL of the Confluence site.

Command Example

!confluence-cloud-content-get content_id="123456"

Context Example

{
  "ConfluenceCloud": {
    "Content": {
      "id": "123456",
      "type": "page",
      "ari": "ari:cloud:confluence::content/123456",
      "base64EncodedAri": "YXJpOmNsb3VkOmNvbmZsdWVuY2U6OmNvbnRlbnQvMTIzNDU2",
      "status": "current",
      "title": "Demo Page",
      "body": {
        "storage": {
          "value": "<p>This is a demo body.</p>",
          "representation": "storage",
          "embeddedContent": []
        }
      },
      "extensions": {
        "position": 42
      },
      "_links": {
        "editui": "/pages/editpage.action?pageId=123456",
        "edituiv2": "/wiki/edit-v2/123456",
        "webui": "/spaces/ABC/pages/123456/Demo+Page",
        "context": "/wiki",
        "self": "https://example.atlassian.net/wiki/rest/api/content/123456",
        "tinyui": "/x/abc123",
        "collection": "/rest/api/content",
        "base": "https://example.atlassian.net/wiki"
      }
    }
  }
}

confluence-cloud-oauth-start


Starts the OAuth 2.0 authentication flow. Returns an authorization URL that the user must visit to authorize the integration.

Base Command

confluence-cloud-oauth-start

Input

There are no input arguments for this command.

Context Output

There is no context output for this command.

Command example

!confluence-cloud-oauth-start

confluence-cloud-oauth-complete


Completes the OAuth 2.0 authentication flow by exchanging the authorization code for access and refresh tokens.

Base Command

confluence-cloud-oauth-complete

Input

Argument Name Description Required
code The authorization code received from the OAuth callback URL after user authorization. Required

Context Output

There is no context output for this command.

Command example

!confluence-cloud-oauth-complete code=<authorization_code>

confluence-cloud-oauth-test


Tests the OAuth 2.0 authentication by verifying the current access token is valid.

Base Command

confluence-cloud-oauth-test

Input

There are no input arguments for this command.

Context Output

There is no context output for this command.

Command example

!confluence-cloud-oauth-test

confluence-cloud-get-events


Retrieves a list of events from the Atlassian Confluence Cloud instance. Use this command for development and debugging only, as it may produce duplicate events, exceed API rate limits, or disrupt the fetch mechanism.

Base Command

confluence-cloud-get-events

Input

Argument Name Description Required
should_push_events Set this argument to True in order to create events, otherwise the command will only display them. Possible values are: true, false. Default is false. Optional
start_date Filters the results to the records on or after the start date. The start date must be specified as epoch time in milliseconds. Optional
limit The maximum number of records to return per page. Note, this may be restricted by fixed system limits. Optional

Context Output

Path Type Description
ConfluenceCloud.Event.author.type String The type of author who created this event.
ConfluenceCloud.Event.author.displayName String The display name of the author who created this event.
ConfluenceCloud.Event.author.operations String Nullable. Author’s operations.
ConfluenceCloud.Event.author.username String Username of the author of this event.
ConfluenceCloud.Event.author.userKey String User key of the author of this event.
ConfluenceCloud.Event.author.accountId String Account ID of the author of this event.
ConfluenceCloud.Event.author.accountType String Type of account of the author of this event.
ConfluenceCloud.Event.author.externalCollaborator Boolean Deprecated. Is the author of this event an external collaborator.
ConfluenceCloud.Event.author.isExternalCollaborator Boolean Deprecated. Is the author of this event an external collaborator.
ConfluenceCloud.Event.author.publicName String The public name of the author of this event.
ConfluenceCloud.Event.remoteAddress String The remote address from which the event was performed.
ConfluenceCloud.Event.creationDate Number The creation date-time of the audit record, as a timestamp.
ConfluenceCloud.Event.summary Strings Summary of the audit.
ConfluenceCloud.Event.description String Description of the audit.
ConfluenceCloud.Event.category String Category of the event.
ConfluenceCloud.Event.sysAdmin Boolean Was the event created by a system administrator.
ConfluenceCloud.Event.superAdmin Boolean Was the event created by a super administrator.
ConfluenceCloud.Event.affectedObject.name String Name of the object affected by the event.
ConfluenceCloud.Event.affectedObject.objectType String Type of the object affected by the event.
ConfluenceCloud.Event.changedValues.name String Name of the changed value.
ConfluenceCloud.Event.changedValues.oldValue String The old value before the change the event describes.
ConfluenceCloud.Event.changedValues.hiddenOldValue String The old hidden value before the change the event describes.
ConfluenceCloud.Event.changedValues.newValue String The new value after the change the event describes.
ConfluenceCloud.Event.changedValues.hiddenNewValue String The new hidden value after the change the event describes.
ConfluenceCloud.Event.associatedObjects.name String Name of the associated object.
ConfluenceCloud.Event.associatedObjects.objectType String The type of the associated object.

confluence-cloud-blogpost-create


Creates a new blog post in Confluence Cloud (REST API v2).

Base Command

confluence-cloud-blogpost-create

Input

Argument Name Description Required
space_id The ID of the space where the blog post is created. Retrieve using the confluence-cloud-space-listv2 command. Required
title The title of the blog post. Required
status The status of the blog post to be created. Possible values are: current, draft. Default is current. Optional
body_value The content body value of the blog post. Required
body_representation The content format type of the body value. Possible values are: storage, atlas_doc_format, wiki. Default is storage. Optional

Context Output

Path Type Description
ConfluenceCloud.Blogpost.id String The ID of the blog post.
ConfluenceCloud.Blogpost.status String The status of the blog post.
ConfluenceCloud.Blogpost.title String The title of the blog post.
ConfluenceCloud.Blogpost.spaceId String The ID of the space the blog post belongs to.
ConfluenceCloud.Blogpost.authorId String The account ID of the blog post author.
ConfluenceCloud.Blogpost.createdAt Date Date and time, in ISO 8601 format, when the blog post was created (e.g., 2024-01-15T12:34:56Z).
ConfluenceCloud.Blogpost.version.number Number The version number of the blog post.

Command example

!confluence-cloud-blogpost-create space_id=98765 title="XSOAR Blogpost" body_value="Blog content" body_representation=storage

Context Example

{
    "ConfluenceCloud": {
        "Blogpost": {
            "id": "12345",
            "status": "current",
            "title": "XSOAR Blogpost",
            "spaceId": "98765",
            "authorId": "5ff2e30b4d2179006ea18449",
            "createdAt": "2024-01-01T10:00:00.000Z",
            "version": {
                "number": 1
            }
        }
    }
}

Human Readable Output

Blogpost

ID Title Status Space Id Author Id Created At Version
12345 XSOAR Blogpost current 98765 5ff2e30b4d2179006ea18449 2024-01-01T10:00:00.000Z 1

confluence-cloud-blogpost-update


Updates an existing blog post in Confluence Cloud (REST API v2).

Base Command

confluence-cloud-blogpost-update

Input

Argument Name Description Required
blogpost_id The ID of the blog post to update. Required
version_number The new version number for the blog post. Must be one greater than the current version. Required
title The title of the blog post. Required
status The status of the blog post. Possible values are: current, draft. Default is current. Optional
body_value The content body value of the blog post. Required
body_representation The content format type of the body value. Possible values are: storage, atlas_doc_format, wiki. Default is storage. Optional
version_message A message describing the update for the version history. Optional

Context Output

Path Type Description
ConfluenceCloud.Blogpost.id String The ID of the blog post.
ConfluenceCloud.Blogpost.status String The status of the blog post.
ConfluenceCloud.Blogpost.title String The title of the blog post.
ConfluenceCloud.Blogpost.spaceId String The ID of the space the blog post belongs to.
ConfluenceCloud.Blogpost.version.number Number The version number of the blog post.

Command example

!confluence-cloud-blogpost-update blogpost_id=12345 version_number=2 title="XSOAR Blogpost Updated" body_value="Updated blog"

Context Example

{
    "ConfluenceCloud": {
        "Blogpost": {
            "id": "12345",
            "status": "current",
            "title": "XSOAR Blogpost Updated",
            "spaceId": "98765",
            "version": {
                "number": 2
            }
        }
    }
}

Human Readable Output

Blogpost

ID Title Status Space Id Version
12345 XSOAR Blogpost Updated current 98765 2

confluence-cloud-footer-comment-create


Creates a footer comment in Confluence Cloud (REST API v2).

Base Command

confluence-cloud-footer-comment-create

Input

Argument Name Description Required
body_value The content body value of the comment. Required
body_representation The content format type of the body value. Possible values are: storage, atlas_doc_format. Default is storage. Optional
page_id The ID of the page to attach the comment to. One of page_id, blogpost_id, parent_comment_id, attachment_id, or custom_content_id is required. Optional
blogpost_id The ID of the blog post to attach the comment to. Optional
parent_comment_id The ID of the parent comment to reply to. Optional
attachment_id The ID of the attachment to attach the comment to. Optional
custom_content_id The ID of the custom content to attach the comment to. Optional

Context Output

Path Type Description
ConfluenceCloud.Comment.id String The ID of the comment.
ConfluenceCloud.Comment.status String The status of the comment.
ConfluenceCloud.Comment.pageId String The ID of the page the comment belongs to.
ConfluenceCloud.Comment.blogPostId String The ID of the blog post the comment belongs to.
ConfluenceCloud.Comment.parentCommentId String The ID of the parent comment.
ConfluenceCloud.Comment.version.number Number The version number of the comment.

Command example

!confluence-cloud-footer-comment-create page_id=12345 body_value="A footer comment"

Context Example

{
    "ConfluenceCloud": {
        "Comment": {
            "id": "98765",
            "status": "current",
            "pageId": "12345",
            "version": {
                "number": 1
            }
        }
    }
}

Human Readable Output

Footer Comment

ID Status Page Id Version
98765 current 12345 1

confluence-cloud-page-update


Updates an existing page in Confluence Cloud (REST API v2).

Base Command

confluence-cloud-page-update

Input

Argument Name Description Required
page_id The ID of the page to update. Required
version_number The new version number for the page. Must be one greater than the current version. Required
title The title of the page. Required
status The status of the page. Possible values are: current, draft. Default is current. Required
body_value The content body value of the page. Required
body_representation The content format type of the body value. Possible values are: storage, atlas_doc_format, wiki. Default is storage. Optional
space_id The ID of the space to move the page to. Optional
version_message A message describing the update for the version history. Optional

Context Output

Path Type Description
ConfluenceCloud.Page.id String The ID of the page.
ConfluenceCloud.Page.status String The status of the page.
ConfluenceCloud.Page.title String The title of the page.
ConfluenceCloud.Page.spaceId String The ID of the space the page belongs to.
ConfluenceCloud.Page.version.number Number The version number of the page.

Command example

!confluence-cloud-page-update page_id=12345 version_number=2 title="XSOAR Page Updated" body_value="Updated content"

Context Example

{
    "ConfluenceCloud": {
        "Page": {
            "id": "12345",
            "status": "current",
            "title": "XSOAR Page Updated",
            "spaceId": "98765",
            "version": {
                "number": 2
            }
        }
    }
}

Human Readable Output

Page

ID Title Status Space Id Version
12345 XSOAR Page Updated current 98765 2

confluence-cloud-space-createv2


Creates a new space in Confluence Cloud (REST API v2).

Base Command

confluence-cloud-space-createv2

Input

Argument Name Description Required
name The name of the new space. The maximum length is 200 characters. Required
key The key for the new space. It can contain any alphanumeric character (a-z, 0-9). The maximum length is 255 characters. Required
description_value The description text of the new space. Optional
description_format The format of the space description. Possible values are: plain, view. Default is plain. Optional
role_assignments A JSON array of role assignments granting access to principals. For example: [{“principal”: {“type”: “user”, “id”: “<accountId>”}, “roleId”: “<roleId>”}]. Optional

Context Output

Path Type Description
ConfluenceCloud.Space.id String The ID of the space.
ConfluenceCloud.Space.key String The key of the space.
ConfluenceCloud.Space.name String The name of the space.
ConfluenceCloud.Space.type String The type of the space.
ConfluenceCloud.Space.status String The status of the space.

Command example

!confluence-cloud-space-createv2 name="Engineering" key="ENG"

Context Example

{
    "ConfluenceCloud": {
        "Space": {
            "id": "98765",
            "key": "ENG",
            "name": "Engineering",
            "status": "current",
            "type": "global"
        }
    }
}

Human Readable Output

Space

Id Key Name Type Status
98765 ENG Engineering global current

confluence-cloud-page-create


Creates a new page in Confluence Cloud (REST API v2).

Base Command

confluence-cloud-page-create

Input

Argument Name Description Required
space_id The ID of the space where the page is created. Retrieve using the confluence-cloud-space-listv2 command. Required
title The title of the page. Required
status The status of the page to be created. Possible values are: current, draft. Default is current. Optional
body_value The content body value of the page. Required
body_representation The content format type of the body value. Possible values are: storage, atlas_doc_format, wiki. Default is storage. Optional
parent_id The ID of the parent page under which the new page is created. Optional

Context Output

Path Type Description
ConfluenceCloud.Page.id String The ID of the page.
ConfluenceCloud.Page.status String The status of the page.
ConfluenceCloud.Page.title String The title of the page.
ConfluenceCloud.Page.spaceId String The ID of the space the page belongs to.
ConfluenceCloud.Page.parentId String The ID of the parent page.
ConfluenceCloud.Page.authorId String The account ID of the page author.
ConfluenceCloud.Page.createdAt Date Date and time, in ISO 8601 format, when the page was created (e.g., 2024-01-15T12:34:56Z).
ConfluenceCloud.Page.version.number Number The version number of the page.

Command example

!confluence-cloud-page-create space_id=98765 title="Getting Started" body_value="Welcome to the team"

Context Example

{
    "ConfluenceCloud": {
        "Page": {
            "authorId": "5ff2e30b4d2179006ea18449",
            "createdAt": "2024-01-15T12:34:56Z",
            "id": "12345",
            "spaceId": "98765",
            "status": "current",
            "title": "Getting Started",
            "version": {
                "number": 1
            }
        }
    }
}

Human Readable Output

Page

Id Title Status Space Id Author Id Created At Version
12345 Getting Started current 98765 5ff2e30b4d2179006ea18449 2024-01-15T12:34:56Z 1

confluence-cloud-space-listv2


Returns a list of spaces from Confluence Cloud (REST API v2).

Base Command

confluence-cloud-space-listv2

Input

Argument Name Description Required
ids A comma-separated list of space IDs to filter by. Optional
keys A comma-separated list of space keys to filter by. Optional
type The type of spaces to filter by. Possible values are: global, personal. Optional
status The status of spaces to filter by. Possible values are: current, archived. Optional
sort Ordering of the results by a particular field. Prefix with ‘-‘ for descending order. Optional
limit The maximum number of records to return. Value must be between 1 and 250. Default is 50. Optional
cursor The cursor to use for fetching the next page of results (from a previous run’s ConfluenceCloud.PageToken output). Optional

Context Output

Path Type Description
ConfluenceCloud.Space.id String The ID of the space.
ConfluenceCloud.Space.key String The key of the space.
ConfluenceCloud.Space.name String The name of the space.
ConfluenceCloud.Space.type String The type of the space.
ConfluenceCloud.Space.status String The status of the space.
ConfluenceCloud.PageToken.Content.next_page_token String The cursor to use for fetching the next page of results.
ConfluenceCloud.PageToken.Content.name String The name of the command that produced the page token.

Command example

!confluence-cloud-space-listv2 limit=2

Context Example

{
    "ConfluenceCloud": {
        "Space": [
            {
                "id": "98765",
                "key": "ENG",
                "name": "Engineering",
                "status": "current",
                "type": "global"
            },
            {
                "id": "98766",
                "key": "MKT",
                "name": "Marketing",
                "status": "current",
                "type": "global"
            }
        ]
    }
}

Human Readable Output

Space(s)

Id Key Name Type Status
98765 ENG Engineering global current
98766 MKT Marketing global current

confluence-cloud-blogpost-delete


Deletes a blog post in Confluence Cloud (REST API v2).

Base Command

confluence-cloud-blogpost-delete

Input

Argument Name Description Required
blogpost_id The ID of the blog post to delete. Required
purge Whether to permanently purge the blog post from the trash. Requires the blog post to already be in the trash. Possible values are: true, false. Default is false. Optional

Context Output

There is no context output for this command.

Command example

!confluence-cloud-blogpost-delete blogpost_id=12345

Human Readable Output

Blogpost with ID “12345” was deleted successfully.

confluence-cloud-page-list


Returns a list of pages from Confluence Cloud (REST API v2).

Base Command

confluence-cloud-page-list

Input

Argument Name Description Required
id A comma-separated list of page IDs to filter by. Optional
space_id A comma-separated list of space IDs to filter by. Optional
status The status of pages to filter by. Possible values are: current, archived, deleted, trashed. Optional
title The title of pages to filter by. Optional
subtype The subtype of pages to filter by. Possible values are: page, live. Optional
sort Ordering of the results by a particular field. Prefix with ‘-‘ for descending order. Optional
limit The maximum number of records to return. Value must be between 1 and 250. Default is 50. Optional
cursor The cursor to use for fetching the next page of results (from a previous run’s ConfluenceCloud.PageToken output). Optional

Context Output

Path Type Description
ConfluenceCloud.Page.id String The ID of the page.
ConfluenceCloud.Page.status String The status of the page.
ConfluenceCloud.Page.title String The title of the page.
ConfluenceCloud.Page.spaceId String The ID of the space the page belongs to.
ConfluenceCloud.Page.authorId String The account ID of the page author.
ConfluenceCloud.Page.createdAt Date Date and time, in ISO 8601 format, when the page was created (e.g., 2024-01-15T12:34:56Z).
ConfluenceCloud.PageToken.Content.next_page_token String The cursor to use for fetching the next page of results.
ConfluenceCloud.PageToken.Content.name String The name of the command that produced the page token.

Command example

!confluence-cloud-page-list limit=2

Context Example

{
    "ConfluenceCloud": {
        "Page": [
            {
                "authorId": "5ff2e30b4d2179006ea18449",
                "createdAt": "2024-01-15T12:34:56Z",
                "id": "12345",
                "spaceId": "98765",
                "status": "current",
                "title": "Getting Started"
            },
            {
                "authorId": "5ff2e30b4d2179006ea18449",
                "createdAt": "2024-01-14T09:10:11Z",
                "id": "12346",
                "spaceId": "98765",
                "status": "current",
                "title": "Onboarding Guide"
            }
        ]
    }
}

Human Readable Output

Page(s)

Id Title Status Space Id Author Id Created At
12345 Getting Started current 98765 5ff2e30b4d2179006ea18449 2024-01-15T12:34:56Z
12346 Onboarding Guide current 98765 5ff2e30b4d2179006ea18449 2024-01-14T09:10:11Z

confluence-cloud-blogpost-list


Returns a list of blog posts from Confluence Cloud (REST API v2).

Base Command

confluence-cloud-blogpost-list

Input

Argument Name Description Required
id A comma-separated list of blog post IDs to filter by. Optional
space_id A comma-separated list of space IDs to filter by. Optional
status The status of blog posts to filter by. Possible values are: current, deleted, trashed. Optional
title The title of blog posts to filter by. Optional
sort Ordering of the results by a particular field. Prefix with ‘-‘ for descending order. Optional
limit The maximum number of records to return. Value must be between 1 and 250. Default is 50. Optional
cursor The cursor to use for fetching the next page of results (from a previous run’s ConfluenceCloud.PageToken output). Optional

Context Output

Path Type Description
ConfluenceCloud.Blogpost.id String The ID of the blog post.
ConfluenceCloud.Blogpost.status String The status of the blog post.
ConfluenceCloud.Blogpost.title String The title of the blog post.
ConfluenceCloud.Blogpost.spaceId String The ID of the space the blog post belongs to.
ConfluenceCloud.Blogpost.authorId String The account ID of the blog post author.
ConfluenceCloud.Blogpost.createdAt Date Date and time, in ISO 8601 format, when the blog post was created (e.g., 2024-01-15T12:34:56Z).
ConfluenceCloud.PageToken.Content.next_page_token String The cursor to use for fetching the next page of results.
ConfluenceCloud.PageToken.Content.name String The name of the command that produced the page token.

Command example

!confluence-cloud-blogpost-list limit=2

Context Example

{
    "ConfluenceCloud": {
        "Blogpost": [
            {
                "authorId": "5ff2e30b4d2179006ea18449",
                "createdAt": "2024-01-15T12:34:56Z",
                "id": "12345",
                "spaceId": "98765",
                "status": "current",
                "title": "Quarterly Update"
            },
            {
                "authorId": "5ff2e30b4d2179006ea18449",
                "createdAt": "2024-01-14T09:10:11Z",
                "id": "12346",
                "spaceId": "98765",
                "status": "current",
                "title": "Release Announcement"
            }
        ]
    }
}

Human Readable Output

Blogpost(s)

Id Title Status Space Id Author Id Created At
12345 Quarterly Update current 98765 5ff2e30b4d2179006ea18449 2024-01-15T12:34:56Z
12346 Release Announcement current 98765 5ff2e30b4d2179006ea18449 2024-01-14T09:10:11Z

confluence-cloud-page-delete


Deletes a page in Confluence Cloud (REST API v2).

Base Command

confluence-cloud-page-delete

Input

Argument Name Description Required
page_id The ID of the page to delete. Required
purge Whether to permanently purge the page from the trash. Requires the page to already be in the trash. Possible values are: true, false. Default is false. Optional

Context Output

There is no context output for this command.

Command example

!confluence-cloud-page-delete page_id=12345

Human Readable Output

Page with ID “12345” was deleted successfully.

<~PLATFORM>

License Requirements

The following configuration parameters require the Cortex XSIAM license:

  • Fetch Events

</~PLATFORM>

Configuration parameters

  • url — Site Name (e.g., https://${site-name}.atlassian.net) (required)
  • auth_method — Authentication Method
  • username — Email
  • cloud_id — Cloud ID
  • callback_url — Callback URL
  • client_credentials — Client ID
  • proxy — Use system proxy settings
  • insecure — Trust any certificate (not secure)
  • eventFetchInterval — Events Fetch Interval
  • max_events_per_fetch — Max number of events per fetch
  • isFetchEvents — Fetch Events

Commands (27)

  • confluence-cloud-blogpost-create

    Creates a new blog post in Confluence Cloud (REST API v2).

  • confluence-cloud-blogpost-delete

    Deletes a blog post in Confluence Cloud (REST API v2).

  • confluence-cloud-blogpost-list

    Returns a list of blog posts from Confluence Cloud (REST API v2).

  • confluence-cloud-blogpost-update

    Updates an existing blog post in Confluence Cloud (REST API v2).

  • confluence-cloud-comment-create Deprecated

    Deprecated. Use confluence-cloud-footer-comment-create instead. Creates a comment for the given content. Note: To view the expansion of the content properties, execute the confluence-cloud-content-list and confluence-cloud-content-search commands.

  • confluence-cloud-content-create Deprecated

    Deprecated. Use confluence-cloud-page-create or confluence-cloud-blogpost-create instead. Creates a page or blogpost for a given space. Note: To view the expansion of content properties, execute the confluence-cloud-content-list and confluence-cloud-content-search commands.

  • confluence-cloud-content-delete Deprecated

    Deprecated. Use confluence-cloud-page-delete or confluence-cloud-blogpost-delete instead. Delete the content depending on the content's type and status. Note: If the content's type is page or blogpost, it should be moved to trash before deleting permanently.

  • confluence-cloud-content-get Deprecated

    Deprecated. Use confluence-cloud-page-list or confluence-cloud-blogpost-list instead. Retrieves a Content Item by its Content ID.

  • confluence-cloud-content-list Deprecated

    Deprecated. Use confluence-cloud-page-list or confluence-cloud-blogpost-list instead. Returns the list of content of Confluence.

  • confluence-cloud-content-search

    Retrieves a list of content using the Confluence Query Language (CQL). For more information on CQL, see: https://developer.atlassian.com/cloud/confluence/advanced-searching-using-cql/.

  • confluence-cloud-content-update Deprecated

    Deprecated. Use confluence-cloud-page-update or confluence-cloud-blogpost-update instead. Update the existing content with new content. Note: Updating draft content is currently not supported.

  • confluence-cloud-footer-comment-create

    Creates a footer comment in Confluence Cloud (REST API v2).

  • confluence-cloud-get-events

    Retrieves a list of events from the Atlassian Confluence Cloud instance. Use this command for development and debugging only, as it may produce duplicate events, exceed API rate limits, or disrupt the fetch mechanism.

  • confluence-cloud-group-list

    Returns all user groups.

  • confluence-cloud-oauth-complete

    Completes the OAuth 2.0 authentication flow by exchanging the authorization code for access and refresh tokens.

  • confluence-cloud-oauth-start

    Starts the OAuth 2.0 authentication flow. Returns an authorization URL that the user must visit to authorize the integration.

  • confluence-cloud-oauth-test

    Tests the OAuth 2.0 authentication by verifying the current access token is valid.

  • confluence-cloud-page-create

    Creates a new page in Confluence Cloud (REST API v2).

  • confluence-cloud-page-delete

    Deletes a page in Confluence Cloud (REST API v2).

  • confluence-cloud-page-list

    Returns a list of pages from Confluence Cloud (REST API v2).

  • confluence-cloud-page-update

    Updates an existing page in Confluence Cloud (REST API v2).

  • confluence-cloud-space-create

    Creates a new space. Note: If no permissions are specified, the default space permissions defined by the Confluence cloud account admin will be used.

  • confluence-cloud-space-createv2

    Creates a new space in Confluence Cloud (REST API v2).

  • confluence-cloud-space-list Deprecated

    Deprecated. Use confluence-cloud-space-listv2 instead. Returns a list of all Confluence spaces.

  • confluence-cloud-space-listv2

    Returns a list of spaces from Confluence Cloud (REST API v2).

  • confluence-cloud-user-list

    Returns a list of users.

  • get-file-content

    Retrieves content from a Confluence page by its URL and returns it in a generic unified format under the FileContent context key. The command automatically extracts the content ID from the URL.

import json
import re
import urllib.parse
from collections.abc import Callable
from typing import Final

import demistomock as demisto  # noqa: F401
import requests
import urllib3
from CommonServerPython import *  # noqa: F401
from markdownify import markdownify

MAX_FILE_SIZE = 5 * 1024 * 1024  # 5MB

from CommonServerUserPython import *  # noqa

# Import AtlassianApiModule for OAuth support
from AtlassianApiModule import *  # type: ignore[import,assignment] # noqa: F401

# Disable insecure warnings
urllib3.disable_warnings()  # pylint: disable=no-member

""" CONSTANTS """

DATE_FORMAT = "%Y-%m-%dT%H:%M:%SZ"  # ISO8601 format with UTC, default in XSOAR
LOGGING_INTEGRATION_NAME = "[Atlassian Confluence Cloud]"
HTTP_ERROR = {
    401: "An error occurred while validating the credentials, please check the username or password.",
    404: "The resource cannot be found.",
    500: "The server encountered an internal error for Atlassian Confluence Cloud and was unable to complete your request.",
}
URL_SUFFIX = {
    "CONTENT_SEARCH": "/wiki/rest/api/content/search",
    "GROUP": "/wiki/rest/api/group",
    "CONTENT": "/wiki/rest/api/content",
    "USER": "/wiki/rest/api/search/user?cql=type=user",
    "SPACE": "/wiki/rest/api/space",
    "PRIVATE_SPACE": "/wiki/rest/api/space/_private",
    "EVENTS": "/wiki/rest/api/audit/",
    "BASE": "/wiki",
    "NEXT_LINK_TEMPLATE": "/rest/api/audit/?end_date={}&next=true&limit={}&start={}&startDate={}",
}
# Confluence Cloud REST API v2 (/wiki/api/v2) URL suffixes.
URL_SUFFIX_V2 = {
    "PAGES": "/wiki/api/v2/pages",
    "BLOGPOSTS": "/wiki/api/v2/blogposts",
    "SPACES": "/wiki/api/v2/spaces",
    "FOOTER_COMMENTS": "/wiki/api/v2/footer-comments",
}

MESSAGES = {
    "REQUIRED_URL_FIELD": "Site Name can not be empty.",
    "NO_RECORDS_FOUND": "No {} were found for the given argument(s).",
    "LIMIT": "{} is an invalid value for limit. Limit must be between 0 and int32.",
    "START": "{} is an invalid value for start. Start must be between 0 and int32.",
    "INVALID_ACCESS_TYPE": "Invalid value for access type. Access type parameter must be one of 'user', 'admin', "
    "or 'site-admin' ",
    "REQUIRED_ARGUMENT": "Invalid argument value. {} is a required argument.",
    "INVALID_CONTENT_TYPE": "Invalid value for content type. Content type parameter can be 'page' or 'blogpost' ",
    "HR_DELETE_CONTENT": "Content with Id {} is deleted successfully.",
    "INVALID_STATUS": "Invalid value for status. Status must be one of 'current', 'draft' or 'trashed'.",
    "BAD_REQUEST": "Bad request: An error occurred while fetching the data.",
    "REQUIRED_SORT_KEY": "If 'sort_order' is specified, 'sort_key' is required.",
    "INVALID_STATUS_SEARCH": "Invalid value for status. Status must be one of 'current', 'any', 'archived', 'draft' "
    "or 'trashed'.",
    "INVALID_PERMISSION": "If the 'permission_account_id' or 'permission_group_name' arguments are given, "
    "the 'permission_operations' argument must also be given.",
    "INVALID_PERMISSIONS_OPERATION": "If the 'permission_operations' argument is given, "
    "'permission_account_id' or 'permission_group_name' argument must also be given.",
    "PERMISSION_FORMAT": "Please provide the permission in the valid JSON format. "
    "Format accepted - 'operation1:targetType1,operation2:targetType2'",
    "ADVANCE_PERMISSION_FORMAT": "Please provide the 'advanced_permissions' in the valid JSON format. ",
    "INVALID_ROLE_ASSIGNMENTS_V2": "Please provide the 'role_assignments' argument in valid JSON format.",
    "INVALID_SPACE_STATUS": "Invalid value for status. Status must be one of 'current' or 'archived'.",
    "INVALID_CONTENT_TYPE_UPDATE_CONTENT": "Invalid value for content type. Content type parameter can be 'page', "
    "'blogpost', 'comment' or 'attachment'.",
    "INVALID_BODY_REPRESENTATION": "Invalid value for body_representation. Body representation must be one of "
    "'editor', 'editor2' or 'storage'.",
    "INVALID_DELETION_TYPE": "Invalid value for deletion_type. Deletion type must be one of 'move to trash', "
    "'permanent delete' or 'permanent delete draft'.",
    "INVALID_TITLE_LENGTH": "Title cannot be longer than 255 characters.",
    "INVALID_SPACE_NAME_LENGTH": "Space name cannot be longer than 200 characters.",
    "INVALID_SPACE_KEY": "Space Key cannot be longer than 255 characters and should contain alphanumeric characters only.",
    "PRIVATE_SPACE_PERMISSION": "Permission can not be granted for a private space.",
    "MISSING_CONTENT_ID": "Argument 'content_id' is required for this command.",
    "INVALID_BODY_REPRESENTATION_V2": "Invalid value for body_representation. Body representation must be one of "
    "'storage', 'atlas_doc_format' or 'wiki'.",
    "INVALID_COMMENT_BODY_REPRESENTATION_V2": "Invalid value for body_representation. Body representation must be "
    "one of 'storage' or 'atlas_doc_format'.",
    "INVALID_BODY_FORMAT_V2": "Invalid value for body_format. Body format must be one of 'storage', "
    "'atlas_doc_format' or 'view'.",
    "INVALID_STATUS_CREATE_V2": "Invalid value for status. Status must be one of 'current' or 'draft'.",
    "INVALID_STATUS_UPDATE_V2": "Invalid value for status. Status must be one of 'current' or 'draft'.",
    "INVALID_PAGE_STATUS_LIST_V2": "Invalid value for status. Status must be one of 'current', 'archived', "
    "'deleted' or 'trashed'.",
    "INVALID_PAGE_STATUS_SINGLE_V2": "Invalid value for status. Status must be one of 'current', 'archived', "
    "'deleted', 'trashed', 'historical' or 'draft'.",
    "INVALID_BLOGPOST_STATUS_LIST_V2": "Invalid value for status. Status must be one of 'current', 'deleted' " "or 'trashed'.",
    "INVALID_BLOGPOST_STATUS_SINGLE_V2": "Invalid value for status. Status must be one of 'current', 'deleted', "
    "'trashed', 'historical' or 'draft'.",
    "INVALID_SUBTYPE_FILTER_V2": "Invalid value for subtype. Subtype must be one of 'page' or 'live'.",
    "MUTUALLY_EXCLUSIVE_PARENT_ROOT_LEVEL": "Arguments 'parent_id' and 'root_level' are mutually exclusive.",
    "MISSING_COMMENT_CONTAINER_V2": "One of the following arguments is required: 'page_id', 'blogpost_id', "
    "'parent_comment_id', 'attachment_id' or 'custom_content_id'.",
    "INVALID_SPACE_TYPE_V2": "Invalid value for type. Type must be one of 'global' or 'personal'.",
    "INVALID_SPACE_STATUS_V2": "Invalid value for status. Status must be one of 'current' or 'archived'.",
    "INVALID_DESCRIPTION_FORMAT_V2": "Invalid value for description_format. Description format must be one of "
    "'plain' or 'view'.",
    "INVALID_LIMIT_V2": "{} is an invalid value for limit. Limit must be a positive integer (greater than 0).",
    "HR_PAGE_CREATE": "Page with ID {} was created successfully.",
    "HR_PAGE_UPDATE": "Page with ID {} was updated successfully.",
    "HR_PAGE_DELETE": "Page with ID {} was deleted successfully.",
    "HR_BLOGPOST_CREATE": "Blog post with ID {} was created successfully.",
    "HR_BLOGPOST_UPDATE": "Blog post with ID {} was updated successfully.",
    "HR_BLOGPOST_DELETE": "Blog post with ID {} was deleted successfully.",
    "HR_FOOTER_COMMENT_CREATE": "Footer comment with ID {} was created successfully.",
    "HR_SPACE_CREATE_V2": "Space with ID {} was created successfully.",
}
OUTPUT_PREFIX = {
    "GROUP": "ConfluenceCloud.Group",
    "USER": "ConfluenceCloud.User",
    "CONTENT": "ConfluenceCloud.Content",
    "COMMENT": "ConfluenceCloud.Comment",
    "SPACE": "ConfluenceCloud.Space",
    "PAGETOKEN": "ConfluenceCloud.PageToken.Content",
    "EVENT": "ConfluenceCloud.Event",
    "PAGE": "ConfluenceCloud.Page",
    "BLOGPOST": "ConfluenceCloud.Blogpost",
    "FILE_CONTENT": "FileContent",
}

CONFLUENCE_URL_PATTERNS = [
    # Pattern: /wiki/spaces/<space>/pages/<pageId>/<title>
    re.compile(r"/wiki/spaces/[^/]+/pages/(\d+)"),
    # Pattern: /wiki/rest/api/content/<contentId>
    re.compile(r"/wiki/rest/api/content/(\d+)"),
    # Pattern: /pages/viewpage.action?pageId=<pageId>
    re.compile(r"pageId=(\d+)"),
    # Pattern: /x/<tinyId> (tiny links) - not directly resolvable to content_id
]
DEFAULT_LIMIT = "50"
DEFAULT_START = "0"
LEGAL_ACCESS_TYPES = ["user", "site-admin", "admin"]
LEGAL_CONTENT_STATUS = ["current", "trashed", "draft", "archived", "any"]
LEGAL_CONTENT_TYPES = ["page", "blogpost"]
LEGAL_CONTENT_TYPE_UPDATE_COMMAND = ["page", "blogpost", "comment", "attachment"]
DEFAULT_EXPANDED_FIELD_CONTENT = "childTypes.all,space,version,history,ancestors,container,body"
DEFAULT_EXPANDED_FIELD_SPACE = "history"
LEGAL_SPACE_STATUS = ["current", "archived"]
LEGAL_BODY_REPRESENTATION = ["editor", "editor2", "storage"]
LEGAL_DELETION_TYPES = {"move to trash": "current", "permanent delete": "trashed", "permanent delete draft": "draft"}
VENDOR = "Atlassian"
PRODUCT = "Confluence"
AUDIT_FETCH_PAGE_SIZE = 1000
DEFAULT_GET_EVENTS_LIMIT = "50"
ONE_MINUTE_IN_MILL_SECONDS = 60000
ONE_WEEK_IN_MILL_SECONDS = 604800000
_last_run_cache = None

# --- Confluence Cloud REST API v2 constants ---
LEGAL_BODY_REPRESENTATION_V2 = ["storage", "atlas_doc_format", "wiki"]
LEGAL_COMMENT_BODY_REPRESENTATION_V2 = ["storage", "atlas_doc_format"]
LEGAL_BODY_FORMAT_V2 = ["storage", "atlas_doc_format", "view"]
LEGAL_STATUS_CREATE_V2 = ["current", "draft"]
LEGAL_STATUS_UPDATE_V2 = ["current", "draft"]
LEGAL_PAGE_SUBTYPE_FILTER_V2 = ["page", "live"]
LEGAL_PAGE_LIST_STATUS_V2 = ["current", "archived", "deleted", "trashed"]
LEGAL_PAGE_SINGLE_STATUS_V2 = [*LEGAL_PAGE_LIST_STATUS_V2, "historical", "draft"]
LEGAL_BLOGPOST_LIST_STATUS_V2 = ["current", "deleted", "trashed"]
LEGAL_BLOGPOST_SINGLE_STATUS_V2 = [*LEGAL_BLOGPOST_LIST_STATUS_V2, "historical", "draft"]
LEGAL_SPACE_TYPE_V2 = ["global", "personal"]
LEGAL_SPACE_STATUS_V2 = ["current", "archived"]
LEGAL_DESCRIPTION_FORMAT_V2 = ["plain", "view"]
DEFAULT_LIMIT_V2 = 50
MIN_LIMIT_V2 = 1
MAX_LIMIT_V2 = 250

# Configuration shared between the page and blogpost v2 commands (they are near-identical
# typed resources split from the polymorphic v1 'content' object).
CONTENT_V2_CONFIG: dict[str, dict[str, Any]] = {
    "page": {
        "url_suffix": URL_SUFFIX_V2["PAGES"],
        "output_prefix": OUTPUT_PREFIX["PAGE"],
        "id_arg": "page_id",
        "list_status": LEGAL_PAGE_LIST_STATUS_V2,
        "single_status": LEGAL_PAGE_SINGLE_STATUS_V2,
        "list_status_message": "INVALID_PAGE_STATUS_LIST_V2",
        "single_status_message": "INVALID_PAGE_STATUS_SINGLE_V2",
        "supports_subtype_filter": True,
        "supports_direct_children": True,
        "label": "Page",
    },
    "blogpost": {
        "url_suffix": URL_SUFFIX_V2["BLOGPOSTS"],
        "output_prefix": OUTPUT_PREFIX["BLOGPOST"],
        "id_arg": "blogpost_id",
        "list_status": LEGAL_BLOGPOST_LIST_STATUS_V2,
        "single_status": LEGAL_BLOGPOST_SINGLE_STATUS_V2,
        "list_status_message": "INVALID_BLOGPOST_STATUS_LIST_V2",
        "single_status_message": "INVALID_BLOGPOST_STATUS_SINGLE_V2",
        "supports_subtype_filter": False,
        "supports_direct_children": False,
        "label": "Blog post",
    },
}
""" CLIENT CLASS """


class Client(BaseClient):
    """Client class to interact with the service API

    This Client implements API calls, and does not contain any XSOAR logic.
    Should only do requests and return data.
    It inherits from BaseClient defined in CommonServer Python.
    Most calls use _http_request() that handles proxy, SSL verification, etc.
    For this  implementation, no special attributes defined
    """

    def http_request(self, *args, **kwargs) -> requests.Response:
        """
        Function to make http requests using inbuilt _http_request() method.
        """

        kwargs["ok_codes"] = (200, 201, 204)
        kwargs["error_handler"] = self.exception_handler
        kwargs["resp_type"] = "response"
        return super()._http_request(*args, **kwargs)

    @staticmethod
    def exception_handler(response: requests.models.Response):
        """
        Handle error in the response and display error message based on status code.

        :type response: ``requests.models.Response``
        :param response: response from API.

        :raises: raise DemistoException based on status code of response.
        """
        err_msg = ""
        if response.status_code in HTTP_ERROR:
            err_msg = HTTP_ERROR[response.status_code]
        elif response.status_code > 500:
            err_msg = HTTP_ERROR[500]
        elif response.status_code not in HTTP_ERROR:
            try:
                # Try to parse json error response
                error_entry = response.json()
                demisto.error(f"{LOGGING_INTEGRATION_NAME} {error_entry}")
                errors = error_entry.get("data", {}).get("errors", [])
                if errors:
                    err_msg = get_error_message(errors)
                elif response.status_code == 400:
                    err_msg = MESSAGES["BAD_REQUEST"]
                else:
                    err_msg = error_entry.get("message", "")
            except ValueError:
                err_msg = f"{response.text}"

        raise DemistoException(err_msg)

    def search_events(self, limit: int, start_date: str = None, end_date: str = None, next_link: str = None) -> dict:
        return super()._http_request(
            method="GET",
            url_suffix=URL_SUFFIX["BASE"] + next_link if next_link else URL_SUFFIX["EVENTS"],
            params=None if next_link else {"limit": limit, "startDate": start_date, "end_date": end_date},
        )


""" HELPER FUNCTIONS """


def run_fetch_mechanism(client: Client, fetch_limit: int, next_link: str, start_date: int, end_date: int):
    all_events: List[Dict[str, Any]] = []
    started_new_query = False
    while len(all_events) < fetch_limit and (next_link or not started_new_query):
        page_size = min(AUDIT_FETCH_PAGE_SIZE, fetch_limit - len(all_events))

        started_new_query = started_new_query or not next_link
        response = run_get_events_query(client, next_link, start_date, end_date, page_size)

        events = response["results"]
        next_link = response["_links"].get("next", None)
        demisto.debug(f"Fetched {len(events)} events, total_length: {len(all_events)}, next_link: {next_link}")

        all_events.extend(events)
    return all_events, started_new_query, next_link


def run_get_events_query(client: Client, next_link, start_date, end_date, page_size: int) -> dict[str, Any]:
    if not next_link:
        demisto.debug(f"searching events with start date: {start_date}, end date: {end_date} and page size: {page_size}")
        response = client.search_events(limit=page_size, start_date=str(start_date), end_date=str(end_date))
        demisto.debug(f'Found {response["size"]} events between {start_date} and {end_date}')

    else:
        demisto.debug(f"searching events with next_link: {next_link} and page size: {AUDIT_FETCH_PAGE_SIZE}")
        response = client.search_events(limit=page_size, next_link=next_link)
        demisto.debug(f'Found {response["size"]} events in the current page')

    return response


def add_time_to_events(events: list[dict]):
    """
    Adds the _time key to the events.
    Args:
        events: List[Dict] - list of events to add the _time key to.
    Returns:
        list: The events with the _time key.
    """
    for event in events:
        create_time = arg_to_datetime(arg=event.get("creationDate"))
        event["_time"] = create_time.strftime(DATE_FORMAT) if create_time else None


def get_error_message(errors):
    err_msg = ""
    for error in errors:
        if error.get("message").get("key"):
            err_msg += f"{error.get('message').get('key')} \n"
        if error.get("message").get("translation"):
            err_msg += f"{error.get('message').get('translation')} \n"
    return err_msg


def strip_args(args: dict):
    """
    Strips argument dictionary values.

    :type args: dict
    :param args: argument dictionary
    """
    for key, value in args.items():
        if isinstance(value, str):
            args[key] = value.strip()


def validate_url(url: str):
    """
    To Validate url parameter.

    :type url: str
    :param url: url to validate.
    """
    if not url:
        raise ValueError(MESSAGES["REQUIRED_URL_FIELD"])


def remove_empty_elements_for_context(src):
    """
     Recursively remove empty lists, empty dicts, empty string or None elements from a dictionary.

    :type src: ``dict``
    :param src: Input dictionary.

    :return: Dictionary with all empty lists,empty string and empty dictionaries removed.
    :rtype: ``dict``
    """

    def empty(x):
        return x is None or x == "" or x == {} or x == []

    if not isinstance(src, dict | list):
        return src
    elif isinstance(src, list):
        return [v for v in (remove_empty_elements_for_context(v) for v in src) if not empty(v)]
    else:
        return {k: v for k, v in ((k, remove_empty_elements_for_context(v)) for k, v in src.items()) if not empty(v)}


def validated_required_args_for_permission(permission_account_id, permission_group_name, permission_operations):
    """
    Raise value-error when null-values or whitespaces are provided for permission arguments.

    :type permission_account_id: ``str``
    :param permission_account_id: Account ID

    :type permission_group_name: ``str``
    :param permission_group_name: Name of the group

    :type permission_operations: ``str``
    :param permission_operations: Permissions to be granted

    :return: None
    """
    if (permission_account_id or permission_group_name) and not permission_operations:
        raise ValueError(MESSAGES["INVALID_PERMISSION"])

    if permission_operations and (not permission_group_name and not permission_account_id):
        raise ValueError(MESSAGES["INVALID_PERMISSIONS_OPERATION"])


def prepare_permission_object(permission_account_id: str, permission_group_name: str, attr: list) -> dict:
    """
    Prepare permission object from the user provided values

    :type permission_account_id: ``str``
    :param permission_account_id: Account ID of the user to whom permission should be granted.

    :type permission_group_name: ``str``
    :param permission_group_name: Group name to whom permission should be granted.

    :type attr: ``List``
    :param attr: Operation and Target Type specified by user

    :rtype: ``Dict``
    :return: Returns permission object
    """
    permission_object = {
        "subjects": {
            "user": {"results": [{"accountId": permission_account_id}]},
            "group": {"results": [{"name": permission_group_name}]},
        },
        "operation": {"operation": attr[0], "targetType": attr[1]},
        "anonymousAccess": False,
        "unlicensedAccess": False,
    }
    return permission_object


def validate_permissions(args: dict[str, Any]) -> list:
    """
     Validates the permission argument provided by user and prepare permission object accordingly

    :type args: ``dict``
    :param args: Input dictionary.

    :return: Permission object.
    :rtype: ``List``
    """
    space_permission = []
    permission_account_id = args.get("permission_account_id", "")
    permission_group_name = args.get("permission_group_name", "")
    permission_operations = args.get("permission_operations", "")

    validated_required_args_for_permission(permission_account_id, permission_group_name, permission_operations)

    if permission_operations:
        # create a list of all the permission provided by user
        permissions = [permission.strip() for permission in permission_operations.split(",") if permission.strip()]
        # separate target_type and operation for the single permission
        for permission in permissions:
            if permission:
                attr = [operation.strip() for operation in permission.split(":") if operation.strip()]
                # if target_type or operation is missing then raise ValueError
                if len(attr) != 2:
                    raise ValueError(MESSAGES["PERMISSION_FORMAT"])
                permission_object = prepare_permission_object(permission_account_id, permission_group_name, attr)
                space_permission.append(permission_object)

    return space_permission


def validate_list_command_args(args: dict[str, str]) -> tuple[Optional[int], Optional[int]]:
    """
    Validate arguments for all list commands, raise ValueError on invalid arguments.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: Parameters to send in request
    :rtype: ``Tuple``
    """

    limit = arg_to_number(args.get("limit", DEFAULT_LIMIT))
    if limit < 0 or limit > 2147483647:  # type:ignore
        raise ValueError(MESSAGES["LIMIT"].format(limit))

    offset = arg_to_number(args.get("offset", DEFAULT_START))
    if offset < 0 or offset > 2147483647:  # type:ignore
        raise ValueError(MESSAGES["START"].format(offset))

    return limit, offset


def validate_list_group_args(args: dict[str, str]):
    """
    Validate arguments for confluence-cloud-group-list command, raise ValueError on invalid arguments.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.
    """

    access_type = args.get("access_type", "").lower()
    if access_type and access_type not in LEGAL_ACCESS_TYPES:
        raise ValueError(MESSAGES["INVALID_ACCESS_TYPE"])

    return access_type


def prepare_group_args(args: dict[str, str]) -> dict[str, str]:
    """
    Prepare params for list group command

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.
    """
    limit, offset = validate_list_command_args(args)
    access_type = validate_list_group_args(args)
    return assign_params(limit=limit, start=offset, accessType=access_type)


def prepare_hr_for_groups(groups: list[dict[str, Any]]) -> str:
    """
    Prepare human-readable for list groups command.

    :type groups: ``List[Dict[str, Any]]``
    :param groups:The group data.

    :rtype: ``str``
    :return: Human readable.
    """
    hr_list = []
    for group in groups:
        hr_record = {"ID": group.get("id", ""), "Name": group.get("name", "")}

        hr_list.append(hr_record)

    return tableToMarkdown("Group(s)", hr_list, ["ID", "Name"], removeNull=True)


def prepare_content_create_params(args) -> dict[str, Any]:
    """
    Prepare json object for content create command

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: Body parameters to send in request
    :rtype: ``Dict[str, Any]``
    """
    body_representation = args.get("body_representation", "")
    params = {
        "title": args["title"],
        "type": args["type"].lower(),
        "space": {"key": args.get("space_key", "")},
        "status": args.get("status", "current"),
        "body": {body_representation: {"value": args.get("body_value", ""), "representation": body_representation}},
        "ancestors": [{"id": args.get("ancestor_id", "")}],
    }

    return remove_empty_elements_for_context(params)


def validate_create_content_args(args: dict[str, str], is_update: bool = False):
    """
    Validate arguments for confluence-cloud-content-create command, raise ValueError on invalid arguments.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

     :type is_update: ``bool``
    :param is_update: Whether command is update content or not.

    :return: None
    :rtype: ``None``
    """

    title = args["title"]
    if not title:
        raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format("title"))
    if len(title) > 255:
        raise ValueError(MESSAGES["INVALID_TITLE_LENGTH"])

    content_type = args["type"].lower()
    if not content_type:
        raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format("type"))
    if not is_update and content_type not in LEGAL_CONTENT_TYPES:
        raise ValueError(MESSAGES["INVALID_CONTENT_TYPE"])
    if is_update and content_type not in LEGAL_CONTENT_TYPE_UPDATE_COMMAND:
        raise ValueError(MESSAGES["INVALID_CONTENT_TYPE_UPDATE_CONTENT"])

    space_key = args.get("space_key", "")
    if not is_update and not space_key:
        raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format("space_key"))

    body_value = args.get("body_value", "")
    body_representation = args.get("body_representation", "")
    if content_type == "comment":
        if body_value and body_representation:
            if body_representation not in LEGAL_BODY_REPRESENTATION:
                raise ValueError(MESSAGES["INVALID_BODY_REPRESENTATION"])
        else:
            raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format("'body_value' and 'body_representation'"))


def prepare_hr_for_content_create(content: dict[str, Any], content_type: str) -> str:
    """
    Prepare human-readable for content create, comment create and content update command.

    :type content: ``Dict[str, Any]``
    :param content:The content data.

    :type content_type: ``str``
    :param content_type: Type of the content.

    :rtype: ``str``
    :return: Human readable.
    """

    hr_record = {
        "ID": content.get("id", ""),
        "Title": f"[{content.get('title', '')}]"
        f"({content.get('_links', {}).get('base', '')}{content.get('_links', {}).get('webui', '')})",
        "Type": content.get("type", ""),
        "Status": content.get("status", ""),
        "Space Name": content.get("space", {}).get("name", ""),
        "Created By": content.get("history", {}).get("createdBy", {}).get("displayName", ""),
        "Created At": content.get("history", {}).get("createdDate", ""),
    }

    return tableToMarkdown(
        f"{content_type}", hr_record, ["ID", "Title", "Type", "Status", "Space Name", "Created By", "Created At"], removeNull=True
    )


def prepare_hr_for_content_search(contents: list, url_prefix: str) -> str:
    """
    Prepare human-readable for content search and content list command.

    :type contents: ``list``
    :param contents: List of content.

    :type url_prefix: ``str``
    :param url_prefix: Url prefix the content.

    :rtype: ``str``
    :return: Human readable.
    """
    hr_list = []
    for content in contents:
        hr_record = {
            "ID": content.get("id", ""),
            "Title": f"[{content.get('title', '')}]({url_prefix}{content.get('_links', {}).get('webui', '')})",
            "Type": content.get("type", ""),
            "Status": content.get("status", ""),
            "Space Name": content.get("space", {}).get("name", ""),
            "Created By": content.get("history", {}).get("createdBy", {}).get("displayName", ""),
            "Created At": content.get("history", {}).get("createdDate", ""),
            "Version": content.get("version", {}).get("number", ""),
        }

        hr_list.append(hr_record)

    hr = tableToMarkdown(
        "Content(s)",
        hr_list,
        ["ID", "Title", "Type", "Status", "Space Name", "Created By", "Created At", "Version"],
        removeNull=True,
    )

    return hr


def validate_delete_content_args(args: dict[str, str]):
    """
    Validate arguments for confluence-cloud-content-delete command, raise ValueError on invalid arguments.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: None
    """
    content_id = args["content_id"]
    if not content_id:
        raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format("content_id"))

    status = args.get("deletion_type", "").lower()
    if status and status not in LEGAL_DELETION_TYPES:
        raise ValueError(MESSAGES["INVALID_DELETION_TYPE"])


def prepare_comment_create_params(args) -> dict[str, Any]:
    """
    Prepare json object for comment create command

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: Body parameters to send in request
    :rtype: ``Dict[str, Any]``
    """
    body_representation = args["body_representation"]
    container_type = args.get("container_type", "")
    params = {
        "type": "comment",
        "status": args.get("status", "current"),
        "container": {"id": args["container_id"], "type": container_type},
        "body": {body_representation: {"value": args["body_value"], "representation": body_representation}},
        "ancestors": [{"id": args.get("ancestor_id", "")}],
    }
    params = remove_empty_elements_for_context(params)
    params["container"]["type"] = container_type
    return params


def validate_comment_args(args: dict[str, str]):
    """
    Validate arguments for confluence-cloud-comment-create command, raise ValueError on invalid arguments.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: None
    """

    body_value = args["body_value"]
    if not body_value:
        raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format("Comment body_value"))

    body_representation = args["body_representation"]
    if not body_representation:
        raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format("body_representation"))
    if body_representation not in LEGAL_BODY_REPRESENTATION:
        raise ValueError(MESSAGES["INVALID_BODY_REPRESENTATION"])

    container_id = args["container_id"]
    if not container_id:
        raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format("container_id"))


def prepare_hr_for_users(users: list[dict[str, Any]]) -> str:
    """
    Prepare human-readable for list users command.

    :type users: ``List[Dict[str, Any]]``
    :param users: The user data.

    :rtype: ``str``
    :return: Human readable.
    """
    hr_list = []
    for user in users:
        hr_record = {
            "Account ID": user["user"].get("accountId", ""),
            "Name": user["user"].get("displayName", ""),
            "User Type": user["user"].get("type", ""),
        }

        hr_list.append(hr_record)

    return tableToMarkdown("User(s)", hr_list, ["Account ID", "Name", "User Type"], removeNull=True)


def prepare_expand_argument(expand: str, default_fields: str) -> str:
    """
    The 'expand' command argument specifies which properties should be expanded.
    In this integration, several of the most significant characteristics are extended by default.
    Other attributes that users want to expand can still be provided.

    This method combines the default expand fields with the expand fields specified by the user.

    :type expand: ``str``
    :param expand: The expand argument passed by the user.

    :type default_fields: ``str``
    :param default_fields: The default fields.

    :return: expand argument value to send in request
    :rtype: ``str``
    """
    default_expand_fields = default_fields.split(",")
    custom_expand_fields = set(expand.split(","))
    expand_fields = ""

    for expand_field in custom_expand_fields:
        if expand_field.strip() not in default_expand_fields:
            expand_fields += f",{expand_field.strip()}"

    return default_fields + expand_fields


def validate_query_argument(args: dict[str, str]):
    """
    Validate query argument of content search command

    :param args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: None
    """
    query = args["query"]
    if not query:
        raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format("query"))


def prepare_search_content_argument(args: dict[str, str]) -> dict[str, Any]:
    """
    Prepare params for confluence-cloud-content-search command.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: Parameters to send in request
    :rtype: ``Dict[str, Any]``
    """
    limit, offset = validate_list_command_args(args)
    validate_query_argument(args)

    params = {
        "cql": args["query"],
        "cursor": args.get("next_page_token"),
        "expand": DEFAULT_EXPANDED_FIELD_CONTENT,
        "limit": limit,
    }

    expand = args.get("expand", "")
    if expand:
        params["expand"] = prepare_expand_argument(expand, DEFAULT_EXPANDED_FIELD_CONTENT)

    content_status = argToList(args.get("content_status", ""))
    params["cqlcontext"] = json.dumps({"contentStatuses": content_status})

    return assign_params(**params)


def prepare_cursor_for_content(response_json: dict[str, str]) -> str:
    """
    Split query string parameters from a link and extract value of parameter 'cursor'.

    :type response_json: ``Dict[str, str]``
    :param response_json: API response.

    :return: Next Page Token(Cursor).
    :rtype: ``str``
    """
    next_cursor = ""
    next_record = response_json.get("_links", {}).get("next", "")  # type:ignore
    if next_record:
        next_cursor_split = next_record.split("?")
        parsed_next_cursor = urllib.parse.parse_qs(next_cursor_split[1])
        next_cursor = parsed_next_cursor.get("cursor", [])[0]

    return next_cursor


def validate_list_content_args(args):
    """
    Validate arguments for confluence_cloud_content_list command, raise ValueError on invalid arguments.
    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: None
    """
    sort_order = args.get("sort_order", "").lower()
    sort_key = args.get("sort_key", "")

    if sort_order and not sort_key:
        raise ValueError(MESSAGES["REQUIRED_SORT_KEY"])
    content_type = args.get("type", "page").lower()

    if content_type not in LEGAL_CONTENT_TYPES:
        raise ValueError(MESSAGES["INVALID_CONTENT_TYPE"])

    status = args.get("status", "").lower()
    if status and status not in LEGAL_CONTENT_STATUS:
        raise ValueError(MESSAGES["INVALID_STATUS_SEARCH"])


def prepare_list_content_argument(args: dict[str, str]) -> dict[str, Any]:
    """
    Prepare params for confluence_cloud_content_list command.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: Parameters to send in request
    :rtype: ``Dict[str, Any]``
    """
    validate_list_content_args(args)
    limit, offset = validate_list_command_args(args)
    params = {"limit": limit, "start": offset, "spaceKey": args.get("space_key", ""), "type": args.get("type", "page").lower()}

    sort_order = args.get("sort_order", "").lower()
    sort_key = args.get("sort_key", "")

    if sort_order and sort_key:
        params["orderby"] = f"{sort_key} {sort_order}"
    elif sort_key:
        params["orderby"] = f"{sort_key}"

    content_creation_date = arg_to_datetime(args.get("creation_date"))
    if content_creation_date:
        params["postingDay"] = content_creation_date.date()  # type: ignore

    params["status"] = args.get("status", "").lower()

    params["expand"] = DEFAULT_EXPANDED_FIELD_CONTENT
    expand = args.get("expand", "")
    if expand:
        params["expand"] = prepare_expand_argument(expand, DEFAULT_EXPANDED_FIELD_CONTENT)

    return assign_params(**params)


def validate_create_space_args(args: dict[str, str]):
    """
    Validate arguments for confluence-cloud-space-create command, raise ValueError on invalid arguments.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: None
    """
    unique_key = args.get("unique_key")
    if not unique_key:
        raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format("unique_key"))
    if len(unique_key) > 255 or not unique_key.isalnum():
        raise ValueError(MESSAGES["INVALID_SPACE_KEY"])

    name = args.get("name")
    if not name:
        raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format("name"))
    if len(name) > 200:
        raise ValueError(MESSAGES["INVALID_SPACE_NAME_LENGTH"])

    is_private_space = argToBoolean(args.get("is_private_space", False))
    if is_private_space and (args.get("advanced_permissions") or args.get("permission_operations")):
        raise ValueError(MESSAGES["PRIVATE_SPACE_PERMISSION"])

    if args.get("advanced_permissions"):
        try:
            json.loads(args["advanced_permissions"])
        except (json.JSONDecodeError, json.decoder.JSONDecodeError, AttributeError):
            raise ValueError(MESSAGES["ADVANCE_PERMISSION_FORMAT"])


def prepare_create_space_args(args: dict[str, str]) -> tuple[dict, Union[bool, str]]:
    """
    Prepare json object for confluence-cloud-space-create command.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: Parameters to send in request
    :rtype: ``Dict[str, Any]``
    """

    is_private_space = argToBoolean(args.get("is_private_space", False))

    if args.get("advanced_permissions"):
        permissions = json.loads(args["advanced_permissions"])
    else:
        permissions = validate_permissions(args)

    params = {
        "key": args["unique_key"],
        "name": args["name"],
        "description": {"plain": {"value": args.get("description", ""), "representation": "plain"}},
        "permissions": permissions,
    }
    params = remove_empty_elements_for_context(params)

    return params, is_private_space


def prepare_hr_for_space_create(space: dict[str, Any]) -> str:
    """
    Prepare human-readable for create space command.

    :type space: ``List[Dict[str, Any]]``
    :param space: The space data.

    :rtype: ``str``
    :return: Human readable.
    """
    hr_record = {
        "ID": space.get("id", ""),
        "Name": f"[{space.get('name', '')}]"
        f"({space.get('_links', {}).get('base', '')}{space.get('_links', {}).get('webui', '')})",
        "Type": space.get("type", ""),
        "Status": space.get("status", ""),
    }

    return tableToMarkdown("Space", hr_record, ["ID", "Name", "Type", "Status"], removeNull=True)


def validate_status_argument(args: dict[str, str]):
    """
    Validates the status argument of confluence-cloud-space-list command, raise ValueError on invalid arguments.
    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: None
    """
    status = args.get("status")
    if status and status.lower() not in LEGAL_SPACE_STATUS:
        raise ValueError(MESSAGES["INVALID_SPACE_STATUS"])


def prepare_list_space_args(args: dict[str, str]) -> dict[str, Any]:
    """
    Prepare params for confluence-cloud-space-list command.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: Parameters to send in request
    :rtype: ``Dict[str, Any]``
    """
    validate_status_argument(args)
    limit, offset = validate_list_command_args(args)
    params = {
        "limit": limit,
        "start": offset,
        "spaceKey": argToList(args.get("space_key")),
        "spaceId": argToList(args.get("space_id")),
        "type": args.get("type"),
        "status": args.get("status"),
    }

    favourite = args.get("favourite", "")
    if favourite:
        favourite = "true" if argToBoolean(favourite) else "false"
        params["favourite"] = favourite

    params["expand"] = DEFAULT_EXPANDED_FIELD_SPACE
    expand = args.get("expand", "")
    if expand:
        params["expand"] = prepare_expand_argument(expand, DEFAULT_EXPANDED_FIELD_SPACE)

    return assign_params(**params)


def prepare_hr_for_space_list(spaces: list[dict[str, Any]], url_prefix: str) -> str:
    """
    Prepare human-readable for list space command.

    :param url_prefix:
    :type spaces: ``List[Dict[str, Any]]``
    :param spaces: The space data.

    :rtype: ``str``
    :return: Human readable.
    """
    hr_list = []
    for space in spaces:
        hr_record = {
            "ID": space.get("id", ""),
            "Space Key": space.get("key", ""),
            "Name": f"[{space.get('name', '')}]({url_prefix}{space.get('_links', {}).get('webui', '')})",
            "Type": space.get("type", ""),
            "Status": space.get("status", ""),
            "Created By": space.get("history", {}).get("createdBy", {}).get("displayName", ""),
            "Created At": space.get("history", {}).get("createdDate", ""),
        }

        hr_list.append(hr_record)

    hr = tableToMarkdown(
        "Space(s)", hr_list, ["ID", "Space Key", "Name", "Type", "Status", "Created By", "Created At"], removeNull=True
    )
    return hr


def validate_update_content_args(args: dict[str, str]):
    """
    Validate arguments for confluence-cloud-content-update command, raise ValueError on invalid arguments.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: None
    """
    validate_create_content_args(args, is_update=True)

    content_id = args["content_id"]
    if not content_id:
        raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format("content_id"))

    version = args["version"]
    if not version:
        raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format("version"))


""" HELPER FUNCTIONS (REST API v2) """


def prepare_cursor_from_link_header(response: requests.Response) -> str:
    """
    Extract the pagination cursor from a v2 API response's ``Link`` header.

    The Confluence REST API v2 returns pagination information in the ``Link`` HTTP response
    header (RFC 5988), e.g. ``<https://.../wiki/api/v2/pages?cursor=abc123>; rel="next"``.
    This function parses that header, isolates the URL marked with ``rel="next"`` and returns
    the value of the ``cursor`` query parameter.

    :type response: ``requests.Response``
    :param response: The raw API response object.

    :return: Next page cursor (empty string when there is no next page).
    :rtype: ``str``
    """
    link_header = response.headers.get("Link", "")
    if not link_header:
        return ""

    for part in link_header.split(","):
        section = part.split(";")
        if len(section) < 2:
            continue
        rel = section[1].strip()
        if rel not in ('rel="next"', "rel=next"):
            continue
        url = section[0].strip().strip("<>")
        query = urllib.parse.urlparse(url).query
        cursor_values = urllib.parse.parse_qs(query).get("cursor", [])
        if cursor_values:
            return cursor_values[0]

    return ""


def paginate_v2_results(
    client: "Client", url_suffix: str, params: dict[str, Any], limit: int
) -> tuple[list[dict[str, Any]], dict[str, Any]]:
    """
    Retrieve v2 list results, automatically following the ``Link: rel="next"`` cursor
    until ``limit`` records are accumulated or there are no more pages.

    The Confluence REST API v2 caps a single page at ``MAX_LIMIT_V2`` (250) results, so this
    helper transparently issues additional requests to satisfy larger ``limit`` values.

    :type client: ``Client``
    :param client: Client object used to issue the HTTP requests.
    :type url_suffix: ``str``
    :param url_suffix: The v2 endpoint URL suffix to query.
    :type params: ``Dict[str, Any]``
    :param params: The base query parameters (the per-request ``limit`` is managed internally).
    :type limit: ``int``
    :param limit: The total number of records the caller wants to accumulate.

    :return: A tuple of (accumulated results, last page's raw JSON response).
    :rtype: ``Tuple[List[Dict[str, Any]], Dict[str, Any]]``
    """
    accumulated: list[dict[str, Any]] = []
    request_params = dict(params)
    response_json: dict[str, Any] = {}

    while len(accumulated) < limit:
        request_params["limit"] = min(MAX_LIMIT_V2, limit - len(accumulated))

        response = client.http_request(method="GET", url_suffix=url_suffix, params=request_params)
        response_json = response.json()
        page_results = response_json.get("results", [])
        accumulated.extend(page_results)

        next_cursor = prepare_cursor_from_link_header(response)
        if not next_cursor or not page_results:
            break
        request_params["cursor"] = next_cursor

    return accumulated[:limit], response_json


def validate_limit_v2(args: dict[str, str]) -> Optional[int]:
    """
    Validate and normalize the ``limit`` argument for v2 list commands.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: The validated limit or ``None`` when not provided.
    :rtype: ``Optional[int]``
    """
    limit = arg_to_number(args.get("limit"), arg_name="limit")
    if limit is None:
        return None
    if limit < MIN_LIMIT_V2:
        raise ValueError(MESSAGES["INVALID_LIMIT_V2"].format(limit))
    return limit


def prepare_content_body_v2(args: dict[str, str], legal_representations: list[str], message_key: str) -> dict[str, Any]:
    """
    Build the v2 ``body`` object for page/blogpost/comment create and update requests.

    The v2 body format differs from v1 and is shaped as
    ``{"representation": "storage", "value": "<p>...</p>"}``.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.
    :type legal_representations: ``list[str]``
    :param legal_representations: The allowed body representation values for the resource.
    :type message_key: ``str``
    :param message_key: The MESSAGES key to use when the representation is invalid.

    :return: The v2 body object (empty dict when no body value is provided).
    :rtype: ``Dict[str, Any]``
    """
    body_value = args.get("body_value")
    if not body_value:
        return {}

    representation = args.get("body_representation", "storage").lower()
    if representation not in legal_representations:
        raise ValueError(f"{MESSAGES[message_key]} Received: '{representation}'.")

    return {"representation": representation, "value": body_value}


def validate_content_create_args_v2(args: dict[str, str]) -> None:
    """
    Validate arguments shared by page-create and blogpost-create v2 commands.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: None
    """
    if not args.get("space_id"):
        raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format("space_id"))

    status = args.get("status", "current").lower()
    if status not in LEGAL_STATUS_CREATE_V2:
        raise ValueError(f"{MESSAGES['INVALID_STATUS_CREATE_V2']} Received: '{status}'.")

    representation = args.get("body_representation", "storage").lower()
    if representation not in LEGAL_BODY_REPRESENTATION_V2:
        raise ValueError(f"{MESSAGES['INVALID_BODY_REPRESENTATION_V2']} Received: '{representation}'.")


def prepare_content_create_params_v2(args: dict[str, str]) -> dict[str, Any]:
    """
    Build the request body for page-create and blogpost-create v2 commands.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: The request body object.
    :rtype: ``Dict[str, Any]``
    """
    validate_content_create_args_v2(args)

    body = prepare_content_body_v2(args, LEGAL_BODY_REPRESENTATION_V2, "INVALID_BODY_REPRESENTATION_V2")
    params = {
        "spaceId": args["space_id"],
        "status": args.get("status", "current").lower(),
        "title": args.get("title"),
        "body": body or None,
    }

    parent_id = args.get("parent_id")
    if parent_id:
        params["parentId"] = parent_id

    return assign_params(**params)


def validate_content_update_args_v2(args: dict[str, str], config: dict[str, Any]) -> None:
    """
    Validate arguments shared by page-update and blogpost-update v2 commands.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.
    :type config: ``Dict[str, Any]``
    :param config: The resource configuration from ``CONTENT_V2_CONFIG``.

    :return: None
    """
    id_arg = config["id_arg"]
    if not args.get(id_arg):
        raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format(id_arg))

    if not args.get("version_number"):
        raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format("version_number"))

    status = args.get("status", "current").lower()
    if status not in LEGAL_STATUS_UPDATE_V2:
        raise ValueError(f"{MESSAGES['INVALID_STATUS_UPDATE_V2']} Received: '{status}'.")

    representation = args.get("body_representation", "storage").lower()
    if representation not in LEGAL_BODY_REPRESENTATION_V2:
        raise ValueError(f"{MESSAGES['INVALID_BODY_REPRESENTATION_V2']} Received: '{representation}'.")


def prepare_content_update_params_v2(args: dict[str, str], config: dict[str, Any]) -> dict[str, Any]:
    """
    Build the request body for page-update and blogpost-update v2 commands.

    v2 update requires an explicit ``version.number`` increment supplied by the caller.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.
    :type config: ``Dict[str, Any]``
    :param config: The resource configuration from ``CONTENT_V2_CONFIG``.

    :return: The request body object.
    :rtype: ``Dict[str, Any]``
    """
    validate_content_update_args_v2(args, config)

    content_id = args[config["id_arg"]]
    version_number = arg_to_number(args.get("version_number"), arg_name="version_number")
    body = prepare_content_body_v2(args, LEGAL_BODY_REPRESENTATION_V2, "INVALID_BODY_REPRESENTATION_V2")

    params = {
        "id": content_id,
        "status": args.get("status", "current").lower(),
        "title": args.get("title"),
        "body": body or None,
        "version": {"number": version_number, "message": args.get("version_message")},
    }

    if config["label"] == "Page" and args.get("space_id"):
        params["spaceId"] = args["space_id"]

    return assign_params(**params)


def validate_content_list_args_v2(args: dict[str, str], config: dict[str, Any]) -> None:
    """
    Validate arguments for page-list and blogpost-list v2 commands.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.
    :type config: ``Dict[str, Any]``
    :param config: The resource configuration from ``CONTENT_V2_CONFIG``.

    :return: None
    """
    validate_limit_v2(args)

    status = args.get("status", "").lower()
    if status and status not in config["list_status"]:
        raise ValueError(MESSAGES[config["list_status_message"]])

    if config["supports_subtype_filter"]:
        subtype = args.get("subtype", "").lower()
        if subtype and subtype not in LEGAL_PAGE_SUBTYPE_FILTER_V2:
            raise ValueError(MESSAGES["INVALID_SUBTYPE_FILTER_V2"])


def prepare_content_list_params_v2(args: dict[str, str], config: dict[str, Any]) -> dict[str, Any]:
    """
    Build the query parameters for page-list and blogpost-list v2 commands.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.
    :type config: ``Dict[str, Any]``
    :param config: The resource configuration from ``CONTENT_V2_CONFIG``.

    :return: The query parameters.
    :rtype: ``Dict[str, Any]``
    """
    validate_content_list_args_v2(args, config)
    # The per-page ``limit`` is managed by ``paginate_v2_results`` so that the user-supplied
    # ``limit`` represents the total number of records accumulated across all pages.
    validate_limit_v2(args)

    params: dict[str, Any] = {
        "id": argToList(args.get("id")),
        "space-id": argToList(args.get("space_id")),
        "status": argToList(args.get("status")),
        "title": args.get("title"),
        "sort": args.get("sort"),
    }

    if config["supports_subtype_filter"] and args.get("subtype"):
        params["subtype"] = args["subtype"].lower()

    return assign_params(**params)


def prepare_hr_for_content_v2(content: dict[str, Any], label: str) -> str:
    """
    Prepare human-readable output for a single v2 page/blogpost.

    :type content: ``Dict[str, Any]``
    :param content: The page or blogpost data.
    :type label: ``str``
    :param label: The resource label (e.g. ``Page`` or ``Blog post``).

    :rtype: ``str``
    :return: Human readable.
    """
    hr_record = {
        "ID": content.get("id", ""),
        "Title": content.get("title", ""),
        "Status": content.get("status", ""),
        "Space ID": content.get("spaceId", ""),
        "Author ID": content.get("authorId", ""),
        "Created At": content.get("createdAt", ""),
        "Version": (content.get("version") or {}).get("number", ""),
    }
    return tableToMarkdown(
        label, hr_record, ["ID", "Title", "Status", "Space ID", "Author ID", "Created At", "Version"], removeNull=True
    )


def prepare_hr_for_content_list_v2(contents: list[dict[str, Any]], label: str) -> str:
    """
    Prepare human-readable output for a list of v2 pages/blogposts.

    :type contents: ``list[Dict[str, Any]]``
    :param contents: The page or blogpost data.
    :type label: ``str``
    :param label: The resource label (e.g. ``Page`` or ``Blog post``).

    :rtype: ``str``
    :return: Human readable.
    """
    hr_list = []
    for content in contents:
        hr_list.append(
            {
                "ID": content.get("id", ""),
                "Title": content.get("title", ""),
                "Status": content.get("status", ""),
                "Space ID": content.get("spaceId", ""),
                "Author ID": content.get("authorId", ""),
                "Created At": content.get("createdAt", ""),
            }
        )
    return tableToMarkdown(
        f"{label}(s)", hr_list, ["ID", "Title", "Status", "Space ID", "Author ID", "Created At"], removeNull=True
    )


def validate_comment_create_args_v2(args: dict[str, str]) -> None:
    """
    Validate arguments for footer-comment-create v2 command.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: None
    """
    if not args.get("body_value"):
        raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format("body_value"))

    representation = args.get("body_representation", "storage").lower()
    if representation not in LEGAL_COMMENT_BODY_REPRESENTATION_V2:
        raise ValueError(MESSAGES["INVALID_COMMENT_BODY_REPRESENTATION_V2"])

    container_args = ("page_id", "blogpost_id", "parent_comment_id", "attachment_id", "custom_content_id")
    if not any(args.get(arg) for arg in container_args):
        raise ValueError(MESSAGES["MISSING_COMMENT_CONTAINER_V2"])


def prepare_comment_create_params_v2(args: dict[str, str]) -> dict[str, Any]:
    """
    Build the request body for footer-comment-create v2 command.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: The request body object.
    :rtype: ``Dict[str, Any]``
    """
    validate_comment_create_args_v2(args)

    body = prepare_content_body_v2(args, LEGAL_COMMENT_BODY_REPRESENTATION_V2, "INVALID_COMMENT_BODY_REPRESENTATION_V2")
    params: dict[str, Any] = {
        "body": body,
        "pageId": args.get("page_id"),
        "blogPostId": args.get("blogpost_id"),
        "parentCommentId": args.get("parent_comment_id"),
        "attachmentId": args.get("attachment_id"),
        "customContentId": args.get("custom_content_id"),
    }

    return assign_params(**params)


def prepare_hr_for_comment_v2(comment: dict[str, Any], label: str) -> str:
    """
    Prepare human-readable output for a created v2 footer comment.

    :type comment: ``Dict[str, Any]``
    :param comment: The comment data.
    :type label: ``str``
    :param label: The comment label (e.g. ``Footer Comment``).

    :rtype: ``str``
    :return: Human readable.
    """
    hr_record = {
        "ID": comment.get("id", ""),
        "Status": comment.get("status", ""),
        "Page ID": comment.get("pageId", ""),
        "Blog Post ID": comment.get("blogPostId", ""),
        "Parent Comment ID": comment.get("parentCommentId", ""),
        "Version": (comment.get("version") or {}).get("number", ""),
    }
    return tableToMarkdown(
        label, hr_record, ["ID", "Status", "Page ID", "Blog Post ID", "Parent Comment ID", "Version"], removeNull=True
    )


def validate_space_list_args_v2(args: dict[str, str]) -> None:
    """
    Validate arguments for space-listv2 command.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: None
    """
    validate_limit_v2(args)

    space_type = args.get("type", "").lower()
    if space_type and space_type not in LEGAL_SPACE_TYPE_V2:
        raise ValueError(MESSAGES["INVALID_SPACE_TYPE_V2"])

    status = args.get("status", "").lower()
    if status and status not in LEGAL_SPACE_STATUS_V2:
        raise ValueError(MESSAGES["INVALID_SPACE_STATUS_V2"])


def prepare_space_list_params_v2(args: dict[str, str]) -> dict[str, Any]:
    """
    Build the query parameters for space-listv2 command.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: The query parameters.
    :rtype: ``Dict[str, Any]``
    """
    validate_space_list_args_v2(args)
    # The per-page ``limit`` is managed by ``paginate_v2_results`` so that the user-supplied
    # ``limit`` represents the total number of records accumulated across all pages.
    validate_limit_v2(args)

    params = {
        "ids": argToList(args.get("ids")),
        "keys": argToList(args.get("keys")),
        "type": args.get("type"),
        "status": args.get("status"),
        "sort": args.get("sort"),
    }
    return assign_params(**params)


def validate_space_create_args_v2(args: dict[str, str]) -> None:
    """
    Validate arguments for space-createv2 command.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: None
    """
    if not args.get("name"):
        raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format("name"))
    if not args.get("key"):
        raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format("key"))

    description_format = args.get("description_format", "plain").lower()
    if description_format not in LEGAL_DESCRIPTION_FORMAT_V2:
        raise ValueError(MESSAGES["INVALID_DESCRIPTION_FORMAT_V2"])


def prepare_space_create_params_v2(args: dict[str, str]) -> dict[str, Any]:
    """
    Build the request body for space-createv2 command.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: The request body object.
    :rtype: ``Dict[str, Any]``
    """
    validate_space_create_args_v2(args)

    params: dict[str, Any] = {"name": args["name"], "key": args["key"]}

    description_value = args.get("description_value")
    if description_value:
        description_format = args.get("description_format", "plain").lower()
        params["description"] = {description_format: {"value": description_value, "representation": description_format}}

    role_assignments = args.get("role_assignments")
    if role_assignments:
        try:
            params["roleAssignments"] = json.loads(role_assignments)
        except (json.JSONDecodeError, TypeError):
            raise ValueError(MESSAGES["INVALID_ROLE_ASSIGNMENTS_V2"])

    return assign_params(**params)


def prepare_hr_for_space_create_v2(space: dict[str, Any]) -> str:
    """
    Prepare human-readable output for a created v2 space.

    :type space: ``Dict[str, Any]``
    :param space: The space data.

    :rtype: ``str``
    :return: Human readable.
    """
    hr_record = {
        "ID": space.get("id", ""),
        "Key": space.get("key", ""),
        "Name": space.get("name", ""),
        "Type": space.get("type", ""),
        "Status": space.get("status", ""),
    }
    return tableToMarkdown("Space", hr_record, ["ID", "Key", "Name", "Type", "Status"], removeNull=True)


def prepare_hr_for_space_list_v2(spaces: list[dict[str, Any]]) -> str:
    """
    Prepare human-readable output for a list of v2 spaces.

    :type spaces: ``list[Dict[str, Any]]``
    :param spaces: The space data.

    :rtype: ``str``
    :return: Human readable.
    """
    hr_list = []
    for space in spaces:
        hr_list.append(
            {
                "ID": space.get("id", ""),
                "Key": space.get("key", ""),
                "Name": space.get("name", ""),
                "Type": space.get("type", ""),
                "Status": space.get("status", ""),
            }
        )
    return tableToMarkdown("Space(s)", hr_list, ["ID", "Key", "Name", "Type", "Status"], removeNull=True)


""" COMMAND FUNCTIONS """


def test_module(client: Client) -> str:
    """Tests API connectivity and authentication'

    Returning 'ok' indicates that the integration works like it is supposed to.
    Connection to the service is successful.
    Raises exceptions if something goes wrong.

    :type client: ``Client``
    :param client: client to use

    :return: 'ok' if test passed, anything else will fail the test.
    :rtype: ``str``
    """
    params: dict = {"cql": "type=page", "limit": 1}
    client.http_request(method="GET", url_suffix=URL_SUFFIX["CONTENT_SEARCH"], params=params)
    return "ok"


def confluence_cloud_user_list_command(client: Client, args: dict[str, str]) -> CommandResults:
    """
    Returns a list of users.

    :type client: ``Client``
    :param client: Client object to be used.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: Standard command result or no records found message.
    :rtype: ``CommandResults``
    """
    limit, offset = validate_list_command_args(args)
    params = assign_params(limit=limit, start=offset)
    response = client.http_request(method="GET", url_suffix=URL_SUFFIX["USER"], params=params)

    response_json = response.json()
    total_records = response_json.get("results", [])

    if not total_records:
        return CommandResults(readable_output=MESSAGES["NO_RECORDS_FOUND"].format("user(s)"))

    context = []
    for user in total_records:
        context.append(remove_empty_elements_for_context(user.get("user", {})))

    readable_hr = prepare_hr_for_users(total_records)

    return CommandResults(
        outputs_prefix=OUTPUT_PREFIX["USER"],
        outputs_key_field="accountId",
        outputs=context,
        readable_output=readable_hr,
        raw_response=response_json,
    )


def confluence_cloud_content_search_command(client: Client, args: dict[str, str]) -> CommandResults:
    """
    Returns the list of content that matches a Confluence Query Language (CQL) query.
    The type of content can be a page, blogpost, or comment.

    :type client: ``Client``
    :param client: Client object to be used.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: Standard command result or no records found message.
    :rtype: ``CommandResults``
    """
    params = prepare_search_content_argument(args)

    response = client.http_request(method="GET", url_suffix=URL_SUFFIX["CONTENT_SEARCH"], params=params)
    response_json = response.json()
    total_records = response_json.get("results", [])

    if not total_records:
        return CommandResults(readable_output=MESSAGES["NO_RECORDS_FOUND"].format("content(s)"))

    # Creating Context data
    context = remove_empty_elements_for_context(total_records)
    next_cursor = prepare_cursor_for_content(response_json)
    next_page_context = {"next_page_token": next_cursor, "name": "confluence-cloud-content-search"}
    next_page_context = remove_empty_elements_for_context(next_page_context)
    outputs = {
        f"{OUTPUT_PREFIX['CONTENT']}(val.id == obj.id)": context,
        f"{OUTPUT_PREFIX['PAGETOKEN']}(val.name == obj.name)": next_page_context,
    }

    # Creating Human Readable
    url_prefix = response_json.get("_links", {}).get("base", "")
    readable_hr = prepare_hr_for_content_search(total_records, url_prefix)
    if next_cursor:
        readable_hr += f"Run the command with argument next_page_token={next_cursor} to see the next set of contents.\n"

    return CommandResults(outputs=outputs, readable_output=readable_hr, raw_response=response_json)


def confluence_cloud_content_update_command(client: Client, args: dict[str, str]) -> CommandResults:
    """
    Update the existing content with new content.

    :type client: ``Client``
    :param client: Client object to be used.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: Standard command result or no records found message.
    :rtype: ``CommandResults``
    """
    validate_update_content_args(args)

    content_id = args["content_id"]
    params = prepare_content_create_params(args)
    params["version"] = {"number": args["version"]}
    request_url = URL_SUFFIX["CONTENT"] + f"/{content_id}"

    response = client.http_request(method="PUT", url_suffix=request_url, json_data=params)
    response_json = response.json()

    context = remove_empty_elements_for_context(response_json)
    readable_hr = prepare_hr_for_content_create(response_json, "Content")

    return CommandResults(
        outputs_prefix=OUTPUT_PREFIX["CONTENT"],
        outputs_key_field="id",
        outputs=context,
        readable_output=readable_hr,
        raw_response=response_json,
    )


def confluence_cloud_content_delete_command(client: Client, args: dict[str, str]) -> CommandResults:
    """
    This command moves a piece of content to the space's trash or purges it from the trash,
    depending on the content's type and status.

    :type client: ``Client``
    :param client: Client object to be used.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: Standard command result or no records found message.
    :rtype: ``CommandResults``
    """

    validate_delete_content_args(args)

    content_id = args["content_id"]
    status = args.get("deletion_type", "").lower()
    params = assign_params(status=LEGAL_DELETION_TYPES.get(status))

    request_url = URL_SUFFIX["CONTENT"] + f"/{content_id}"

    client.http_request(method="DELETE", url_suffix=request_url, params=params)

    return CommandResults(readable_output=MESSAGES["HR_DELETE_CONTENT"].format(content_id))


def confluence_cloud_content_list_command(client: Client, args: dict[str, str]) -> CommandResults:
    """
    Returns the list of contents of confluence.

    :type client: ``Client``
    :param client: Client object to be used.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: Standard command result or no records found message.
    :rtype: ``CommandResults``
    """
    params = prepare_list_content_argument(args)

    response = client.http_request(method="GET", url_suffix=URL_SUFFIX["CONTENT"], params=params)

    response_json = response.json()
    total_records = response_json.get("results", [])

    if not total_records:
        return CommandResults(readable_output=MESSAGES["NO_RECORDS_FOUND"].format("content(s)"))

    context = remove_empty_elements_for_context(total_records)

    url_prefix = response_json.get("_links", {}).get("base", "")
    readable_hr = prepare_hr_for_content_search(total_records, url_prefix)

    return CommandResults(
        outputs_prefix=OUTPUT_PREFIX["CONTENT"],
        outputs_key_field="id",
        outputs=context,
        readable_output=readable_hr,
        raw_response=response_json,
    )


def confluence_cloud_space_list_command(client: Client, args: dict[str, str]) -> CommandResults:
    """
    Returns a list of all Confluence spaces.

    :type client: ``Client``
    :param client: Client object to be used.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: Standard command result or no records found message.
    :rtype: ``CommandResults``
    """
    params = prepare_list_space_args(args)

    response = client.http_request(method="GET", url_suffix=URL_SUFFIX["SPACE"], params=params)

    response_json = response.json()
    total_records = response_json.get("results", [])

    if not total_records:
        return CommandResults(readable_output=MESSAGES["NO_RECORDS_FOUND"].format("space(s)"))

    context = remove_empty_elements_for_context(total_records)

    url_prefix = response_json.get("_links", {}).get("base", "")
    readable_hr = prepare_hr_for_space_list(total_records, url_prefix)

    return CommandResults(
        outputs_prefix=OUTPUT_PREFIX["SPACE"],
        outputs_key_field="id",
        outputs=context,
        readable_output=readable_hr,
        raw_response=response_json,
    )


def confluence_cloud_comment_create_command(client: Client, args: dict[str, str]) -> CommandResults:
    """
    Creates a comment for a given content.

    :type client: ``Client``
    :param client: Client object to be used.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: Standard command result or no records found message.
    :rtype: ``CommandResults``
    """
    validate_comment_args(args)
    params = prepare_comment_create_params(args)
    response = client.http_request(method="POST", url_suffix=URL_SUFFIX["CONTENT"], json_data=params)
    response_json = response.json()
    context = remove_empty_elements_for_context(response_json)
    readable_hr = prepare_hr_for_content_create(response_json, "Comment")
    return CommandResults(
        outputs_prefix=OUTPUT_PREFIX["COMMENT"],
        outputs_key_field="id",
        outputs=context,
        readable_output=readable_hr,
        raw_response=response_json,
    )


def confluence_cloud_content_create_command(client: Client, args: dict[str, str]) -> CommandResults:
    """
    Create a page or blogpost for a specified space .

    :type client: ``Client``
    :param client: Client object to be used.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: Standard command result or no records found message.
    :rtype: ``CommandResults``
    """
    validate_create_content_args(args)
    params = prepare_content_create_params(args)
    response = client.http_request(method="POST", url_suffix=URL_SUFFIX["CONTENT"], json_data=params)
    response_json = response.json()
    context = remove_empty_elements_for_context(response_json)
    readable_hr = prepare_hr_for_content_create(response_json, "Content")
    return CommandResults(
        outputs_prefix=OUTPUT_PREFIX["CONTENT"],
        outputs_key_field="id",
        outputs=context,
        readable_output=readable_hr,
        raw_response=response_json,
    )


def confluence_cloud_space_create_command(client: Client, args: dict[str, str]) -> CommandResults:
    """
    Creates a new space in confluence cloud.

    :type client: ``Client``
    :param client: Client object to be used.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: Standard command result or no records found message.
    :rtype: ``CommandResults``
    """
    validate_create_space_args(args)
    params, is_private_space = prepare_create_space_args(args)

    url_suffix = URL_SUFFIX["SPACE"]

    if is_private_space:
        url_suffix = URL_SUFFIX["PRIVATE_SPACE"]
        if "permissions" in params:
            del params["permissions"]

    response = client.http_request(method="POST", url_suffix=url_suffix, json_data=params)

    response_json = response.json()

    # Creating the Context data
    context = remove_empty_elements_for_context(response_json)

    # Creating the Human Readable
    readable_hr = prepare_hr_for_space_create(response_json)
    return CommandResults(
        outputs_prefix=OUTPUT_PREFIX["SPACE"],
        outputs_key_field="id",
        outputs=context,
        readable_output=readable_hr,
        raw_response=response_json,
    )


def confluence_cloud_group_list_command(client: Client, args: dict[str, str]) -> CommandResults:
    """
    Retrieves the list of groups.

    :type client: ``Client``
    :param client: Client object to be used.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: Standard command result or no records found message.
    :rtype: ``CommandResults``
    """
    params = prepare_group_args(args)

    response = client.http_request(method="GET", url_suffix=URL_SUFFIX["GROUP"], params=params)

    response_json = response.json()
    total_records = response_json.get("results", [])

    if not total_records:
        return CommandResults(readable_output=MESSAGES["NO_RECORDS_FOUND"].format("group(s)"))

    context = remove_empty_elements(total_records)
    readable_hr = prepare_hr_for_groups(total_records)
    return CommandResults(
        outputs_prefix=OUTPUT_PREFIX["GROUP"],
        outputs_key_field="id",
        outputs=context,
        readable_output=readable_hr,
        raw_response=response_json,
    )


def fetch_events(client: Client, fetch_limit: int, last_run: Dict[str, Any]) -> tuple[List[Dict[str, Any]], Dict[str, Any]]:
    # constants for this run
    last_end_date: Final[int] = last_run.get("end_date", 0)
    end_date: Final[int] = int((time.time() - 5) * 1000)
    start_date: Final[int] = last_end_date + 1 if last_end_date else end_date - ONE_MINUTE_IN_MILL_SECONDS

    # updated in loop
    next_link = last_run.get("next_link", "")

    demisto.debug(f"Starting fetch_events with {last_run=} and {fetch_limit=}")
    all_events, started_new_query, next_link = run_fetch_mechanism(client, fetch_limit, next_link, start_date, end_date)

    if not all_events:
        demisto.debug("No events found")
        return [], {"next_link": None, "end_date": last_end_date}

    return all_events, {"next_link": next_link, "end_date": end_date if started_new_query else last_end_date}


def get_events(client: Client, args: dict) -> tuple[list[dict], CommandResults]:
    end_date = args.get("end_date", int((time.time() - 5) * 1000))
    start_date = int(args.get("start_date", end_date - ONE_MINUTE_IN_MILL_SECONDS))
    fetch_limit = int(args.get("limit", DEFAULT_GET_EVENTS_LIMIT))
    events, _, _ = run_fetch_mechanism(client, fetch_limit, "", start_date, end_date)

    return events, CommandResults(
        outputs=events,
        outputs_prefix=OUTPUT_PREFIX["EVENT"],
        readable_output=tableToMarkdown("Events", t=events, removeNull=True),
    )


def confluence_cloud_content_get_command(client: Client, args: dict[str, str]) -> CommandResults:
    """
    Execute the confluence-cloud-content-get command. Fetches content details from Confluence Cloud by content ID.

    :type client: ``Client``
    :param client: The client used to send HTTP requests to the Confluence Cloud API.

    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: ``CommandResults`` containing the content details.
    :rtype: ``CommandResults``
    """

    content_id = args.get("content_id")
    if not content_id:
        raise ValueError(MESSAGES["MISSING_CONTENT_ID"])
    params = {"expand": "body.storage"}
    request_url = urljoin(URL_SUFFIX.get("CONTENT"), content_id)
    response = client.http_request(method="GET", url_suffix=request_url, params=params)
    response_json = response.json()
    context = remove_empty_elements(response_json)
    readable_hr = prepare_hr_for_content_create(response_json, "Content")

    return CommandResults(
        outputs_prefix=OUTPUT_PREFIX.get("CONTENT"),
        outputs_key_field="id",
        outputs=context,
        readable_output=readable_hr,
        raw_response=response_json,
    )


""" COMMAND FUNCTIONS (REST API v2) """


def confluence_cloud_content_create_command_v2(client: Client, args: dict[str, str], content_type: str) -> CommandResults:
    """
    Create a page or blogpost using the Confluence Cloud REST API v2.

    :type client: ``Client``
    :param client: Client object to be used.
    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.
    :type content_type: ``str``
    :param content_type: Either ``page`` or ``blogpost``.

    :return: Standard command result.
    :rtype: ``CommandResults``
    """
    config = CONTENT_V2_CONFIG[content_type]
    params = prepare_content_create_params_v2(args)

    response = client.http_request(method="POST", url_suffix=config["url_suffix"], json_data=params)
    response_json = response.json()

    context = remove_empty_elements_for_context(response_json)
    readable_hr = prepare_hr_for_content_v2(response_json, config["label"])

    return CommandResults(
        outputs_prefix=config["output_prefix"],
        outputs_key_field="id",
        outputs=context,
        readable_output=readable_hr,
        raw_response=response_json,
    )


def confluence_cloud_content_list_command_v2(client: Client, args: dict[str, str], content_type: str) -> CommandResults:
    """
    List pages or blogposts using the Confluence Cloud REST API v2.

    :type client: ``Client``
    :param client: Client object to be used.
    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.
    :type content_type: ``str``
    :param content_type: Either ``page`` or ``blogpost``.

    :return: Standard command result or no records found message.
    :rtype: ``CommandResults``
    """
    config = CONTENT_V2_CONFIG[content_type]
    params = prepare_content_list_params_v2(args, config)
    # ``limit`` is the total number of records to return across all pages.
    limit = validate_limit_v2(args) or DEFAULT_LIMIT_V2

    total_records, response_json = paginate_v2_results(client, config["url_suffix"], params, limit)

    if not total_records:
        return CommandResults(readable_output=MESSAGES["NO_RECORDS_FOUND"].format(f"{config['label'].lower()}(s)"))

    context = remove_empty_elements_for_context(total_records)
    outputs: dict[str, Any] = {f"{config['output_prefix']}(val.id == obj.id)": context}

    readable_hr = prepare_hr_for_content_list_v2(total_records, config["label"])

    return CommandResults(outputs=outputs, readable_output=readable_hr, raw_response=response_json)


def confluence_cloud_content_update_command_v2(client: Client, args: dict[str, str], content_type: str) -> CommandResults:
    """
    Update a page or blogpost using the Confluence Cloud REST API v2.

    :type client: ``Client``
    :param client: Client object to be used.
    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.
    :type content_type: ``str``
    :param content_type: Either ``page`` or ``blogpost``.

    :return: Standard command result.
    :rtype: ``CommandResults``
    """
    config = CONTENT_V2_CONFIG[content_type]
    content_id = args[config["id_arg"]]
    params = prepare_content_update_params_v2(args, config)
    request_url = urljoin(config["url_suffix"], content_id)

    response = client.http_request(method="PUT", url_suffix=request_url, json_data=params)
    response_json = response.json()

    context = remove_empty_elements_for_context(response_json)
    readable_hr = prepare_hr_for_content_v2(response_json, config["label"])

    return CommandResults(
        outputs_prefix=config["output_prefix"],
        outputs_key_field="id",
        outputs=context,
        readable_output=readable_hr,
        raw_response=response_json,
    )


def confluence_cloud_content_delete_command_v2(client: Client, args: dict[str, str], content_type: str) -> CommandResults:
    """
    Delete a page or blogpost using the Confluence Cloud REST API v2.

    :type client: ``Client``
    :param client: Client object to be used.
    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.
    :type content_type: ``str``
    :param content_type: Either ``page`` or ``blogpost``.

    :return: Standard command result.
    :rtype: ``CommandResults``
    """
    config = CONTENT_V2_CONFIG[content_type]
    content_id = args.get(config["id_arg"])
    if not content_id:
        raise ValueError(MESSAGES["REQUIRED_ARGUMENT"].format(config["id_arg"]))

    params = assign_params(purge=argToBoolean(args["purge"]) if args.get("purge") else None)
    request_url = urljoin(config["url_suffix"], content_id)

    client.http_request(method="DELETE", url_suffix=request_url, params=params)

    hr_key = "HR_PAGE_DELETE" if content_type == "page" else "HR_BLOGPOST_DELETE"
    return CommandResults(readable_output=MESSAGES[hr_key].format(content_id))


def confluence_cloud_page_create_command(client: Client, args: dict[str, str]) -> CommandResults:
    """Create a page (Confluence Cloud REST API v2)."""
    return confluence_cloud_content_create_command_v2(client, args, "page")


def confluence_cloud_page_list_command(client: Client, args: dict[str, str]) -> CommandResults:
    """List pages (Confluence Cloud REST API v2)."""
    return confluence_cloud_content_list_command_v2(client, args, "page")


def confluence_cloud_page_update_command(client: Client, args: dict[str, str]) -> CommandResults:
    """Update a page (Confluence Cloud REST API v2)."""
    return confluence_cloud_content_update_command_v2(client, args, "page")


def confluence_cloud_page_delete_command(client: Client, args: dict[str, str]) -> CommandResults:
    """Delete a page (Confluence Cloud REST API v2)."""
    return confluence_cloud_content_delete_command_v2(client, args, "page")


def confluence_cloud_blogpost_create_command(client: Client, args: dict[str, str]) -> CommandResults:
    """Create a blogpost (Confluence Cloud REST API v2)."""
    return confluence_cloud_content_create_command_v2(client, args, "blogpost")


def confluence_cloud_blogpost_list_command(client: Client, args: dict[str, str]) -> CommandResults:
    """List blogposts (Confluence Cloud REST API v2)."""
    return confluence_cloud_content_list_command_v2(client, args, "blogpost")


def confluence_cloud_blogpost_update_command(client: Client, args: dict[str, str]) -> CommandResults:
    """Update a blogpost (Confluence Cloud REST API v2)."""
    return confluence_cloud_content_update_command_v2(client, args, "blogpost")


def confluence_cloud_blogpost_delete_command(client: Client, args: dict[str, str]) -> CommandResults:
    """Delete a blogpost (Confluence Cloud REST API v2)."""
    return confluence_cloud_content_delete_command_v2(client, args, "blogpost")


def confluence_cloud_footer_comment_create_command(client: Client, args: dict[str, str]) -> CommandResults:
    """
    Create a footer comment using the Confluence Cloud REST API v2.

    :type client: ``Client``
    :param client: Client object to be used.
    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: Standard command result.
    :rtype: ``CommandResults``
    """
    params = prepare_comment_create_params_v2(args)

    response = client.http_request(method="POST", url_suffix=URL_SUFFIX_V2["FOOTER_COMMENTS"], json_data=params)
    response_json = response.json()

    context = remove_empty_elements_for_context(response_json)
    readable_hr = prepare_hr_for_comment_v2(response_json, "Footer Comment")

    return CommandResults(
        outputs_prefix=OUTPUT_PREFIX["COMMENT"],
        outputs_key_field="id",
        outputs=context,
        readable_output=readable_hr,
        raw_response=response_json,
    )


def confluence_cloud_space_list_command_v2(client: Client, args: dict[str, str]) -> CommandResults:
    """
    List spaces using the Confluence Cloud REST API v2.

    :type client: ``Client``
    :param client: Client object to be used.
    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: Standard command result or no records found message.
    :rtype: ``CommandResults``
    """
    params = prepare_space_list_params_v2(args)
    # ``limit`` is the total number of records to return across all pages.
    limit = validate_limit_v2(args) or DEFAULT_LIMIT_V2

    total_records, response_json = paginate_v2_results(client, URL_SUFFIX_V2["SPACES"], params, limit)

    if not total_records:
        return CommandResults(readable_output=MESSAGES["NO_RECORDS_FOUND"].format("space(s)"))

    context = remove_empty_elements_for_context(total_records)
    outputs: dict[str, Any] = {f"{OUTPUT_PREFIX['SPACE']}(val.id == obj.id)": context}

    readable_hr = prepare_hr_for_space_list_v2(total_records)

    return CommandResults(outputs=outputs, readable_output=readable_hr, raw_response=response_json)


def confluence_cloud_space_create_command_v2(client: Client, args: dict[str, str]) -> CommandResults:
    """
    Create a space using the Confluence Cloud REST API v2.

    :type client: ``Client``
    :param client: Client object to be used.
    :type args: ``Dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: Standard command result.
    :rtype: ``CommandResults``
    """
    params = prepare_space_create_params_v2(args)

    response = client.http_request(method="POST", url_suffix=URL_SUFFIX_V2["SPACES"], json_data=params)
    response_json = response.json()

    context = remove_empty_elements_for_context(response_json)
    readable_hr = prepare_hr_for_space_create_v2(response_json)

    return CommandResults(
        outputs_prefix=OUTPUT_PREFIX["SPACE"],
        outputs_key_field="id",
        outputs=context,
        readable_output=readable_hr,
        raw_response=response_json,
    )


def _extract_content_id_from_url(url: str) -> str:
    """
    Extract the Confluence content ID from a Confluence page URL.

    Supports the following URL formats:
    - https://<site>.atlassian.net/wiki/spaces/<space>/pages/<pageId>/<title>
    - https://<site>.atlassian.net/wiki/rest/api/content/<contentId>
    - https://<site>.atlassian.net/wiki/pages/viewpage.action?pageId=<pageId>

    :type url: ``str``
    :param url: The Confluence page URL.

    :return: The extracted content ID.
    :rtype: ``str``

    :raises ValueError: If the content ID cannot be extracted from the URL.
    """
    for pattern in CONFLUENCE_URL_PATTERNS:
        match = pattern.search(url)
        if match:
            return match.group(1)

    raise ValueError(
        f"Could not extract content ID from URL: {url}. "
        "Supported URL formats: "
        "https://<site>.atlassian.net/wiki/spaces/<space>/pages/<pageId>/<title>, "
        "https://<site>.atlassian.net/wiki/pages/viewpage.action?pageId=<pageId>"
    )


def confluence_cloud_generic_file_get_command(client: Client, args: dict[str, str]) -> CommandResults:
    """
    Execute the get-file-content command.
    Fetches content from Confluence Cloud by URL and returns it in a generic unified format.

    :type client: ``Client``
    :param client: The client used to send HTTP requests to the Confluence Cloud API.

    :type args: ``dict[str, str]``
    :param args: The command arguments provided by the user.

    :return: ``CommandResults`` containing the content in a generic format.
    :rtype: ``CommandResults``
    """
    url = args.get("url", "")
    if not url:
        raise ValueError("The 'url' argument is required.")

    content_id = _extract_content_id_from_url(url)

    # Request the body in storage format (XHTML/HTML), then convert it to Markdown for readability.
    params = {"expand": "body.storage"}
    request_url = urljoin(URL_SUFFIX.get("CONTENT"), content_id)
    response = client.http_request(method="GET", url_suffix=request_url, params=params)
    response_json = response.json()

    title = response_json.get("title", "")
    html_content = response_json.get("body", {}).get("storage", {}).get("value", "")

    # Convert the Confluence storage-format HTML/XHTML into Markdown.
    body_content = markdownify(html_content).strip() if html_content else ""

    # Check size of the body content (limit to 5MB = 5 * 1024 * 1024 bytes).
    if body_content:
        size_bytes = len(body_content.encode("utf-8"))
        if size_bytes > MAX_FILE_SIZE:
            size_mb = size_bytes / (1024 * 1024)
            limit_mb = MAX_FILE_SIZE / (1024 * 1024)
            raise ValueError(
                f"The file '{title}' is {size_mb:.2f} MB, which exceeds the maximum allowed size of {limit_mb:.0f} MB."
            )

    # The body is converted from Confluence storage-format HTML to Markdown, so the MIME type is text/markdown.
    generic_output = remove_empty_elements(
        {
            "Title": title,
            "Type": "text/markdown",
            "Name": title,
            "Content": body_content,
            "Url": url,
            "Id": response_json.get("id", ""),
        }
    )

    readable_hr = tableToMarkdown(
        "File Content Results",
        generic_output,
        headers=["Id", "Title", "Type", "Url"],
        removeNull=True,
    )

    return CommandResults(
        outputs_prefix=OUTPUT_PREFIX["FILE_CONTENT"],
        outputs=generic_output,
        readable_output=readable_hr,
        raw_response=response_json,
    )


def oauth_start_command(oauth_client) -> CommandResults:
    """Start OAuth authentication flow."""
    url = oauth_client.oauth_start()
    return CommandResults(
        readable_output=(
            f"### Authorization Instructions\n"
            f"1. Click on the following link to authorize:\n{url}\n\n"
            f"2. After authorizing, you will be redirected to the callback URL\n"
            f"3. Copy the authorization code from the 'code' parameter in the URL\n"
            f"4. Run the command: `!confluence-cloud-oauth-complete code=<your_code>`"
        )
    )


def oauth_complete_command(oauth_client, code: str) -> CommandResults:
    """Complete OAuth authentication flow."""
    oauth_client.oauth_complete(code=code)
    return CommandResults(
        readable_output=(
            "### Successfully authenticated!\n"
            "The access token and refresh token have been saved.\n"
            "You can now use the integration to fetch events."
        )
    )


def oauth_test_command(oauth_client) -> CommandResults:
    """Test OAuth authentication and verify accessible resources."""
    try:
        access_token = oauth_client.get_access_token()

        # Query accessible resources to verify cloud_id and product access
        response = requests.get(
            "https://api.atlassian.com/oauth/token/accessible-resources",
            headers={"Authorization": f"Bearer {access_token}", "Accept": "application/json"},
            verify=oauth_client.verify,
            proxies=handle_proxy() if oauth_client.proxy else None,
            timeout=60,
        )
        response.raise_for_status()
        resources = response.json()
        demisto.debug(f"{LOGGING_INTEGRATION_NAME} Accessible resources: {resources}")

        # Format the resources for display
        resource_info = []
        for resource in resources:
            resource_info.append(
                f"- **{resource.get('name', 'Unknown')}** (ID: `{resource.get('id', 'N/A')}`)\n"
                f"  URL: {resource.get('url', 'N/A')}\n"
                f"  Scopes: {', '.join(resource.get('scopes', []))}"
            )

        resources_display = "\n".join(resource_info) if resource_info else "No accessible resources found."

        return CommandResults(
            readable_output=(f"### ✓ Authentication successful\n\n" f"### Accessible Resources:\n{resources_display}")
        )
    except Exception as e:
        raise DemistoException(f"Authentication failed: {str(e)}")


def create_oauth_client(params: dict):
    """
    Create an OAuth client for Confluence Cloud.

    :type params: ``dict``
    :param params: The integration parameters.

    :return: OAuth client instance or None if not using OAuth.
    """
    auth_method = params.get("auth_method", "Basic")

    if auth_method != "OAuth 2.0":
        return None

    client_creds = params.get("client_credentials", {})
    client_id = client_creds.get("identifier", "")
    client_secret = client_creds.get("password", "")
    cloud_id = params.get("cloud_id", "")
    callback_url = params.get("callback_url", "")
    server_url = str(params.get("url", "")).strip().removesuffix("/")

    if not client_id or not client_secret:
        raise DemistoException("Client ID and Client Secret are required for OAuth 2.0 authentication")
    if not callback_url:
        raise DemistoException("Callback URL is required for OAuth 2.0 authentication")

    # Create OAuth client using AtlassianApiModule
    return create_atlassian_oauth_client(
        client_id=client_id,
        client_secret=client_secret,
        callback_url=callback_url,
        cloud_id=cloud_id,
        server_url=server_url,
        verify=not params.get("insecure", False),
        proxy=params.get("proxy", False),
        product="confluence",
    )


def create_client(params: dict, oauth_client=None) -> Client:
    """
    Create a Client instance based on the authentication method configured.

    :type params: ``dict``
    :param params: The integration parameters.

    :type oauth_client: ``Optional``
    :param oauth_client: OAuth client instance for OAuth authentication.

    :return: Client instance configured with the appropriate authentication.
    :rtype: ``Client``
    """
    # get the service API url
    raw_url = params["url"].strip().removesuffix("/")
    verify_certificate = not params.get("insecure", False)
    proxy = params.get("proxy", False)

    validate_url(raw_url)
    headers: dict = {"Accept": "application/json"}

    # Extract the site name from the URL, handling various input formats:
    # "mysite", "mysite.atlassian.net", "https://mysite.atlassian.net", "https://mysite.atlassian.net/wiki/"
    site_name = raw_url.removeprefix("https://").removeprefix("http://").removesuffix("/")
    # Remove any path components (e.g., /wiki)
    site_name = site_name.split("/")[0]
    # Remove .atlassian.net suffix if present to get just the site name
    site_name = site_name.removesuffix(".atlassian.net").removesuffix(".atlassian.com")
    base_url = f"https://{site_name}.atlassian.net"

    # Check if OAuth authentication is configured
    auth_method = params.get("auth_method", "Basic")

    if auth_method == "OAuth 2.0" and oauth_client is not None:
        # OAuth 2.0 authentication
        demisto.debug(f"{LOGGING_INTEGRATION_NAME} Using OAuth 2.0 authentication")

        # Get the access token
        access_token = oauth_client.get_access_token()
        headers["Authorization"] = f"Bearer {access_token}"

        # Per Atlassian OAuth 2.0 (3LO) docs, the base URL for OAuth apps must use
        # the API gateway: https://api.atlassian.com/ex/confluence/{cloudId}
        # See: https://developer.atlassian.com/cloud/confluence/oauth-2-3lo-apps/#3-2-construct-the-request-url
        cloud_id = oauth_client.cloud_id
        if not cloud_id:
            raise DemistoException(
                "Cloud ID is required for OAuth 2.0 authentication. "
                "Confluence Cloud OAuth 2.0 (3LO) requests must use the Atlassian API gateway. "
                "Please configure the Cloud ID parameter in the integration instance settings."
            )
        oauth_base_url = f"https://api.atlassian.com/ex/confluence/{cloud_id}"
        demisto.debug(f"{LOGGING_INTEGRATION_NAME} OAuth base_url: {oauth_base_url}")

        return Client(
            base_url=oauth_base_url,
            verify=verify_certificate,
            proxy=proxy,
            headers=headers,
        )
    else:
        # Basic authentication (email + API token)
        credentials = params.get("username", {})
        username = credentials.get("identifier", "").strip() if credentials.get("identifier") else ""
        password = credentials.get("password", "")

        if not username or not password:
            raise ValueError("Basic authentication requires Email and API Token.")

        demisto.debug(f"{LOGGING_INTEGRATION_NAME} Using Basic authentication")

        return Client(
            base_url=base_url,
            verify=verify_certificate,
            proxy=proxy,
            headers=headers,
            auth=(username, password),
        )


""" MAIN FUNCTION """


def main() -> None:  # pragma: no cover
    """
    main function, parses params and runs command functions
    """
    params = demisto.params()
    command = demisto.command()
    args = demisto.args()

    demisto.debug(f"{LOGGING_INTEGRATION_NAME} Command being called is {command}")
    try:
        # Get authentication parameters
        auth_method = params.get("auth_method", "Basic")
        is_oauth = auth_method == "OAuth 2.0"

        # OAuth client initialization
        oauth_client = None
        if is_oauth:
            oauth_client = create_oauth_client(params)

        # Commands dictionary
        commands: dict[str, Callable] = {
            "confluence-cloud-group-list": confluence_cloud_group_list_command,
            "confluence-cloud-user-list": confluence_cloud_user_list_command,
            "confluence-cloud-content-search": confluence_cloud_content_search_command,
            "confluence-cloud-content-update": confluence_cloud_content_update_command,
            "confluence-cloud-content-delete": confluence_cloud_content_delete_command,
            "confluence-cloud-content-list": confluence_cloud_content_list_command,
            "confluence-cloud-space-list": confluence_cloud_space_list_command,
            "confluence-cloud-comment-create": confluence_cloud_comment_create_command,
            "confluence-cloud-content-create": confluence_cloud_content_create_command,
            "confluence-cloud-space-create": confluence_cloud_space_create_command,
            "confluence-cloud-content-get": confluence_cloud_content_get_command,
            # --- REST API v2 commands ---
            "confluence-cloud-page-create": confluence_cloud_page_create_command,
            "confluence-cloud-page-list": confluence_cloud_page_list_command,
            "confluence-cloud-page-update": confluence_cloud_page_update_command,
            "confluence-cloud-page-delete": confluence_cloud_page_delete_command,
            "confluence-cloud-blogpost-create": confluence_cloud_blogpost_create_command,
            "confluence-cloud-blogpost-list": confluence_cloud_blogpost_list_command,
            "confluence-cloud-blogpost-update": confluence_cloud_blogpost_update_command,
            "confluence-cloud-blogpost-delete": confluence_cloud_blogpost_delete_command,
            "confluence-cloud-footer-comment-create": confluence_cloud_footer_comment_create_command,
            "confluence-cloud-space-listv2": confluence_cloud_space_list_command_v2,
            "confluence-cloud-space-createv2": confluence_cloud_space_create_command_v2,
            "get-file-content": confluence_cloud_generic_file_get_command,
        }

        strip_args(args)
        remove_nulls_from_dictionary(args)
        limit = int(arg_to_number(params.get("max_events_per_fetch", 10000)))  # type:ignore

        # Handle OAuth commands first (they don't need a client)
        if command == "confluence-cloud-oauth-start":
            if not oauth_client:
                raise DemistoException("OAuth commands are only available when using OAuth 2.0 authentication")
            return_results(oauth_start_command(oauth_client))

        elif command == "confluence-cloud-oauth-complete":
            if not oauth_client:
                raise DemistoException("OAuth commands are only available when using OAuth 2.0 authentication")
            code = args.get("code", "")
            if not code:
                raise DemistoException("Authorization code is required")
            return_results(oauth_complete_command(oauth_client, code))

        elif command == "confluence-cloud-oauth-test":
            if not oauth_client:
                raise DemistoException("OAuth commands are only available when using OAuth 2.0 authentication")
            return_results(oauth_test_command(oauth_client))

        elif command == "test-module":
            if oauth_client:
                # For OAuth, test the authentication
                oauth_client.test_connection()
                demisto.results("ok")
            else:
                # For basic auth, create client and test
                client = create_client(params, oauth_client)
                return_results(test_module(client))

        elif command in commands:
            client = create_client(params, oauth_client)
            return_results(commands[command](client, args))

        elif command == "fetch-events":
            client = create_client(params, oauth_client)
            events, last_run_object = fetch_events(client, limit, demisto.getLastRun())
            if events:
                add_time_to_events(events)
                send_events_to_xsiam(events, vendor=VENDOR, product=PRODUCT)
                demisto.setLastRun(last_run_object)

        elif command == "confluence-cloud-get-events":
            client = create_client(params, oauth_client)
            demisto.debug(f"Fetching Confluence Cloud events with the following parameters: {args}")
            should_push_events = argToBoolean(args.get("should_push_events", False))
            events, command_results = get_events(client, args)
            return_results(command_results)
            if should_push_events:
                send_events_to_xsiam(events, vendor=VENDOR, product=PRODUCT)
    # Log exceptions and return errors
    except Exception as e:
        return_error(f"Failed to execute {demisto.command()} command.\nError:\n{e!s}")


""" ENTRY POINT """

if __name__ in ("__main__", "__builtin__", "builtins"):
    main()