Skip to content

added confluence-cloud-content-get to Atlassian Confluence Cloud Inte… #40623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: contrib/shysh-cmd_feature/add-confluence-cloud-content-get
Choose a base branch
from

Conversation

shysh-cmd
Copy link

…gration

Contributing to Cortex XSOAR Content

Make sure to register your contribution by filling the contribution registration form

The Pull Request will be reviewed only after the contribution registration form is filled.

Status

  • In Progress
  • Ready
  • In Hold - (Reason for hold)

Description

added confluence-cloud-content-get to Atlantis Confluence Cloud Integration

Must have

  • Tests
  • Documentation

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@content-bot content-bot added Community Contribution Form Filled Whether contribution form filled or not. labels Jul 16, 2025
@content-bot content-bot added Contribution Thank you! Contributions are always welcome! External PR Xsoar Support Level Indicates that the contribution is for XSOAR supported pack labels Jul 16, 2025
@content-bot content-bot changed the base branch from master to contrib/shysh-cmd_feature/add-confluence-cloud-content-get July 16, 2025 13:51
@content-bot content-bot requested a review from merit-maita July 16, 2025 13:51
@content-bot
Copy link
Collaborator

Thank you for your contribution. Your generosity and caring are unrivaled! Make sure to register your contribution by filling the Contribution Registration form, so our content wizard @merit-maita will know the proposed changes are ready to be reviewed.
For your convenience, here is a link to the contributions SLAs document.

@content-bot
Copy link
Collaborator

Hi @shysh-cmd, thanks for contributing to the XSOAR marketplace. To receive credit for your generous contribution please follow this link.

Copy link
Contributor

@merit-maita merit-maita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you very much for your contribution!
i added a couple of comments, please take a look.
in addition to that, please add a unit test to the added command, and add the new command to the readme file.
thanks

Comment on lines +968 to +980
def validate_get_content_args(args: dict[str, str]):
"""
Validate arguments for confluence-cloud-content-get 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"))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to add this validation, just add the key "required: true" to the arg in the yml file

"""
validate_get_content_args(args)

content_id = args["content_id"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
content_id = args["content_id"]
content_id = args.get("content_id")


content_id = args["content_id"]
params = {"body-format":"raw"}
request_url = URL_SUFFIX["CONTENT"] + f"/{content_id}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use urljoin() from commonserverpython you can rewrite the line as:
request_url = urljoin(URL_SUFFIX.get("CONTENT"), content_id)
and import the function in the integration

content_id = args["content_id"]
params = {"body-format":"raw"}
request_url = URL_SUFFIX["CONTENT"] + f"/{content_id}"
params = {"expand":"body.storage"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you add this line like this, it overrides your previous definition: params = {"body-format":"raw"}

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

context = remove_empty_elements_for_context(response_json)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have a common function in CommonServerPython that does this job it's called "remove_empty_elements()" you can use it

readable_hr = prepare_hr_for_content_create(response_json, "Content")

return CommandResults(
outputs_prefix=OUTPUT_PREFIX["CONTENT"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
outputs_prefix=OUTPUT_PREFIX["CONTENT"],
outputs_prefix=OUTPUT_PREFIX.get("CONTENT"),

params = {"expand":"body.storage"}

response = client.http_request(method="GET", url_suffix=request_url, params=params)
response_json = response.json()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the search returned not found, the command should not return an error, the readable should states that the content was not found and not fail the command, please verify this case

@@ -2040,6 +2040,12 @@ script:
- contextPath: ConfluenceCloud.Event.associatedObjects.objectType
description: Type of the associated object.
type: String
- arguments:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add the outputs of the command


##### Atlassian Confluence Cloud

- Added support for **confluence-cloud-content-get** command that retrieves a content item by content id.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Added support for **confluence-cloud-content-get** command that retrieves a content item by content id.
- Added the **confluence-cloud-content-get** command to retrieve a content item.

@merit-maita merit-maita added the pending-contributor The PR is pending the response of its creator label Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contribution Form Filled Whether contribution form filled or not. Contribution Thank you! Contributions are always welcome! External PR pending-contributor The PR is pending the response of its creator Xsoar Support Level Indicates that the contribution is for XSOAR supported pack
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants