Get a test's latest results

GET https://api.ap1.datadoghq.com/api/v2/synthetics/tests/{public_id}/resultshttps://api.ap2.datadoghq.com/api/v2/synthetics/tests/{public_id}/resultshttps://api.datadoghq.eu/api/v2/synthetics/tests/{public_id}/resultshttps://api.ddog-gov.com/api/v2/synthetics/tests/{public_id}/resultshttps://api.us2.ddog-gov.com/api/v2/synthetics/tests/{public_id}/resultshttps://api.datadoghq.com/api/v2/synthetics/tests/{public_id}/resultshttps://api.us3.datadoghq.com/api/v2/synthetics/tests/{public_id}/resultshttps://api.us5.datadoghq.com/api/v2/synthetics/tests/{public_id}/results

Overview

Get the latest result summaries for a given Synthetic test. This endpoint requires the synthetics_read permission.

OAuth apps require the synthetics_read authorization scope to access this endpoint.

Arguments

Path Parameters

Name

Type

Description

public_id [required]

string

The public ID of the Synthetic test for which to search results.

Query Strings

Name

Type

Description

from_ts

integer

Timestamp in milliseconds from which to start querying results.

to_ts

integer

Timestamp in milliseconds up to which to query results.

status

enum

Filter results by status.
Allowed enum values: passed, failed, no_data

runType

enum

Filter results by run type.
Allowed enum values: scheduled, fast, ci, triggered

probe_dc

array

Locations for which to query results.

device_id

array

Device IDs for which to query results.

Response

OK

Response object for a Synthetic test’s latest result summaries.

Expand All

Field

Type

Description

data

[object]

Array of Synthetic test result summaries.

attributes

object

Attributes of a Synthetic test result summary.

device

object

Device information for the test result (browser and mobile tests).

browser

object

Browser information for the device used to run the test.

type

string

Browser type (for example, chrome, firefox).

user_agent

string

User agent string reported by the browser.

version

string

Browser version.

id

string

Device identifier.

name

string

Device name.

platform

object

Platform information for the device used to run the test.

name

string

Platform name (for example, linux, macos).

version

string

Platform version.

resolution

object

Screen resolution of the device used to run the test.

height

int64

Viewport height in pixels.

pixel_ratio

double

Device pixel ratio.

width

int64

Viewport width in pixels.

type

string

Device type.

execution_info

object

Execution details for a Synthetic test result.

duration

object

Total duration of a Synthetic test execution.

has_duration

boolean

Whether a duration was recorded for this execution.

value

int64

Duration value in milliseconds.

error_message

string

Error message if the execution encountered an issue.

is_fast_retry

boolean

Whether this result is from a fast retry.

timings

object

Timing breakdown of the test execution in milliseconds.

tunnel

boolean

Whether the test was executed through a tunnel.

unhealthy

boolean

Whether the location was unhealthy during execution.

finished_at

int64

Timestamp of when the test finished (in milliseconds).

location

object

Location information for a Synthetic test result.

id

string

Identifier of the location.

name

string

Human-readable name of the location.

version

string

Version of the worker that ran the test.

worker_id

string

Identifier of the specific worker that ran the test.

run_type

enum

The type of run for a Synthetic test result. Allowed enum values: scheduled,fast,ci,triggered

started_at

int64

Timestamp of when the test started (in milliseconds).

status

enum

Status of a Synthetic test result. Allowed enum values: passed,failed,no_data

steps_info

object

Step execution summary for a Synthetic test result.

completed

int64

Number of completed steps.

errors

int64

Number of steps with errors.

total

int64

Total number of steps.

test_sub_type

enum

Subtype of the Synthetic test that produced this result. Allowed enum values: dns,grpc,http,icmp,mcp,multi,ssl,tcp,udp,websocket

test_type

enum

Type of the Synthetic test that produced this result. Allowed enum values: api,browser,mobile,network

id

string

The result ID.

relationships

object

