Get Extra properties from Alert using https://api.opsgenie.com/v2/alerts
Asked by Rakesh Panchal:

I am trying to get the "Extra properties" using the Alert API. How should I construct the params to get all "Extra properties" associated with alert?

I tried "isExtraPropertiesWithKey=true" but still it did not gave me the "Extra properties" in the Json response.

![Postman-screenshot.png](/t5/image/serverpage/image-id/316143i3560C4BC4A12B371/image-size/large?v=v2&px=999 "Postman-screenshot.png")


Answers:
author: Rakesh Panchal
body: Hi [@Nick H](/t5/user/viewprofilepage/user-id/2540930)

I tried to pull the individual alert as you mentioned.

One of the alert I picked has the extra properties in the alert as shown below

![Screenshot 2024-04-04 at 4.46.58?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/316452iEDAA40855F4AD703/image-size/large?v=v2&px=999 "Screenshot 2024-04-04 at 4.46.58?PM.png")

After getting the response in Postman I searched for the \`alerts@splunkcloud.com\` in Json body but it did not show it.

![Screenshot 2024-04-04 at 4.48.29?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/316453i748D371F8C72CFB4/image-size/large?v=v2&px=999 "Screenshot 2024-04-04 at 4.48.29?PM.png")

Even there is no details json attribute in the body

comments: author: Nick H
body: Hi [@Rakesh Panchal](/t5/user/viewprofilepage/user-id/5468555) ,

I can't say for certain those aren't the same alerts, but the top screenshot in Opsgenie shows the alert being a P3, while your Postman screenshot shows the alert being P4 - which leads me to believe those are not the same.


author: Rakesh Panchal
body: Sorry for the confusion [@Nick H](/t5/user/viewprofilepage/user-id/2540930) . Here is the better screenshots

![Screenshot 2024-04-05 at 9.57.44?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/316711i0FBDF3B694C38ACB/image-size/large?v=v2&px=999 "Screenshot 2024-04-05 at 9.57.44?AM.png")

Json response

![Screenshot 2024-04-05 at 9.58.21?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/316712iB9FCFE222A7F5655/image-size/large?v=v2&px=999 "Screenshot 2024-04-05 at 9.58.21?AM.png")


author: Nick H
body: Not sure what parameter you are using in the URL, but can you try running a GET on the tiny ID of that alert to see if you have the same results? Your URL would be:

<https://api.opsgenie.com/v2/alerts/87312?identifierType=tiny>

This *should* return the extra properties in the details of the JSON body, and I'm assuming you might be querying on another alert still. For example:

![ep4.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/316719i7F0BDD8653D7257B/image-size/large?v=v2&px=999 "ep4.jpg")![ep5.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/316718i996C9B982B4E4EC6/image-size/large?v=v2&px=999 "ep5.jpg")


author: Rakesh Panchal
body: This worked Thanks a lot !!!


author: Nick H
body: Hi [@Rakesh Panchal](/t5/user/viewprofilepage/user-id/5468555) ,

If you are running a GET on an individual alert, the extra properties should return in the JSON body without any sort of query needed under the **details** of the alert:

![ep1.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/316148i80189119A89F73DA/image-size/large?v=v2&px=999 "ep1.jpg")

If you are trying to run a GET on alerts that contain extra properties, you would need to query on these using the **details** since this is where the extra properties parse.

Our [documentation](https://support.atlassian.com/opsgenie/docs/search-queries-for-alerts/) mentions using details, details.key and/or details.value - but you could also use something like this as well for [null queries](https://support.atlassian.com/opsgenie/docs/search-queries-for-alerts/#Null-Queries):

```
details.key is not null
```

![ep2.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/316149i52EC66754C0E225D/image-size/large?v=v2&px=999 "ep2.jpg")![ep3.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/316150i0AE6BCEB6AF43AEB/image-size/large?v=v2&px=999 "ep3.jpg")

After I know the query in the Opsgenie UI, I typically copy / paste it into a [URL encoder](https://www.urlencoder.org/) to ensure I am using the correct parameters in the [Alert API](https://docs.opsgenie.com/docs/alert-api).

comments: author: Rakesh Panchal
body: Hi [@Nick H](/t5/user/viewprofilepage/user-id/2540930)

Thanks for your response.

I am not doing GET on individual Alert. I am getting data based on "updatedAt" between a certain time frame. and in this case I am not getting the **details**attribute in the Json response.

Here is the

[https://api.opsgenie.com/v2/alerts?query=updatedAt%3E1709477722%20AND%20updatedAt%3C1712156122\&limit=100\&offset=0\&isExtraPropertiesWithKey=true](https://api.opsgenie.com/v2/alerts?query=updatedAt%3E1709477722%20AND%20updatedAt%3C1712156122&limit=100&offset=0&isExtraPropertiesWithKey=true)

Would you please able to guide me what else needs to be passed to get the details (extra properties)?


author: Nick H
body: I don't believe it's possible to return the extra properties on a [List Alert API](https://docs.opsgenie.com/docs/alert-api#list-alerts). There's a sample response in the documentation and not shown in it is the extra properties (aka the details) of the alerts.

So you would need to run an individual GET on each alert to return the extra properties, or create some script that runs a GET on each alert once you have the query needed. Unfortunately I don't have a script to share.


author: Rakesh Panchal
body: Thanks a lot [@Nick H](/t5/user/viewprofilepage/user-id/2540930)


Tags: cloud

extraproperties