Skip to content

Fix/XSUP-70513/ManageEngine check response status#44548

Draft
MosheEichler wants to merge 2 commits into
masterfrom
fix/XSUP-70513/ManageEngine-check-response-status
Draft

Fix/XSUP-70513/ManageEngine check response status#44548
MosheEichler wants to merge 2 commits into
masterfrom
fix/XSUP-70513/ManageEngine-check-response-status

Conversation

@MosheEichler
Copy link
Copy Markdown
Contributor

@MosheEichler MosheEichler commented Jun 7, 2026

Status

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

Related Issues

https://jira-dc.paloaltonetworks.com/browse/XSUP-70513

Description

The integration always returns HTTP 200, even when an operation is rejected by the server.

Root Cause

When mandatory fields such as Technician or Resolution are not populated, ManageEngine rejects the status change and returns:

{"response_status": {"status": "warning", "status_code": 3000, "messages": [{"fields": ["technician", "resolution"], "status_code": 4003, "type": "warning"}]}}

The integration was not inspecting this object and reported success regardless.

Fixed

Added check_response_status() helper that inspects response_status in the API JSON body and raises a DemistoException with the server's message when the operation was not successful.

For more details: https://www.manageengine.com/products/service-desk/sdpod-v3-api/getting-started/common-error-code.html

Must have

  • Tests
  • Documentation

@MosheEichler MosheEichler added release-notes-only Indicates that this pull request has ONLY release notes to review for documentation process ready-for-pipeline-running Whether the pr is ready for running the whole pipeline, including testing on SAAS machines ready-for-ai-review The PR is ready for reviewing the PR with the AI Reviewer. labels Jun 7, 2026
@content-bot
Copy link
Copy Markdown
Contributor

🤖 AI-Powered Code Review Available

You can leverage AI-powered code review to assist with this PR!

Available Commands:

  • @marketplace-ai-reviewer start review - Initiate a full AI code review
  • @marketplace-ai-reviewer re-review - Incremental review for new commits

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 7, 2026

Coverage

Coverage Report
FileStmtsMissCoverMissing
Packs/ServiceDeskPlus/Integrations/ServiceDeskPlus
   ServiceDeskPlus.py4496984%145, 156, 166–167, 174, 176–177, 185–189, 191–192, 195–201, 203–205, 209, 257, 278, 506, 517, 530–531, 806, 910–913, 942, 979, 985, 988–989, 1022, 1027–1034, 1047–1048, 1062, 1076, 1082–1083, 1085–1094, 1096–1098
TOTAL4496984% 

Tests Skipped Failures Errors Time
69 0 💤 0 ❌ 0 🔥 2.467s ⏱️

@marketplace-ai-reviewer marketplace-ai-reviewer removed the ready-for-ai-review The PR is ready for reviewing the PR with the AI Reviewer. label Jun 7, 2026
@marketplace-ai-reviewer
Copy link
Copy Markdown
Contributor

🤖 Analysis started. Please wait for results...

@content-bot
Copy link
Copy Markdown
Contributor

Validate summary
The following errors were thrown as a part of this pr: RN107, RN114, DO106.
The following errors can be ignored: RN107, RN114.
The following errors cannot be ignored: DO106.
If the AG100 validation in the pre-commit GitHub Action fails, the pull request cannot be force-merged.
The following errors don't run as part of the nightly flow and therefore can be force merged: RN107, RN114, DO106.

Verdict: PR can be force merged from validate perspective? ✅

marketplace-ai-reviewer

This comment was marked as outdated.

@tcarmeli1 tcarmeli1 added the ready-for-ai-review The PR is ready for reviewing the PR with the AI Reviewer. label Jun 7, 2026
@marketplace-ai-reviewer marketplace-ai-reviewer removed the ready-for-ai-review The PR is ready for reviewing the PR with the AI Reviewer. label Jun 7, 2026
@marketplace-ai-reviewer
Copy link
Copy Markdown
Contributor

🤖 Analysis started. Please wait for results...

@marketplace-ai-reviewer
Copy link
Copy Markdown
Contributor

🤖 AI Review Disclaimer

This review was generated by an AI-powered tool and may contain inaccuracies. Please be advised, and we extend our sincere apologies for any inconvenience this may cause.

Copy link
Copy Markdown
Contributor

@marketplace-ai-reviewer marketplace-ai-reviewer left a comment

Choose a reason for hiding this comment

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

Hi! Thanks for your contribution to the ServiceDeskPlus integration. I've left a few notes to help improve the robustness of the code, particularly around safely handling null values and missing fields in the API responses to prevent unexpected errors. I also suggested centralizing the response status checks within the HTTP client and fixing a minor formatting issue in the Release Notes. Great work overall!

Additionally, please address the following file-level notes:

  • Packs/ServiceDeskPlus/Integrations/ServiceDeskPlus/ServiceDeskPlus.py: Consider calling check_response_status centrally inside Client.http_request.

@DeanArbel, @marketplace-ai-reviewer, @kamalq97, @MosheEichler please review and approve the results generated by the AI Reviewer by responding 👍 on this comment.

messages = response_status.get("messages", [])
message_texts = []
for msg in messages:
text = msg.get("message") or ", ".join(str(f) for f in msg.get("fields", []))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Prevent potential TypeError and AttributeError if API returns null for fields or type.

        fields = msg.get("fields") or []
        text = msg.get("message") or ", ".join(str(f) for f in fields)
        if text:
            msg_type = msg.get("type") or "error"
            message_texts.append(f"[{msg_type.upper()}] {text}")

success_response = {"response_status": {"status": "success", "status_code": 2000, "messages": []}}
# Should not raise
check_response_status(success_response)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Consider adding a test case for a response where response_status is missing entirely.

if not response_status:
return

status = response_status.get("status", "success")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ensure robust handling of null values and type mismatches in the API response.

    status = response_status.get("status") or "success"
    status_code = response_status.get("status_code") or 2000

    # 2000 / "success" means the operation completed without issues
    if status == "success" and str(status_code) == "2000":
        return

@@ -0,0 +1,5 @@
#### Integrations

##### Manage Engine Service Desk Plus
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The content item header must match the display name of the integration as defined in its YAML file.

Suggested change
##### Manage Engine Service Desk Plus
##### Service Desk Plus

@content-bot
Copy link
Copy Markdown
Contributor

🔍 AI Triage Report Available

An automated triage report has been generated for this pipeline.

Status: partial
Report ID: 61e965a4a6a1de6a

📋 Triage Report
💡 Resolutions are available in the full report.

⚠️ AI-generated triage. Validate before acting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-approved ready-for-pipeline-running Whether the pr is ready for running the whole pipeline, including testing on SAAS machines release-notes-only Indicates that this pull request has ONLY release notes to review for documentation process

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants