I'm trying to pull extra key properties from a REST API Alert creation and need better examples
Asked by Mikel Stous:

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:

* <https://support.atlassian.com/opsgenie/docs/create-a-default-api-integration/>
* <https://support.atlassian.com/opsgenie/docs/use-advanced-integration-settings/>
* <https://support.atlassian.com/opsgenie/docs/dynamic-fields-in-opsgenie-integrations/>

These pages have warning boxes that say:

* Note that accessing request url, payload and headers parameters is not available for actions via [++Alert API++](https://docs.opsgenie.com/docs/alert)
* 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](/t5/image/serverpage/image-id/267017i8D9D810171C794D9/image-size/large?v=v2&px=999 "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.


Answers:
author: John M
body: Hi [@Mikel Stous](/t5/user/viewprofilepage/user-id/4620772) ,

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"}\]

comments: author: Mikel Stous
body: 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,


author: John M
body: Hi [@Mikel Stous](/t5/user/viewprofilepage/user-id/4620772) ,

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


author: Mikel Stous
body: 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}}?


author: John M
body: [@Mikel Stous](/t5/user/viewprofilepage/user-id/4620772) 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.


Tags: api

rest

rest-api