Relationships for a Synthetic test result.

test

object

Relationship to the Synthetic test.

data

object

Data for the test relationship.

id

string

The public ID of the test.

type

string

Type of the related resource.

type

enum

Type of the Synthetic test result summary resource, result_summary. Allowed enum values: result_summary

default: result_summary

included

[object]

Array of included related resources, such as the test definition.

attributes

object

Attributes of the included resource.

id

string

ID of the included resource.

type

string

Type of the included resource.

{
  "data": [
    {
      "attributes": {
        "device": {
          "browser": {
            "type": "edge",
            "user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36 Edg/127.0.2651.105 DatadogSynthetics",
            "version": "127.0.2651.105"
          },
          "id": "chrome.laptop_large",
          "name": "Chrome - Laptop Large",
          "platform": {
            "name": "ios",
            "version": "14.8"
          },
          "resolution": {
            "height": 1100,
            "pixel_ratio": 2,
            "width": 1440
          },
          "type": "browser"
        },
        "execution_info": {
          "duration": {
            "has_duration": true,
            "value": 380
          },
          "error_message": "Connection timed out",
          "is_fast_retry": true,
          "timings": {
            "dns": 2.9,
            "download": 2.1,
            "firstByte": 95.2,
            "ssl": 187.9,
            "tcp": 92.6,
            "total": 380.7
          },
          "tunnel": false,
          "unhealthy": false
        },
        "finished_at": "integer",
        "location": {
          "id": "aws:us-east-1",
          "name": "N. Virginia (AWS)",
          "version": "1.0.0",
          "worker_id": "worker-abc-123"
        },
        "run_type": "scheduled",
        "started_at": "integer",
        "status": "passed",
        "steps_info": {
          "completed": 6,
          "errors": 0,
          "total": 6
        },
        "test_sub_type": "http",
        "test_type": "api"
      },
      "id": "5158904793181869365",
      "relationships": {
        "test": {
          "data": {
            "id": "abc-def-123",
            "type": "test"
          }
        }
      },
      "type": "result_summary"
    }
  ],
  "included": [
    {
      "attributes": {},
      "id": "abc-def-123",
      "type": "test"
    }
  ]
}

API error response.

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

API error response.

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Path parameters
export public_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/synthetics/tests/${public_id}/results" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get a test's latest results returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.synthetics_api import SyntheticsApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.list_synthetics_test_latest_results(
        public_id="public_id",
    )

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get a test's latest results returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::SyntheticsAPI.new
p api_instance.list_synthetics_test_latest_results("public_id")

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get a test's latest results returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewSyntheticsApi(apiClient)
	resp, r, err := api.ListSyntheticsTestLatestResults(ctx, "public_id", *datadogV2.NewListSyntheticsTestLatestResultsOptionalParameters())

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.ListSyntheticsTestLatestResults`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.ListSyntheticsTestLatestResults`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get a test's latest results returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.SyntheticsApi;
import com.datadog.api.client.v2.model.SyntheticsTestLatestResultsResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);

    try {
      SyntheticsTestLatestResultsResponse result =
          apiInstance.listSyntheticsTestLatestResults("public_id");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#listSyntheticsTestLatestResults");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Get a test's latest results returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_synthetics::ListSyntheticsTestLatestResultsOptionalParams;
use datadog_api_client::datadogV2::api_synthetics::SyntheticsAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = SyntheticsAPI::with_config(configuration);
    let resp = api
        .list_synthetics_test_latest_results(
            "public_id".to_string(),
            ListSyntheticsTestLatestResultsOptionalParams::default(),
        )
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Get a test's latest results returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.SyntheticsApi(configuration);

const params: v2.SyntheticsApiListSyntheticsTestLatestResultsRequest = {
  publicId: "public_id",
};

apiInstance
  .listSyntheticsTestLatestResults(params)
  .then((data: v2.SyntheticsTestLatestResultsResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"