Problems API v1 has been deprecated with Dynatrace version 1.243. Its replacement is Problems API v2. We recommend that you migrate to the new API at your earliest convenience.
The migration affects endpoint URLs, query parameters, and response/request body parameters, as well as the scope of the token for request authentication.
Events API v2 offers you the following new features:
/api/v2/problems
/api/v1/problem
problems.read
)problems.write
)DataExport
)To learn about new query/body parameters, see the documentation of individual requests in Problems API v2.
In this example, we query a list of open problems on hosts that happened within the last two hours.
GET https://mySampleEnv.live.dynatrace.com/api/v2/problems?from=now-2h&problemSelector=status("open")&entitySelector=type("HOST")
{"totalCount": 2,"pageSize": 50,"problems": [{"problemId": "-6156404735398726308_1669823466223V2","displayId": "P-221194163","title": "Host or monitoring unavailable","impactLevel": "INFRASTRUCTURE","severityLevel": "AVAILABILITY","status": "OPEN","affectedEntities": [{"entityId": {"id": "HOST-E371A974A078CC54","type": "HOST"},"name": "frontend-dev"}],"impactedEntities": [{"entityId": {"id": "HOST-E371A974A078CC54","type": "HOST"},"name": "frontend-dev"}],"rootCauseEntity": null,"managementZones": [{"id": "6143976176513989654","name": "Infrastructure Linux"},{"id": "4067143719293196613","name": "dev"},{"id": "-6114370715062110014","name": "frontent"}],"entityTags": [{"context": "CONTEXTLESS","key": "frontend","stringRepresentation": "frontend"},{"context": "CONTEXTLESS","key": "stage","value": "dev","stringRepresentation": "stage:dev"}],"problemFilters": [{"id": "ca786d1f-e6cf-4451-b9dc-9c27c5c339e1","name": "Infrastructure alerts"},{"id": "d03022be-d0e3-4089-b02d-ebec9ae87da4","name": "Frontend alerts"}],"startTime": 1669823466223,"endTime": -1},{"problemId": "7188776519218424524_1669820820000V2","displayId": "P-221194115","title": "High memory usage","impactLevel": "INFRASTRUCTURE","severityLevel": "CUSTOM_ALERT","status": "OPEN","affectedEntities": [{"entityId": {"id": "HOST-0F5789A6850FA907","type": "HOST"},"name": "easyTravel.bookingService.Win.1"}],"impactedEntities": [{"entityId": {"id": "HOST-0F5789A6850FA907","type": "HOST"},"name": "easyTravel.bookingService.Win.dev.1"}],"rootCauseEntity": null,"managementZones": [{"id": "4067143719293196613","name": "dev"},{"id": "7918335421727549830","name": "Infrastructure windows"},{"id": "-6239538939987181652","name": "Booking service"}],"entityTags": [{"context": "CONTEXTLESS","key": "stage","value": "dev","stringRepresentation": "stage:dev"},{"context": "CONTEXTLESS","key": "bookingService","stringRepresentation": "bookingService"}],"problemFilters": [{"id": "ca786d1f-e6cf-4451-b9dc-9c27c5c339e1","name": "Infrastructure alerts"},{"id": "ff956dac-8709-3546-bf2b-d82195e7ef6a","name": "Booking service alerts"}],"startTime": 1669821000000,"endTime": -1}],"warnings": []}
In Events API v1, it is not possible to select multiple entities via the entity selector. You have to rely on tags. For illustration purposes, the example payload shows the same problems, but you would have to find them in the payload by external means.
GET https://mySampleEnv.live.dynatrace.com/api/v1/problem/feed?relativeTime=2hours&status=OPEN&tag=stage:dev
{"result": {"problems": [{"id": "-6156404735398726308_1669823466223V2","startTime": 1669823466223,"endTime": -1,"displayName": "P-221194163","impactLevel": "INFRASTRUCTURE","status": "OPEN","severityLevel": "AVAILABILITY","commentCount": 0,"tagsOfAffectedEntities": [{"context": "CONTEXTLESS","key": "frontend"},{"context": "CONTEXTLESS","key": "stage","value": "dev"}],"rankedImpacts": [{"entityId": "HOST-E371A974A078CC54","entityName": "frontend-dev","severityLevel": "AVAILABILITY","impactLevel": "INFRASTRUCTURE","eventType": "CONNECTION_LOST"}],"affectedCounts": {"INFRASTRUCTURE": 1,"SERVICE": 0,"APPLICATION": 0,"ENVIRONMENT": 0},"recoveredCounts": {"INFRASTRUCTURE": 0,"SERVICE": 0,"APPLICATION": 0,"ENVIRONMENT": 0},"hasRootCause": false},{"id": "7188776519218424524_1669820820000V2","startTime": 1669821000000,"endTime": -1,"displayName": "P-221194115","impactLevel": "INFRASTRUCTURE","status": "OPEN","severityLevel": "CUSTOM_ALERT","commentCount": 0,"tagsOfAffectedEntities": [{"context": "CONTEXTLESS","key": "stage","value": "dev"},{"context": "CONTEXTLESS","key": "bookingService"}],"rankedImpacts": [{"entityId": "HOST-0F5789A6850FA907","entityName": "easyTravel.bookingService.Win.1","severityLevel": "CUSTOM_ALERT","impactLevel": "INFRASTRUCTURE","eventType": "CUSTOM_ALERT"}],"affectedCounts": {"INFRASTRUCTURE": 1,"SERVICE": 0,"APPLICATION": 0,"ENVIRONMENT": 0},"recoveredCounts": {"INFRASTRUCTURE": 0,"SERVICE": 0,"APPLICATION": 0,"ENVIRONMENT": 0},"hasRootCause": false}]}}