• Home
  • Dynatrace API
  • Environment
  • Events v2
  • POST an event

Events API v2 - POST an event

Ingests a custom event to Dynatrace.

The request consumes an application/json payload.

Important

The ingestion of custom events consumes Davis Data Units (DDUs) from the events pool.

POSTManagedDynatrace for Governmenthttps://{your-domain}/e/{your-environment-id}/api/v2/events/ingest
SaaShttps://{your-environment-id}.live.dynatrace.com/api/v2/events/ingest
Environment ActiveGatehttps://{your-activegate-domain}/e/{your-environment-id}/api/v2/events/ingest

Authentication

To execute this request, you need an access token with events.ingest scope.

To learn how to obtain and use it, see Tokens and authentication.

Parameters

ParameterTypeDescriptionInRequired
bodyEventIngest

The JSON body of the request. Contains properties of the new event.

bodyoptional

Request body objects

The EventIngest object

The configuration of an event to be ingested.

ElementTypeDescriptionRequired
eventTypestring

The type of the event.

The element can hold these values
  • AVAILABILITY_EVENT
  • CUSTOM_ALERT
  • CUSTOM_ANNOTATION
  • CUSTOM_CONFIGURATION
  • CUSTOM_DEPLOYMENT
  • CUSTOM_INFO
  • ERROR_EVENT
  • MARKED_FOR_TERMINATION
  • PERFORMANCE_EVENT
  • RESOURCE_CONTENTION_EVENT
required
titlestring

The title of the event.

required
startTimeinteger

The start time of the event, in UTC milliseconds.

If not set, the current timestamp is used.

Depending on the event type, the start time must not lie in the future more than 5 minutes for trigger events and 7 days for info events.

optional
endTimeinteger

The end time of the event, in UTC milliseconds.

If not set, the start time plus timeout is used.

optional
timeoutinteger

The timeout of the event, in minutes.

If not set, 15 is used.

The timeout will automatically be capped to a maximum of 360 minutes (6 hours).

Problem-opening events can be refreshed and therefore kept open by sending the same payload again.

optional
entitySelectorstring

The entity selector, defining a set of Dynatrace entities to be associated with the event.

Only entities that have been active within the last 24 hours can be selected.

If not set, the event is associated with the environment (dt.entity.environment) entity.

optional
propertiesobject

A map of event properties.

Keys with prefix dt.* are generally disallowed, with the exceptions of dt.event.*, dt.davis.* and dt.entity.*. These reserved keys may be used to set event properties with predefined semantics within the Dynatrace product. dt.entity.* keys may be used to provide additional information on an event, but will not lead to the event being tied to the specified entities. All other keys are interpreted as user-defined event properties.

Values of Dynatrace-reserved properties must fulfill the requirements of the respective property.

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.

json
{ "eventType": "AVAILABILITY_EVENT", "title": "string", "startTime": 1, "endTime": 1, "timeout": 1, "entitySelector": "string", "properties": {} }

Response

Response codes

CodeTypeDescription
201EventIngestResults

The event ingest request was received by the server. The response body indicates for each event whether its creation was successful.

Response body objects

The EventIngestResults object

The results of an event ingest.

ElementTypeDescription
reportCountinteger

The number of created event reports.

eventIngestResultsEventIngestResult[]

The result of each created event report.

The EventIngestResult object

The result of a created event report.

ElementTypeDescription
statusstring

The status of the ingestion.

The element can hold these values
  • INVALID_ENTITY_TYPE
  • INVALID_METADATA
  • INVALID_TIMESTAMPS
  • OK
correlationIdstring

The correlation ID of the created event.

Response body JSON model

json
{ "reportCount": 1, "eventIngestResults": [ { "status": "INVALID_ENTITY_TYPE", "correlationId": "string" } ] }

Examples

Use case

An operations team wants to push a Marked for termination event to all the hosts that are planned to be removed. They also want to include the purpose for the deletion and a job identifier. The hosts to be removed are gathered in a designated host group.

In this example, the request sends a Marked for termination event to hosts that are planned to be removed. Such hosts are identified by the cloud-burst-hosts host group. The event automatically applies to all hosts that are part of the group. The purpose for termination and automation job number are provided as additional information.

