Extract information from alerts
Asked by Jean-Pierre KELLER:

Hello,

When I extract the information from the alerts in Opsgenie, I would like to add the "tags" in the generated CSV file. How should I proceed?  
Thank you

Cordially

Jean-Pierre KELLER


Answers:
author: Muhammad Zeeshan
body: Hey Jean-Pierre,

When you download the CSV file generated from the Alerts List page in Opsgenie GUI, it contains information on limited fields, *not including the tags field*.

Therefore, if you would like to extract the Alerts List with all the information, I would suggest using the List Alerts API: <https://docs.opsgenie.com/docs/alert-api#list-alerts> where you can list multiple alerts with information on more alert fields, including tags.

As the resulting data is in JSON and you would like a CSV, you can use a simple JSON to CSV convertor to get the data in a CSV for example this online tool here: <https://www.convertcsv.com/json-to-csv.htm>

Regards,  
Zeeshan from Opsgenie Support

comments: author: Muhammad Zeeshan
body: Furthermore, would just like to add that we do have a Feature Request \[**ALX-3217**\] which would allow customizing the fields you can add in the CSV that can be then directly generated from the Opsgenie GUI. I shall update you here once it is implemented.

*** ** * ** ***

Please note that our Product team reviews all feature requests together and they prioritize those with higher demand to be implemented first and any feature requests will take months until is ready since it needs to go through Design, Development, Testing, and rolling out to Production.

Further, every feature requests tickets are logged on our internal system without public access for our customers.


author: Jean-Pierre KELLER
body: How do I integrate my filter in the query: "description: Threshold of 98% reached for the service"  
'<https://api.opsgenie.com/v2/alerts?query=description>: 98% threshold reached for the service' gives me a "bad request" error


author: Muhammad Zeeshan
body: Hey Jean-Pierre,

You can try the following:

<https://api.opsgenie.com/v2/alerts?query=description%3A%2298%25%22>


author: Jean-Pierre KELLER
body: sorry this URL doesn't open

```
{"message":"Could not authenticate","took":0.0,"requestId":"aa703b86-d0f3-4607-9651-704fc3a15eea"}
```


author: Muhammad Zeeshan
body: It could be that your account is in the EU region. Hence you can try:

<https://api.eu.opsgenie.com/v2/alerts?query=description%3A%2298%25%22>


author: Jean-Pierre KELLER
body: same result :

```
{"message":"Could not authenticate","took":0.001,"requestId":"b3edb3c6-3068-4853-8198-e6570b1cd465"}
```


author: Muhammad Zeeshan
body: Hey Jean-Pierre,

If you are directly running this API query in the browser you will need to add the apiKey parameter as well and define an API key from your account there the following way:

[https://api.opsgenie.com/v2/alerts?query=description%3A%2298%25%22\&apiKey=XXX-XX-XXX](https://api.opsgenie.com/v2/alerts?query=description%3A%2298%25%22&apiKey=XXX-XX-XXX)

or for EU:

[https://api.eu.opsgenie.com/v2/alerts?query=description%3A%2298%25%22\&apiKey=XXX-XX-XXX](https://api.eu.opsgenie.com/v2/alerts?query=description%3A%2298%25%22&apiKey=XXX-XX-XXX)


author: Jean-Pierre KELLER
body: it works.  
thanks a lot for your help


Tags: cloud