Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Packs/Confluence/Integrations/Confluence/Confluence.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,12 @@ def update_content_command():
)


def create_content(content_type, content_title, space_key, content_body):
def create_content(content_type, content_title, space_key, ancestor_id, content_body):
content_data = {
"type": content_type,
"space": {"key": space_key},
"title": content_title,
"ancestors": [{"id":ancestor_id}],
"body": {"storage": {"value": content_body, "representation": "storage"}},
}

Expand All @@ -168,9 +169,10 @@ def create_content_command():
content_type = demisto.args().get("type")
content_title = demisto.args().get("title")
space_key = demisto.args().get("space")
ancestor_id = demisto.args().get("ancestor_id", 0)
content_body = demisto.args().get("body")

raw_content = create_content(content_type, content_title, space_key, content_body)
raw_content = create_content(content_type, content_title, space_key, ancestor_id, content_body)

content = {
"ID": raw_content["id"],
Expand Down
4 changes: 4 additions & 0 deletions Packs/Confluence/Integrations/Confluence/Confluence.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ script:
- name: space
required: true
description: Space key to add content to a specific space.
- name: ancestorid
required: false
description: ID of parent folder or parent page, 0 to append the content to the space root.
defaultValue: 0
- name: body
description: Confluence page body to add.
outputs:
Expand Down
4 changes: 2 additions & 2 deletions Packs/Confluence/Integrations/Confluence/Confluence_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ def test_create_content_command(mocker):
mocker.patch.object(
demisto, "params", return_value={"url": "url", "credentials": {"identifier": "identifier", "password": "password"}}
)
mocker.patch.object(demisto, "args", return_value={"type": "type", "title": "title", "space": "space", "body": "body"})
mocker.patch.object(demisto, "args", return_value={"type": "type", "title": "title", "space": "space", "ancestorid": "ancestorid", "body": "body"})

import Confluence

mocker.patch.object(Confluence, "http_request", return_value={"id": "id", "title": "title", "space": "space", "body": "body"})
mocker.patch.object(Confluence, "http_request", return_value={"id": "id", "title": "title", "space": "space", "ancestorid": "ancestorid", "body": "body"})

Confluence.create_content_command()

Expand Down
1 change: 1 addition & 0 deletions Packs/Confluence/Integrations/Confluence/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Creates Confluence content for a given space.
| title | Confluence page title. | Required |
| type | Confluence content type. Can be "page" or "blogpost". Possible values are: page, blogpost. Default is page. | Required |
| space | Space key to add content to a specific space. | Required |
| ancestorid | ID of parent folder or parent page, 0 to append the content to the space root. | Optional |
| body | Confluence page body to add. | Optional |

#### Context Output
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
!confluence-create-space name=test description="testing space" key=TEST
!confluence-create-content space=DemistoContent title="test confluence integration" type=page body=testing
!confluence-create-content space=DemistoContent title="test confluence integration" type=page ancestorid=0 body=testing
!confluence-list-spaces
!confluence-get-content key=DemistoContent title="test confluence integration"
!confluence-delete-content id=172723162
Expand Down