The API token is passed in the Authorization header.

Curl

bash
curl --request POST \ --url https://mySampleEnv.live.dynatrace.com/api/v2/events/ingest \ --header 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890' \ --data '{ "eventType": "MARKED_FOR_TERMINATION", "title": "Planned host downscale", "entitySelector": "type(HOST),fromRelationship.isInstanceOf(type(HOST_GROUP),entityName(cloud-burst-hosts))", "properties": { "job.number": "21234346" } }'

Request URL

plaintext
https://mySampleEnv.live.dynatrace.com/api/v2/events/ingest

Request body

json
{ "eventType": "MARKED_FOR_TERMINATION", "title": "Planned host downscale", "entitySelector": "type(HOST),fromRelationship.isInstanceOf(type(HOST_GROUP),entityName(cloud-burst-hosts))", "properties": { "job.number": "21234346" } }

Response body

json
{ "reportCount": 2, "eventIngestResults": [ { "correlationId": "41f5d263011a6c9a", "status": "OK" }, { "correlationId": "80eae4d163cc5760", "status": "OK" } ] }

Response code

201

Use case

A DevOps team wants to connect their load test tool with Dynatrace to annotate a service that is currently undergoing a load test. Later, when Dynatrace raises a problem caused by the load test, the problem details will include this information, simplifying the triage process.

In this example, the request sends a Custom info event to the BookingService service, marking it as a target of a load test.

The API token is passed in the Authorization header.

Curl

bash
curl --request POST \ --url https://mySampleEnv.live.dynatrace.com/api/v2/events/ingest \ --header 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890' \ --data '{ "eventType": "CUSTOM_INFO", "title": "Loadtest start", "timeout": 30, "entitySelector": "type(SERVICE),entityName.equals(BookingService)", "properties": { "Tool": "MyLoadTool", "Load per minute": "100", "Load pattern": "production" } }'

Request URL

plaintext
https://mySampleEnv.live.dynatrace.com/api/v2/events/ingest

Request body

json
{ "eventType": "CUSTOM_INFO", "title": "Loadtest start", "timeout": 30, "entitySelector": "type(SERVICE),entityName.equals(BookingService)", "properties": { "Tool": "MyLoadTool", "Load per minute": "100", "Load pattern": "production" } }

Response body

json
{ "reportCount": 1, "eventIngestResults": [ { "correlationId": "eba82f647696e485", "status": "OK" } ] }

Response code

201

Use case

The operations team of a large retailer wants to trigger an alert in Dynatrace whenever their catalog update batch process fails. They want to create an event and alert in Dynatrace but they don’t want Davis to merge this externally created event with any larger incident.

In this example, the request sends an Error event to the BookingService service, indicating a failed update. The allowDavisMerge property is set to false, preventing Davis from merging this event with any other event.

The API token is passed in the Authorization header.

Curl

bash
curl --request POST \ --url https://mySampleEnv.live.dynatrace.com/api/v2/events/ingest \ --header 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890' \ --data '{ "eventType": "ERROR_EVENT", "title": "Product catalog update failed", "timeout": 30, "entitySelector": "type(SERVICE),entityName.equals(BookingService)", "properties": { "allowDavisMerge": "false", "Catalog": "APAC travels", "Batch processor": "travel-catalog" } }'

Request URL

plaintext
https://mySampleEnv.live.dynatrace.com/api/v2/events/ingest

Request body

json
{ "eventType": "ERROR_EVENT", "title": "Product catalog update failed", "timeout": 30, "entitySelector": "type(SERVICE),entityName.equals(BookingService)", "properties": { "allowDavisMerge": "false", "Catalog": "APAC travels", "Batch processor": "travel-catalog" } }

Response body

json
{ "reportCount": 1, "eventIngestResults": [ { "correlationId": "cefb7ae03ac720b6", "status": "OK" } ] }

Response code

201

Related topics
  • Event types

    Learn the supported event types, along with their severity levels, and the logic behind raising them.

  • Event analytics

    Gain an understanding of the Events section on each host, process, and service overview page.