Hi All,
I'm trying to use the Integration API to create a new CloudWatch integration then dynamically add new integration actions to that integration.
The CloudWatch integration gets set up fine. I then take the values for IntegrationId and ApiKey from the new integration and try to add a new action to that integration.
I get error 422 Unprocessable Entity. It doesn't like the format of my json. I've been sure to only include mandatory fields.
Input params are as follows.
$uri = 'https://api.opsgenie.com/v2/integrations/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/actions'
$api = 'GenieKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
$head = @{"Authorization" = "$api"}
$body = @{"type"="create";"name"="Create Alert -Test";"alias"="alias for this alert"} | ConvertTo-Json
Or
$body = '{\"type\":\"create\",\"name\":\"Create Alert -Test\",\"alias\":\"alias for this alert\"}'
$data = Invoke-RestMethod -Uri $uri -Method Post -Headers $head -ContentType "application/json" -Body $body
The response is:
Invoke-RestMethod : The remote server returned an error: (422) Unprocessable Entity.
At line:1 char:9
Can anyone help me to get the integration to accept this JSON?
Bear in mind, this is a CloudWatch API integration and not the Default API integration.
Any assistance would be greatly appreciated.
Hi Joel,
It looks like the following fields are also required for the create action:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.