Update Cortex Xpanse asm-list-external-websites command to include pa…
…gination support.
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
- [x] Ready
- [ ] In Hold - (Reason for hold)
Related Issues
Currently, asm-list-external-websites can only ever retrieve the first 500 websites and organizations have way more than that.
Description
Update asm-list-external-websites command to allow for pagination of requests.
API Reference: https://docs-cortex.paloaltonetworks.com/r/Cortex-Xpanse-REST-API/Get-All-Websites
Must have
- [ ] Tests
- [ ] Documentation
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 @itssapir will know the proposed changes are ready to be reviewed. For your convenience, here is a link to the contributions SLAs document.
Hi @zdrouse, thanks for contributing to the XSOAR marketplace. To receive credit for your generous contribution please follow this link.
@zdrouse , thank you for the submission. What were your thoughts on using this? With raw-response=true only?
@zdrouse , thank you for the submission. What were your thoughts on using this? With raw-response=true only?
@johnnywilkes you are asking my thoughts on giving this command support for paging? We need to retrieve all of the external websites in Xpanse from XSOAR. Without paging support, we cannot do this. From there, a subplaybook or automation can be built to repeatedly call the command using the next_page_token until the last page is reached.
@zdrouse , I understand why you want paging support. However, I am not sure with your change how it is usable. The command doesn't seem to expose next_page_token to context. Can you explain how you are using the command as-is?
If not, please look into changes to add next_page_token to context
@johnnywilkes I see. Yes, usually when I am using commands on playbook tasks I typically utilize extend-context with the raw response in order to see all the data or pick and choose what I want from the raw response. I find often that I cannot rely on the implemented outputs of the command results because it is either missing data or doesn't provide it in the format I need which I suppose is the point you are making. I've adjusted the output in the integration for this command to provide another node in context for this information. I had to adjust the outputs_prefix in order to preserve the existing context expected from the command.
Adding a screenshot of context adjustments for reference.
Looks like we want to fit these standards: https://xsoar.pan.dev/docs/integrations/code-conventions#pagination-in-integration-commands
@zdrouse , reaching out on DFIR slack
Tests failing because context output change, reaching out on DFIR
@johnnywilkes updated to include an additional CommandResults object for ASM.ExternalWebsiteReply which is also using replace_existing=True per recommendations from CommandResults.
https://github.com/demisto/content/blob/5178b4c864b6417aa9ba110e7e2bf89fe0f137e9/Packs/Base/Scripts/CommonServerPython/CommonServerPython.py#L7229
@zdrouse , seeing an issue, will message on slack
seems to be underlying API issue that first response returns one less form limit:
testing commands and screenshots:
!asm-list-external-websites limit=2 use_page_token=true
!asm-list-external-websites next_page_token=
@zdrouse Any updates on this? I see its been a while since there was anything new here.
@itssapir , why is there no new build triggered?
@johnnywilkes I'm not sure, try resolving the conflicts and merging from master, this usually helps.
@zdrouse , i think you should fix this:
@zdrouse , i think you should fix this:
if I'm understanding correctly, it looks like the conflict was with the release note md version, there was an update deployed since I first opened this PR. I changed the version.
@itssapir, this is approved, please merge when possible
For the Reviewer: Trigger build request has been accepted for this contribution PR.
For the Reviewer: Successfully created a pipeline in GitLab with url: https://gitlab.xdr.pan.local/xdr/cortex-content/content/-/pipelines/4147675
@zdrouse Any updates on this?
@zdrouse Any updates on this?
Feel free to make the verbiage changes. We've been waiting for me on that?
For the Reviewer: Trigger build request has been accepted for this contribution PR.
For the Reviewer: Successfully created a pipeline in GitLab with url: https://gitlab.xdr.pan.local/xdr/cortex-content/content/-/pipelines/4269787
Thank you for your contribution. Your external PR has been merged and the changes are now included in an internal PR for further review. The internal PR will be merged to the master branch within 3 business days.
