Skip to content

Don't omit 'inputs' field in pagerduty_incident_workflow as it's required by the API#163

Merged
imjaroiswebdev merged 1 commit intoheimweh:masterfrom
tganderson0:master
Mar 19, 2025
Merged

Don't omit 'inputs' field in pagerduty_incident_workflow as it's required by the API#163
imjaroiswebdev merged 1 commit intoheimweh:masterfrom
tganderson0:master

Conversation

@tganderson0
Copy link

Currently, the client omits fields that are empty when serializing to JSON. However, the API endpoint https://api.pagerduty.com/incident_workflows/id, which is used for updating Incident Workflows, requires that the field inputs exists in the payload. This makes it so that you cannot use the create zoom room action (or any others that do not have an input) without a 'fake' input.

This also addresses the issue in PagerDuty/terraform-provider-pagerduty#840

API Response without the inputs defined

import requests

url = "https://api.pagerduty.com/incident_workflows/id"

payload = { "incident_workflow": {
        "name": "Example Incident Workflow",
        "description": "This Incident Workflow is an example",
        "steps": [
            {
                "name": "Send Status Update",
                "action_configuration": {
                    "action_id": "pagerduty.com:incident-workflows:send-status-update:1",
                }
            }
        ]
    } }
headers = {
    "Accept": "application/json",
    "Content-Type": "application/json",
    "Authorization": "Token token=---------"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())

> {'message': 'Invalid body: "incident_workflow.steps[0].action_configuration.inputs" is required'}

This is copied from my PR in the terraform provider which uses this client- PagerDuty/terraform-provider-pagerduty#992.

Copy link
Collaborator

@imjaroiswebdev imjaroiswebdev left a comment

Choose a reason for hiding this comment

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

@tganderson0 thank you very much for finding and patching this. 🏆

@imjaroiswebdev imjaroiswebdev merged commit 3d9cf89 into heimweh:master Mar 19, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants