When executing the action [Create Incident], the following error occurs and the incident cannot be created.
There was an error creating a new incident.400 Client Error: Bad Request for url: https://api.pagerduty.com/incidents
[What I did to resolve the issue]
- Check the settings
I ran TEST from [Integrations Setup] > [Configuration] and confirmed that it worked.
- Run Ping
I ran [IDE] > [PagerDuty] > [Ping] and confirmed that it worked.
Can someone help me to solve this problem?
Best answer by _K_O
Hi @hmd,
When we were initially integrating with PD we had the same issue - the main problem was the difference between V1 and V2 APIs as the PD integration from the marketplace doesn’t use the latest API calls. To solve it I had to create a new action for the V2 API. I’ve included the custom action below - this works for my environment, YMMV:
from SiemplifyAction import SiemplifyAction from SiemplifyUtils import unix_now, convert_unixtime_to_datetime, output_handler from ScriptResult import EXECUTION_STATE_COMPLETED, EXECUTION_STATE_FAILED,EXECUTION_STATE_TIMEDOUT import requests
# If we see the string 'message' in the response, assume it completed. If not, then # error out with the details provided by the API. if 'message' in response.text: status = 0 output_message = "Event sent to PagerDuty" siemplify.result.add_result_json(response.text) result_value = "Event sent to PagerDuty" else: status = 2 output_message = response.text result_value = response.text
When we were initially integrating with PD we had the same issue - the main problem was the difference between V1 and V2 APIs as the PD integration from the marketplace doesn’t use the latest API calls. To solve it I had to create a new action for the V2 API. I’ve included the custom action below - this works for my environment, YMMV:
from SiemplifyAction import SiemplifyAction from SiemplifyUtils import unix_now, convert_unixtime_to_datetime, output_handler from ScriptResult import EXECUTION_STATE_COMPLETED, EXECUTION_STATE_FAILED,EXECUTION_STATE_TIMEDOUT import requests
# If we see the string 'message' in the response, assume it completed. If not, then # error out with the details provided by the API. if 'message' in response.text: status = 0 output_message = "Event sent to PagerDuty" siemplify.result.add_result_json(response.text) result_value = "Event sent to PagerDuty" else: status = 2 output_message = response.text result_value = response.text