Events API v1 - POST an event
This API is deprecated. Use the Events API v2 instead.
Pushes custom events from third-party integrations to one or more monitored entities.
This endpoint enables third-party systems such as CI platforms (Jenkins, Bamboo, Electric Cloud, etc.) to provide additional details for Dynatrace automated root cause analysis.
You can use this endpoint to:
- Push information-only events from third-party systems to provide additional information for Dynatrace automated root cause analysis. The time of event closure is already known and the event IDs are returned instantly. You can push these events for up to 30 days into the past. The information-only event types are:
CUSTOM_ANNOTATION
CUSTOM_CONFIGURATION
CUSTOM_DEPLOYMENT
CUSTOM_INFO
MARKED_FOR_TERMINATION
- Push problem-opening events (for example, an error rate increase) to trigger the Dynatrace automated root cause analysis engine. Correlation IDs are returned instead of event IDs. These events stay open until the specified timeout expires. To prevent expiration, you can refresh these events by sending the same payload again. You can push these events for up to 60 minutes into the past. The problem-opening event types (sorted by highest to lowest severity) are:
AVAILABILITY_EVENT
ERROR_EVENT
PERFORMANCE_EVENT
RESOURCE_CONTENTION
The request consumes and produces an application/json
payload.
POST | ManagedDynatrace for Government | https://{your-domain}/e/{your-environment-id}/api/v1/events |
SaaS | https://{your-environment-id}.live.dynatrace.com/api/v1/events | |
Environment ActiveGate | https://{your-activegate-domain}:9999/e/{your-environment-id}/api/v1/events |
Authentication
To execute this request, you need an access token with DataExport
scope.
To learn how to obtain and use it, see Tokens and authentication.
Parameters
The set of parameters depends on the event type. See Parameters mapping below for details.
Parameter | Type | Description | In | Required |
---|---|---|---|---|
body | EventCreation | The JSON body of the request, containing parameters of the event. | body | optional |
Request body objects
The EventCreation
object
Configuration of the custom event.
Element | Type | Description | Required |
---|---|---|---|
allowDavisMerge | boolean | Allow Davis AI to merge this event into existing problems (true) or force creating a new problem (false). This only applies to problem-opening event types. | optional |
annotationDescription | string | A detailed description of the custom annotation, for example | optional |
annotationType | string | The type of the custom annotation, for example | optional |
attachRules | PushEventAttachRules | The set of rules defining Dynatrace entities to be associated with the event. You can specify tags to dynamically match Dynatrace entities or IDs of specific entities. At least one entity ID or tag is required. | required |
changed | string | The new value of the configuration that has been set by the event. | optional |
ciBackLink | string | The link to the deployed artifact within the 3rd party system. | optional |
configuration | string | The ID or the name of the configuration that has been changed by the event. | optional |
customProperties | object | The set of any properties related to the event, in the "key" : "value" format. | optional |
deploymentName | string | The ID of the triggered deployment. | optional |
deploymentProject | string | The project name of the deployed package. | optional |
deploymentVersion | string | The version of the triggered deployment. | optional |
description | string | The textual description of the configuration change. | optional |
end | integer | The end timestamp of the event, in UTC milliseconds. If not set, the current time is used for information-only events. Not applicable to problem-opening events. Such an event stays open until it times out depending on the timeoutMinutes parameter. | optional |
eventType | string | The type of the event.
| required |
original | string | The previous value of the configuration. | optional |
remediationAction | string | The link to the deployment related remediation action within the external tool. | optional |
source | string | The name or ID of the external source of the event. | required |
start | integer | The start timestamp of the event, in UTC milliseconds. If not set, the current timestamp is used. You can report information-only events up to 30 days into the past. You can report problem-opening events up to 60 minutes into the past. | optional |
timeoutMinutes | integer | The timeout for problem-opening events in minutes. Not applicable to information-only events. If not set, 15 minutes is used. The maximum allowed value is 120 minutes. You can refresh the event by sending the same payload again. | optional |
timeseriesIds | string[] | A list of timeseries IDs, related to the event. | optional |
title | string | The title of the configuration that has been set by the event. | optional |
The PushEventAttachRules
object
The set of rules defining Dynatrace entities to be associated with the event.
You can specify tags to dynamically match Dynatrace entities or IDs of specific entities.
At least one entity ID or tag is required.
Element | Type | Description | Required |
---|---|---|---|
entityIds | string[] | A list of entity IDs to which the event should be attached. | optional |
tagRule | TagMatchRule[] | A set of matching rules to dynamically pick up entities based on tags. Only entities seen within the last 24 hours are taken into account for tag-based matching rules. | optional |
The TagMatchRule
object
The list of tags to be used for matching Dynatrace entities.
Element | Type | Description | Required |
---|---|---|---|
meTypes | string[] | The list of types of the Dynatrace entities (for example hosts or services) you want to pick up by matching.
| required |
tags | TagInfo[] | The list of tags you want to use for matching. At least one tag is required. You can use custom tags from the UI, imported tags, and tags based on environment variables. | required |
The TagInfo
object
Tag of a Dynatrace entity.
Element | Type | Description | Required |
---|---|---|---|
context | string | The origin of the tag, such as AWS or Cloud Foundry. Custom tags use the
| required |
key | string | The key of the tag. Custom tags have the tag value here. | required |
value | string | The value of the tag. Not applicable to custom tags. | optional |
Request body JSON model
This is a model of the request body, showing the possible elements. It has to be adjusted for usage in an actual request.
1{2 "annotationDescription": "The coffee machine is broken",3 "annotationType": "defect",4 "attachRules": {5 "entityIds": [6 "CUSTOM_DEVICE-0000000000000007"7 ],8 "tagRule": [9 {10 "meTypes": [11 "HOST"12 ],13 "tags": [14 {15 "context": "CONTEXTLESS",16 "key": "customTag"17 }18 ]19 }20 ]21 },22 "end": 1521542929000,23 "eventType": "CUSTOM_ANNOTATION",24 "source": "OpsControl",25 "start": 152104292900026}
Parameters mapping
Availability event | Custom annotation | Custom config | Custom deployment | Custom info | Error event | Performance event | Resource contention | Marked for termination | |
---|---|---|---|---|---|---|---|---|---|
description | req | opt | req | n/a | req | req | req | req | req |
title | req | n/a | n/a | n/a | opt | req | req | req | opt |
source | req | req | req | req | req | req | req | req | req |
annotationType | n/a | req | n/a | n/a | n/a | n/a | n/a | n/a | n/a |
annotationDescription | n/a | req | n/a | n/a | n/a | n/a | n/a | n/a | n/a |
deploymentName | n/a | n/a | n/a | req | n/a | n/a | n/a | n/a | n/a |
deploymentVersion | n/a | n/a | n/a | req | n/a | n/a | n/a | n/a | n/a |
deploymentProject | n/a | n/a | n/a | opt | n/a | n/a | n/a | n/a | n/a |
ciBackLink | n/a | n/a | n/a | opt | n/a | n/a | n/a | n/a | opt |
remediationAction | n/a | n/a | n/a | opt | n/a | n/a | n/a | n/a | n/a |
original | n/a | n/a | opt | n/a | n/a | n/a | n/a | n/a | n/a |
configuration | n/a | n/a | req | n/a | n/a | n/a | n/a | n/a | n/a |
customProperties | opt | opt | opt | opt | opt | opt | opt | opt | opt |
Response
Response codes
Code | Type | Description |
---|---|---|
200 | EventStoreResult | Success |
Response body objects
The EventStoreResult
object
Contains IDs of all custom events, created by an event push call.
Element | Type | Description |
---|---|---|
storedCorrelationIds | string[] | List of correlation IDs for problem-opening-events. |
storedEventIds | integer[] | List of event IDs for information-only-events. This field is provided for compatibility reasons. You should use the values from the storedIds field instead. |
storedIds | string[] | List of encoded event IDs for information-only-events. |
Response body JSON model
1{2 "storedCorrelationIds": [3 "string"4 ],5 "storedEventIds": [6 17 ],8 "storedIds": [9 "string"10 ]11}
Example
In this example, the request pushes the CUSTOM_ANNOTATION event, which applies to all custom devices with the Coffee-2nd-floor tag. This annotation is a notification that these coffee machines are broken.
The API token is passed in the Authorization header.
Curl
1curl -X POST \2 https://mySampleEnv.live.dynatrace.com/api/v1/events \3 -H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890' \4 -H 'Content-Type: application/json' \5 -d '{6 "eventType": "CUSTOM_ANNOTATION",7 "timeoutMinutes": 0,8 "attachRules": {910 "tagRule": [11 {12 "meTypes": [13 "CUSTOM_DEVICE"14 ],15 "tags": [16 {17 "context": "CONTEXTLESS",18 "key": "IG-test"19 }20 ]21 }22 ]23 },24 "source": "OpsControl",25 "annotationType": "defect",26 "annotationDescription": "coffee machine is defective"27}'
Request URL
1https://mySampleEnv.live.dynatrace.com/api/v1/events
Request body
1{2 "eventType": "CUSTOM_ANNOTATION",3 "timeoutMinutes": 0,4 "attachRules": {5 "tagRule": [6 {7 "meTypes": ["CUSTOM_DEVICE"],8 "tags": [9 {10 "context": "CONTEXTLESS",11 "key": "IG-test"12 }13 ]14 }15 ]16 },17 "source": "OpsControl",18 "annotationType": "defect",19 "annotationDescription": "coffee machine is defective"20}
Response body
1{2 "storedEventIds": [3 -61534761108460514264 ],5 "storedIds": [6 "-6153476110846051426_1533300519291"7 ],8 "storedCorrelationIds": []9}
Response code
200