# Events API V2

**URL:** <https://community.dynatrace.com/t/events-api-v2/34897>\
**Category:** Dynatrace API\
**Tags:** dynatrace-api\
**Created:** [April 20, 2022, 2:18pm UTC](https://community.dynatrace.com/t/events-api-v2/34897 "2022-04-20T14:18:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MariusNicolae](https://avatars.discourse-cdn.com/v4/letter/m/bc79bd/32.png) [@MariusNicolae](https://community.dynatrace.com/u/MariusNicolae)\
**Post date:** [April 20, 2022, 2:18pm UTC](https://community.dynatrace.com/t/events-api-v2/34897/1 "2022-04-20T14:18:31Z")

</div>

Hi everyone,

Recently I have found myself with the need to implement events from some custom bash scripts and send the events into dynatrace. I am sending an error event type right now in order to open a problem on the host on which the script is running on, but when I receive the email all of the fields are present but we only need a specific field to be present in the body.

For example the event that I send is like this

```markup
event="{
        \"eventType\": \"${eventType}\",
        \"title\": \"External.Check event title\",
        \"timeout\": 15,
        \"entitySelector\": \"type(host),entityName("${entity}")\",
        \"properties\": {
            \"allowDavisMerge\": \"false\",
            \"scriptPath\": \"${0}\",
            \"scriptName\": \"${scriptName}\",
            \"dt.event.description\": \"${scriptOutput}\"
        }
    }"

```

I only need the dt.event.description value to be sent by mail, the scriptPath and Name values should only be visible on dynatrace and not on the mail, but I can’t seem to figure out how to do it

 ![MariusNicolae_1-1650464071552.png](https://global.discourse-cdn.com/dynatrace/original/2X/f/fccdd89a6dc1fddb68a43c2a736ba513c79ba120.png)

For example this is the mail I get, and I don’t need the last 3 fields, I only need the first field with the name of the file that is missing, which is the dt.event.description field.

Does anyone know if this is doable? I searched around but I couldn’t find anything and the chat support had no idea how the events work and they said they have no documentation other than what is on the public website but it doesn’t seem to cover how you can filter what you need to send in a problem notification email

Thank you

Best regards

---

<div class="post-metadata">

**Author:** ![JamesKitson](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/jameskitson/32/22460_2.png) [@JamesKitson](https://community.dynatrace.com/u/JamesKitson)\
**Post date:** [April 20, 2022, 7:45pm UTC](https://community.dynatrace.com/t/events-api-v2/34897/2 "2022-04-20T19:45:41Z")

</div>

You can select the placeholders that are used in the email body, but you can’t further filter or customize what those placeholders contain. So if that is the HTML payload placeholder you can’t filter what it includes.

With that being said, there’s a few things you can try. I tried in my environment and setting the eventType to CUSTOM\_ALERT seems to change the body and it only included the following which looks like what you want:

![JamesKitson_0-1650483635036.png](https://global.discourse-cdn.com/dynatrace/original/3X/a/5/a5359dc9c359db1889e4b592af5ecb8e5c9af1da.png)

```markup
{
        "eventType": "CUSTOM_ALERT",
        "title": "External.Check event title",
        "timeout": 5,
        "entitySelector": 
        "type(host),entityName(\"example.com\")",
        "properties": {
            "dt.event.allow_davis_merge": false,
            "scriptPath": "/fake/path/",
            "scriptName": "fake.sh}",
            "dt.event.description": "output of the script"
         }
}

```

I don’t know what event type you are using but I saw the behavior you saw when it was set to a severity like AVAILABILITY.

CUSTOM\_ALERT also has the affect of disabling DAVIS analysis which is what would cause events to be merged together into problems which I see you are trying to disable.

And on that note, what you have there for disabling the event merging likely won’t work as that would need to be the reserved property&nbsp;dt.event.allow\_davis\_merge like you see in my example payload above. Note that&nbsp; **false** is not within quotes as it is a Boolean value. You can see the reserved properties by using the API call to list event properties.

---

<div class="post-metadata">

**Author:** ![MariusNicolae](https://avatars.discourse-cdn.com/v4/letter/m/bc79bd/32.png) [@MariusNicolae](https://community.dynatrace.com/u/MariusNicolae)\
**Post date:** [April 21, 2022, 7:21am UTC](https://community.dynatrace.com/t/events-api-v2/34897/3 "2022-04-21T07:21:27Z")

</div>

Hi James,

Thank you very much for your inputs, I am using an error event type of event sorry I forgot to mention it.

I am a bit confused about the reserved properties to be honest, on the events documentation I didn’t find info on everything and the example that is mentioned on the page has the allowDavisMerge property as a string value, is the example wrong?

 ![MariusNicolae_0-1650525396321.png](https://global.discourse-cdn.com/dynatrace/original/3X/e/2/e2430528b9cc254f827fd3ad37481ace3f260471.png)

> **[Events API v2 - POST an event](https://docs.dynatrace.com/docs/dynatrace-api/environment-api/events-v2/post-event)**
>
> Ingests an event via the Dynatrace API.

I found about the dt.event.description property from another community post as I was struggling to get the description field sent by mail and the chat support wasn’t aware of this property either.

Do you know if there is further documentation on the official website that I didn’t find about how the events work? I would love to get more insight into this as I found a very good usage for them.

Thank you!

Best regards

---

<div class="post-metadata">

**Author:** ![Yosi\_Neuman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/yosi_neuman/32/9845_2.png) [@Yosi\_Neuman](https://community.dynatrace.com/u/Yosi_Neuman)\
**Post date:** [April 21, 2022, 9:00am UTC](https://community.dynatrace.com/t/events-api-v2/34897/4 "2022-04-21T09:00:56Z")

</div>

Hi&nbsp;[@MariusNicolae](https://community.dynatrace.com/user/46046)

The documentation around Rest API is not helping and its under statement&nbsp;:facepalm:

I usually look at the schema part in the Rest API UI

 ![Yosi_Neuman_0-1650531420433.png](https://global.discourse-cdn.com/dynatrace/original/3X/7/6/76de2258c7ffc9025f7c3f84d6989979cd6714e1.png)

And trying to play around with the Rest API from the UI and check the outcomes, kind of trail and error.

For you question I would try to split the Rest calls into 2 first the one with the property you want to get the alert with and the other one with the rest of the properties.

From dynatrace perspective the second&nbsp; will join the first and you get only one alert.

The only problem will be with the close message that will contains all the properties

HTH

Yos

---

<div class="post-metadata">

**Author:** ![mark\_bley](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mark_bley/32/20954_2.png) [@mark\_bley](https://community.dynatrace.com/u/mark_bley)\
**Post date:** [April 21, 2022, 4:39pm UTC](https://community.dynatrace.com/t/events-api-v2/34897/5 "2022-04-21T16:39:05Z")

</div>

Hi&nbsp;[@MariusNicolae](https://community.dynatrace.com/user/46046),

the documentation is being worked on afaik in order to update on the new event properties

Some other of these properties that may come in handy are .e.g.:

```markup
dt.event.allow_davis_merge
dt.event.suppress_problem

```

Both of them will store a Boolean.

The first one (as the name gives away) replaces the event v1&nbsp;allowDavisMerge.

The second one can be used when an event that would usually&nbsp;raise a problem but in some specific&nbsp;case does not need to do so.

A complete payload with the examples above:

```markup
{
  "eventType": "AVAILABILITY_EVENT",
  "title": "Event Ttile",
  "entitySelector": "entityId(HOST-12345)",
  "properties": {
    "dt.event.suppress_problem": true,
    "dt.event.allow_davis_merge": true
  }
}

```

Best,

Mark

---

<div class="post-metadata">

**Author:** ![MariusNicolae](https://avatars.discourse-cdn.com/v4/letter/m/bc79bd/32.png) [@MariusNicolae](https://community.dynatrace.com/u/MariusNicolae)\
**Post date:** [May 4, 2022, 7:21am UTC](https://community.dynatrace.com/t/events-api-v2/34897/6 "2022-05-04T07:21:26Z")

</div>

Hi everyone, thank you so much for your answers!

I will go ahead and start replacing allowDavisMerge with the dt.event property and be waiting for the documentation to get written a bit better or at least the examples part, I think this could come in handy when trying to integrate an external check for a customer or at least this is the best solution that came to me.

Thank you!

Best regards
