Test results — REST API

This resource returns test result data from the server. Use the available resource paths and parameters to constrain the returned test results in a variety of ways. For example, you can request:

  • Test results for a set of tests based on a start time and end time.
  • Test results for a specific test.
  • Test results that match a filter definition.
  • Incremental test results that have been captured since your last request.

These basic selection criteria can be used in different combinations to achieve a wide variety of results. If you don't use one of the optional filtering choices, the response will contain all available test results for all tests belonging to your account.

Resource paths

The following path provides default access to the testresult resource:

GET <server>/publicapi/rest/v1.0/testresults

The following path limits the results to a specific test by adding a target monitor ID, <monitorId>, to the resource path. A request to the tests resource will return a response payload that includes Monitor IDs in the mid element/field (depending on the response data type).

GET <server>/publicapi/rest/v1.0/testresults/<monitorId>

To constrain the returned test results with a filter definition, you use the same paths as above but you issue a POST request instead of a GET. This is necessary to supply the filter definition as a payload for the request.

POST <server>/publicapi/rest/v1.0/testresults

If you issue a POST request and omit the filter definition payload, the resource returns test results without filtering by monitor ID.

In the resource paths above, the <server> address is https://datafeed-api.dynatrace.com.

URL parameters

Name Type Required Default Description
start Long Yes (for first call); otherwise no See description A Unix (epoch) timestamp in milliseconds that specifies the start of the data collection period—the time parameter determines how the start time is matched to your test data. The timestamp must be in milliseconds. If the timestamp is any other unit (e.g. seconds), no data will be returned. By default, the REST API looks in its user context cache for the most recently used value of end, matched by bearer token, query type, and query parameters. If the server finds a matching value of end, it will use it as the start time. If the API finds no matching value of end, it will throw a parameter exception. The API persists the last used value of end for one hour. This behavior helps you conveniently retrieve incremental results. Your supplied values for the start and end parameters must not define an interval greater than 48 hours in length.
end Long No Current time A Unix (epoch) timestamp in milliseconds that specifies the end of the data collection period—the time parameter determines how the end time is matched to your test data. Your supplied values for the start and end parameters must not define an interval greater than 48 hours in length.
time ARRIVAL| TEST_EXECUTION No TEST_EXECUTION Specifies how your time range is compared to test result data. Each test runs at a remote location. Its results are recorded, and transmitted back to the central database in the Dynatrace Synthetic Monitoring data center. The TEST_EXECUTION time is the time at which the test is run at the remote location. The ARRIVAL time is the time at which the results arrive in the central database. The two times are almost never exactly the same, and in some cases they can be different by minutes or even hours. Set this parameter to TEST_EXECUTION, to match test results based on whether or not the test execution time is greater than or equal to the value of start and less than the value of end. Set this parameter to ARRIVAL to match test results based on whether or not the arrival time is greater than or equal to the value of start and less than the value of end. The default value of TEST_EXECUTION is the option you would use in most cases, especially when using the incremental feeds feature of this resource.
detailLevel A comma delimited list of: TEST|STEP|OBJECT| CONNECTION|HOST|W3C A shortcut for full detail is ALL. No TEST This parameter controls the level of detail in the report.
  • TEST: Test-level data only
  • STEP: Step-level data only
  • OBJECT: Object-level data only
  • CONNECTION: Connection-level data only
  • HOST: Host-level data, object-level data, and connection-level data
  • ALL: Test-level data, step-level data, object-level data, connection-level data, and host-level data
Use a comma-delimited list to create a union of any of the above. For example, TEST,STEP means test-level data and step-level data.

HTTP request header parameters

Header Name Allowed Values Required Description
Accept application/json, application/xml, or application/csv No Determines the content type of the response data. The API supports JSON, XML, and CSV. The default is JSON.
Authentication bearer <accessToken> Yes This header is required and must contain the access token returned by a login request. The bearer keyword and space is required before the token.
Content-Type application/xml;charset=UTF-8 No Defines the content type the REST API accepts in the request payload. The only supported format is XML in UTF-8 encoding.

Test result limitations

The Test Result resource has the following limitations:

  • Interval size: When you include start and end on your request, the resulting interval must not exceed 48 hours in length. If you require a longer interval, you must make multiple requests that use a smaller interval.
  • Request frequency: For a given bearer token, the Test Results resource allows one request per minute. If you need to issue several requests to the Test Results resource, you must space them out at least 60 seconds from each other.
  • Repeated queries: For a given bearer token, the Test Results resource does not allow you to request the same interval of data multiple times.