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

I'm trying to pull extra key properties from a REST API Alert creation and need better examples

Mikel Stous July 5, 2023

We are successfully creating Alerts and are sending extra key pairs, but the key pairs are not showing.

      eg.  Node: SEAVM01, NodeLocation: Seattle, NodeLocalTimeZone: PDT

I've looked at the following pages:

These pages have warning boxes that say:

  • Note that accessing request url, payload and headers parameters is not available for actions via Alert API
  • Dynamic fields (custom priority, payload, url, and headers) are not available for API integration.

However the API integration page has space for adding Extra Properties key pairs

Screenshot 2023-07-05 172040.jpeg

Is it:

Name                      Value

Node                       {{Node}}

Node                       {{details.Node}}

Node                       {{extraPropertiesKeyValue.Node}}

{{extraProperties}}   {{extraPropertiesKeyValue}}

 

The documentation looks like the API Integrations page has changed and so not sure proper format. 

1 answer

0 votes
John M
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 6, 2023

Hi @Mikel Stous ,

The documentation looks a bit different because there are different plans and some plans have access to the "advanced settings" in the integrations. 

You actually don't need to add anything to the ExtraProperties field; you can simply leave the default value of {{extraProperties}} there and then in the API payload you will need to add the extraProperties key (along with your values), which would look like this:

 

"extraProperties": [{"key1": "value1"},{"key2": "value2"}]
Mikel Stous July 12, 2023

We've tried it with "extraProperties": [{"key1": "value1"},{"key2": "value2"}]

and we've tried it with  "extraProperties": { "serverName": "Zion", "region": "Oregon" }  as per API documentation.  https://docs.opsgenie.com/docs/incident-api#get-incident

We were able to verify our JSON output and the Alert comes through fine,

John M
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 12, 2023

Hi @Mikel Stous ,

Please post your entire request with the headers so I can help (please remember to redact your API key).

Mikel Stous July 14, 2023

They figured it out

We're using the Alert API (https://docs.opsgenie.com/docs/alert-api), so we needed to put it in the key pair map as "details", and we also needed "isExtraPropertiesWithKey" (mentioned in https://docs.opsgenie.com/docs/integration-api#create-a-new-integration-action)

"details":{"key1":"value1","key2":"value2"},

"isExtraPropertiesWithKey": true,

In OpsGenie, would specifying {{details}} have worked instead of {{extraProperties}}?

John M
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 14, 2023

@Mikel Stous You're right, it should be "details" as the key instead of "extraProperties" for creating the alert. I was using the integration API. But I was able to process it without the "isExtraPropertiesWithKey: true" flag, just using the default payload here: https://docs.opsgenie.com/docs/alert-api#create-alert

The "details" key in the payload will match up to "extraProperties" in the Opsgenie UI so you want to leave that as "extraProperties" on the integration. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events