Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,461,677
Community Members
 
Community Events
176
Community Groups

Error 422 Unprocessable Entity creating new Integration Action for CloudWatch integration.

Edited

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.

1 answer

1 accepted

0 votes
Answer accepted

Hi Joel,

It looks like the following fields are also required for the create action:

 

"user": "{{user}}",
"note": "{{note}}",
"source": "{{source}}",
"message": "{{message}}",
"description": "{{description}}",
"entity": "{{entity}}"

That doesn't seem to be very clear in the docs; I will put in a request to have them updated. 

Thank you John.
The requests are now getting through.

Like John M likes this

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events