Synthetics

Datadog Synthetic Monitoring は、シミュレートされたユーザーリクエストとブラウザレンダリングを使用して、アップタイムを確保し、地域の問題を特定し、アプリケーションのパフォーマンスを追跡します。Synthetic テストには、API テストブラウザテストの 2 つの異なる種類があります。Datadog の API を使用して、両方のテストタイプをプログラムで管理できます。

詳細については、Synthetic Monitoring のドキュメントを参照してください。

POST https://api.ap1.datadoghq.com/api/v1/synthetics/tests/apihttps://api.datadoghq.eu/api/v1/synthetics/tests/apihttps://api.ddog-gov.com/api/v1/synthetics/tests/apihttps://api.datadoghq.com/api/v1/synthetics/tests/apihttps://api.us3.datadoghq.com/api/v1/synthetics/tests/apihttps://api.us5.datadoghq.com/api/v1/synthetics/tests/api

概要

Synthetic API テストを作成します。 This endpoint requires the synthetics_write authorization scope.

リクエスト

Body Data (required)

作成するテストの詳細。

Expand All

フィールド

種類

説明

config [required]

object

Configuration object for a Synthetic API test.

assertions

[ <oneOf>]

Array of assertions used for the test. Required for single API tests.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

configVariables

[object]

Array of variables used for the test.

example

string

Example for the variable.

id

string

ID of the variable for global variables.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Whether the value of this variable will be obfuscated in test results. Only for config variables of type text.

type [required]

enum

Type of the configuration variable. Allowed enum values: global,text

request

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

steps

[object <oneOf>]

When the test subtype is multi, the steps of the test.

Option 1

object

The Test step used in a Synthetic multi-step API test.

allowFailure

boolean

Determines whether or not to continue with test if this step fails.

assertions [required]

[ <oneOf>]

Array of assertions used for the test.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

extractedValues

[object]

Array of values to parse and save as variables from the response.

field

string

When type is http_header, name of the header to use to extract the value.

name

string

Name of the variable to extract.

parser

object

Details of the parser to use for the global variable.

type [required]

enum

Type of parser for a Synthetic global variable from a synthetics test. Allowed enum values: raw,json_path,regex,x_path

value

string

Regex or JSON path used for the parser. Not used with type raw.

secure

boolean

Determines whether or not the extracted value will be obfuscated.

type

enum

Property of the Synthetic Test Response to use for a Synthetic global variable. Allowed enum values: http_body,http_header,local_variable

isCritical

boolean

Determines whether or not to consider the entire test as failed if this step fails. Can be used only if allowFailure is true.

name [required]

string

The name of the step.

request [required]

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

subtype [required]

enum

The subtype of the Synthetic multi-step API test step. Allowed enum values: http,grpc

Option 2

object

The Wait step used in a Synthetic multi-step API test.

name [required]

string

The name of the step.

subtype [required]

enum

The subtype of the Synthetic multi-step API wait step. Allowed enum values: wait

value [required]

int32

The time to wait in seconds. Minimum value: 0. Maximum value: 180.

variablesFromScript

string

Variables defined from JavaScript code.

locations [required]

[string]

Array of locations used to run the test.

message [required]

string

Notification message associated with the test.

monitor_id

int64

The associated monitor ID.

name [required]

string

Name of the test.

options [required]

object

Object describing the extra options for a Synthetic test.

accept_self_signed

boolean

For SSL test, whether or not the test should allow self signed certificates.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in an API test.

checkCertificateRevocation

boolean

For SSL test, whether or not the test should fail on revoked certificate in stapled OCSP.

ci

object

CI/CD options for a Synthetic test.

executionRule

enum

Execution rule for a Synthetic test. Allowed enum values: blocking,non_blocking,skipped

device_ids

[string]

For browser test, array with the different device IDs used to run the test.

disableCors

boolean

Whether or not to disable CORS mechanism.

disableCsp

boolean

Disable Content Security Policy for browser tests.

enableProfiling

boolean

Enable profiling for browser tests.

enableSecurityTesting

boolean

DEPRECATED: Enable security testing for browser tests. Security testing is not available anymore. This field is deprecated and won't be used.

follow_redirects

boolean

For API HTTP test, whether or not the test should follow redirects.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

ignoreServerCertificateError

boolean

Ignore server certificate error for browser tests.

initialNavigationTimeout

int64

Timeout before declaring the initial step as failed (in seconds) for browser tests.

min_failure_duration

int64

Minimum amount of time in failure required to trigger an alert.

min_location_failed

int64

Minimum number of locations in failure required to trigger an alert.

monitor_name

string

The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.

monitor_options

object

Object containing the options for a Synthetic test as a monitor (for example, renotification).

renotify_interval

int64

Time interval before renotifying if the test is still failing (in minutes).

monitor_priority

int32

Integer from 1 (high) to 5 (low) indicating alert severity.

noScreenshot

boolean

Prevents saving screenshots of the steps.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

rumSettings

object

The RUM data collection settings for the Synthetic browser test. Note: There are 3 ways to format RUM settings:

{ isEnabled: false } RUM data is not collected.

{ isEnabled: true } RUM data is collected from the Synthetic test's default application.

{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 } RUM data is collected using the specified application.

applicationId

string

RUM application ID used to collect RUM data for the browser test.

clientTokenId

int64

RUM application API key ID used to collect RUM data for the browser test.

isEnabled [required]

boolean

Determines whether RUM data is collected during test runs.

scheduling

object

Object containing timeframes and timezone used for advanced scheduling.

timeframes

[object]

Array containing objects describing the scheduling pattern to apply to each day.

day

int32

Number representing the day of the week.

from

string

The hour of the day on which scheduling starts.

to

string

The hour of the day on which scheduling ends.

timezone

string

Timezone in which the timeframe is based.

tick_every

int64

The frequency at which to run the Synthetic test (in seconds).

public_id

string

The public ID for the test.

status

enum

Define whether you want to start (live) or pause (paused) a Synthetic test. Allowed enum values: live,paused

subtype

enum

The subtype of the Synthetic API test, http, ssl, tcp, dns, icmp, udp, websocket, grpc or multi. Allowed enum values: http,ssl,tcp,dns,multi,icmp,udp,websocket,grpc

tags

[string]

Array of tags attached to the test.

type [required]

enum

Type of the Synthetic test, api. Allowed enum values: api

default: api

{
  "config": {
    "steps": [
      {
        "assertions": [
          {
            "operator": "is",
            "type": "statusCode",
            "target": 200
          }
        ],
        "name": "request is sent",
        "request": {
          "url": "https://httpbin.org/status/200",
          "method": "GET",
          "basicAuth": {
            "password": "password",
            "username": "username"
          }
        },
        "subtype": "http"
      },
      {
        "assertions": [
          {
            "operator": "is",
            "type": "statusCode",
            "target": 200
          }
        ],
        "name": "request is sent",
        "request": {
          "url": "https://httpbin.org/status/200",
          "method": "GET",
          "basicAuth": {
            "password": "password",
            "username": "username",
            "type": "web"
          }
        },
        "subtype": "http"
      },
      {
        "assertions": [
          {
            "operator": "is",
            "type": "statusCode",
            "target": 200
          }
        ],
        "name": "request is sent",
        "request": {
          "url": "https://httpbin.org/status/200",
          "method": "GET",
          "basicAuth": {
            "accessKey": "accessKey",
            "secretKey": "secretKey",
            "type": "sigv4"
          }
        },
        "subtype": "http"
      },
      {
        "assertions": [
          {
            "operator": "is",
            "type": "statusCode",
            "target": 200
          }
        ],
        "name": "request is sent",
        "request": {
          "url": "https://httpbin.org/status/200",
          "method": "GET",
          "basicAuth": {
            "type": "ntlm"
          }
        },
        "subtype": "http"
      },
      {
        "assertions": [
          {
            "operator": "is",
            "type": "statusCode",
            "target": 200
          }
        ],
        "name": "request is sent",
        "request": {
          "url": "https://httpbin.org/status/200",
          "method": "GET",
          "basicAuth": {
            "password": "password",
            "username": "username",
            "type": "digest"
          }
        },
        "subtype": "http"
      },
      {
        "assertions": [
          {
            "operator": "is",
            "type": "statusCode",
            "target": 200
          }
        ],
        "name": "request is sent",
        "request": {
          "url": "https://httpbin.org/status/200",
          "method": "GET",
          "basicAuth": {
            "accessTokenUrl": "accessTokenUrl",
            "tokenApiAuthentication": "header",
            "clientId": "clientId",
            "clientSecret": "clientSecret",
            "type": "oauth-client"
          }
        },
        "subtype": "http"
      },
      {
        "assertions": [
          {
            "operator": "is",
            "type": "statusCode",
            "target": 200
          }
        ],
        "name": "request is sent",
        "request": {
          "url": "https://httpbin.org/status/200",
          "method": "GET",
          "basicAuth": {
            "accessTokenUrl": "accessTokenUrl",
            "password": "password",
            "tokenApiAuthentication": "header",
            "username": "username",
            "type": "oauth-rop"
          }
        },
        "subtype": "http"
      }
    ]
  },
  "locations": [
    "aws:us-east-2"
  ],
  "message": "BDD test payload: synthetics_api_test_multi_step_with_every_type_of_basic_auth.json",
  "name": "Example-Synthetic",
  "options": {
    "tick_every": 60
  },
  "subtype": "multi",
  "type": "api"
}
{
  "config": {
    "assertions": [
      {
        "operator": "is",
        "target": 1,
        "type": "grpcHealthcheckStatus"
      },
      {
        "operator": "is",
        "target": "proto target",
        "type": "grpcProto"
      },
      {
        "operator": "is",
        "target": "123",
        "property": "property",
        "type": "grpcMetadata"
      }
    ],
    "request": {
      "host": "localhost",
      "port": 50051,
      "service": "Hello",
      "method": "GET",
      "message": "",
      "metadata": {}
    }
  },
  "locations": [
    "aws:us-east-2"
  ],
  "message": "BDD test payload: synthetics_api_grpc_test_payload.json",
  "name": "Example-Synthetic",
  "options": {
    "min_failure_duration": 0,
    "min_location_failed": 1,
    "monitor_options": {
      "renotify_interval": 0
    },
    "monitor_name": "Example-Synthetic",
    "tick_every": 60
  },
  "subtype": "grpc",
  "tags": [
    "testing:api"
  ],
  "type": "api"
}
{
  "config": {
    "assertions": [
      {
        "operator": "is",
        "property": "{{ PROPERTY }}",
        "target": "text/html",
        "type": "header"
      },
      {
        "operator": "lessThan",
        "target": 2000,
        "type": "responseTime",
        "timingsScope": "withoutDNS"
      },
      {
        "operator": "validatesJSONPath",
        "target": {
          "jsonPath": "topKey",
          "operator": "isNot",
          "targetValue": "0"
        },
        "type": "body"
      },
      {
        "operator": "validatesJSONPath",
        "target": {
          "elementsOperator": "atLeastOneElementMatches",
          "jsonPath": "topKey",
          "operator": "isNot",
          "targetValue": "0"
        },
        "type": "body"
      },
      {
        "operator": "validatesJSONSchema",
        "target": {
          "metaSchema": "draft-07",
          "jsonSchema": "{\"type\": \"object\", \"properties\":{\"slideshow\":{\"type\":\"object\"}}}"
        },
        "type": "body"
      },
      {
        "operator": "validatesXPath",
        "target": {
          "xPath": "target-xpath",
          "targetValue": "0",
          "operator": "contains"
        },
        "type": "body"
      },
      {
        "operator": "md5",
        "target": "a",
        "type": "bodyHash"
      }
    ],
    "configVariables": [
      {
        "example": "content-type",
        "name": "PROPERTY",
        "pattern": "content-type",
        "type": "text"
      }
    ],
    "variablesFromScript": "dd.variable.set(\"FOO\", \"foo\")",
    "request": {
      "certificate": {
        "cert": {
          "content": "cert-content",
          "filename": "cert-filename",
          "updatedAt": "2020-10-16T09:23:24.857Z"
        },
        "key": {
          "content": "key-content",
          "filename": "key-filename",
          "updatedAt": "2020-10-16T09:23:24.857Z"
        }
      },
      "headers": {
        "unique": "examplesynthetic"
      },
      "method": "GET",
      "timeout": 10,
      "url": "https://datadoghq.com",
      "proxy": {
        "url": "https://datadoghq.com",
        "headers": {}
      },
      "basicAuth": {
        "accessTokenUrl": "https://datadog-token.com",
        "audience": "audience",
        "clientId": "client-id",
        "clientSecret": "client-secret",
        "resource": "resource",
        "scope": "yoyo",
        "tokenApiAuthentication": "header",
        "type": "oauth-client"
      },
      "persistCookies": true
    }
  },
  "locations": [
    "aws:us-east-2"
  ],
  "message": "BDD test payload: synthetics_api_http_test_payload.json",
  "name": "Example-Synthetic",
  "options": {
    "accept_self_signed": false,
    "allow_insecure": true,
    "follow_redirects": true,
    "min_failure_duration": 10,
    "min_location_failed": 1,
    "monitor_name": "Example-Synthetic",
    "monitor_priority": 5,
    "retry": {
      "count": 3,
      "interval": 10
    },
    "tick_every": 60,
    "httpVersion": "http2"
  },
  "subtype": "http",
  "tags": [
    "testing:api"
  ],
  "type": "api"
}

応答

OK - Returns the created test details.

Object containing details about a Synthetic API test.

Expand All

フィールド

種類

説明

config [required]

object

Configuration object for a Synthetic API test.

assertions

[ <oneOf>]

Array of assertions used for the test. Required for single API tests.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

configVariables

[object]

Array of variables used for the test.

example

string

Example for the variable.

id

string

ID of the variable for global variables.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Whether the value of this variable will be obfuscated in test results. Only for config variables of type text.

type [required]

enum

Type of the configuration variable. Allowed enum values: global,text

request

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

steps

[object <oneOf>]

When the test subtype is multi, the steps of the test.

Option 1

object

The Test step used in a Synthetic multi-step API test.

allowFailure

boolean

Determines whether or not to continue with test if this step fails.

assertions [required]

[ <oneOf>]

Array of assertions used for the test.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

extractedValues

[object]

Array of values to parse and save as variables from the response.

field

string

When type is http_header, name of the header to use to extract the value.

name

string

Name of the variable to extract.

parser

object

Details of the parser to use for the global variable.

type [required]

enum

Type of parser for a Synthetic global variable from a synthetics test. Allowed enum values: raw,json_path,regex,x_path

value

string

Regex or JSON path used for the parser. Not used with type raw.

secure

boolean

Determines whether or not the extracted value will be obfuscated.

type

enum

Property of the Synthetic Test Response to use for a Synthetic global variable. Allowed enum values: http_body,http_header,local_variable

isCritical

boolean

Determines whether or not to consider the entire test as failed if this step fails. Can be used only if allowFailure is true.

name [required]

string

The name of the step.

request [required]

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

subtype [required]

enum

The subtype of the Synthetic multi-step API test step. Allowed enum values: http,grpc

Option 2

object

The Wait step used in a Synthetic multi-step API test.

name [required]

string

The name of the step.

subtype [required]

enum

The subtype of the Synthetic multi-step API wait step. Allowed enum values: wait

value [required]

int32

The time to wait in seconds. Minimum value: 0. Maximum value: 180.

variablesFromScript

string

Variables defined from JavaScript code.

locations [required]

[string]

Array of locations used to run the test.

message [required]

string

Notification message associated with the test.

monitor_id

int64

The associated monitor ID.

name [required]

string

Name of the test.

options [required]

object

Object describing the extra options for a Synthetic test.

accept_self_signed

boolean

For SSL test, whether or not the test should allow self signed certificates.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in an API test.

checkCertificateRevocation

boolean

For SSL test, whether or not the test should fail on revoked certificate in stapled OCSP.

ci

object

CI/CD options for a Synthetic test.

executionRule

enum

Execution rule for a Synthetic test. Allowed enum values: blocking,non_blocking,skipped

device_ids

[string]

For browser test, array with the different device IDs used to run the test.

disableCors

boolean

Whether or not to disable CORS mechanism.

disableCsp

boolean

Disable Content Security Policy for browser tests.

enableProfiling

boolean

Enable profiling for browser tests.

enableSecurityTesting

boolean

DEPRECATED: Enable security testing for browser tests. Security testing is not available anymore. This field is deprecated and won't be used.

follow_redirects

boolean

For API HTTP test, whether or not the test should follow redirects.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

ignoreServerCertificateError

boolean

Ignore server certificate error for browser tests.

initialNavigationTimeout

int64

Timeout before declaring the initial step as failed (in seconds) for browser tests.

min_failure_duration

int64

Minimum amount of time in failure required to trigger an alert.

min_location_failed

int64

Minimum number of locations in failure required to trigger an alert.

monitor_name

string

The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.

monitor_options

object

Object containing the options for a Synthetic test as a monitor (for example, renotification).

renotify_interval

int64

Time interval before renotifying if the test is still failing (in minutes).

monitor_priority

int32

Integer from 1 (high) to 5 (low) indicating alert severity.

noScreenshot

boolean

Prevents saving screenshots of the steps.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

rumSettings

object

The RUM data collection settings for the Synthetic browser test. Note: There are 3 ways to format RUM settings:

{ isEnabled: false } RUM data is not collected.

{ isEnabled: true } RUM data is collected from the Synthetic test's default application.

{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 } RUM data is collected using the specified application.

applicationId

string

RUM application ID used to collect RUM data for the browser test.

clientTokenId

int64

RUM application API key ID used to collect RUM data for the browser test.

isEnabled [required]

boolean

Determines whether RUM data is collected during test runs.

scheduling

object

Object containing timeframes and timezone used for advanced scheduling.

timeframes

[object]

Array containing objects describing the scheduling pattern to apply to each day.

day

int32

Number representing the day of the week.

from

string

The hour of the day on which scheduling starts.

to

string

The hour of the day on which scheduling ends.

timezone

string

Timezone in which the timeframe is based.

tick_every

int64

The frequency at which to run the Synthetic test (in seconds).

public_id

string

The public ID for the test.

status

enum

Define whether you want to start (live) or pause (paused) a Synthetic test. Allowed enum values: live,paused

subtype

enum

The subtype of the Synthetic API test, http, ssl, tcp, dns, icmp, udp, websocket, grpc or multi. Allowed enum values: http,ssl,tcp,dns,multi,icmp,udp,websocket,grpc

tags

[string]

Array of tags attached to the test.

type [required]

enum

Type of the Synthetic test, api. Allowed enum values: api

default: api

{
  "config": {
    "assertions": [
      []
    ],
    "configVariables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ],
    "request": {
      "allow_insecure": false,
      "basicAuth": {
        "password": "PaSSw0RD!",
        "type": "web",
        "username": "my_username"
      },
      "body": "string",
      "bodyType": "text/plain",
      "callType": "unary",
      "certificate": {
        "cert": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        },
        "key": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        }
      },
      "certificateDomains": [],
      "compressedJsonDescriptor": "string",
      "compressedProtoFile": "string",
      "dnsServer": "string",
      "dnsServerPort": "integer",
      "files": [
        {
          "bucketKey": "string",
          "content": "string",
          "name": "string",
          "originalFileName": "string",
          "size": "integer",
          "type": "string"
        }
      ],
      "follow_redirects": false,
      "headers": {
        "<any-key>": "string"
      },
      "host": "string",
      "httpVersion": "string",
      "message": "string",
      "metadata": {
        "<any-key>": "string"
      },
      "method": "string",
      "noSavingResponseBody": false,
      "numberOfPackets": "integer",
      "persistCookies": false,
      "port": "integer",
      "proxy": {
        "headers": {
          "<any-key>": "string"
        },
        "url": "https://example.com"
      },
      "query": {},
      "servername": "string",
      "service": "Greeter",
      "shouldTrackHops": false,
      "timeout": "number",
      "url": "https://example.com"
    },
    "steps": [],
    "variablesFromScript": "dd.variable.set(\"FOO\", \"foo\")"
  },
  "locations": [
    "aws:eu-west-3"
  ],
  "message": "Notification message",
  "monitor_id": 12345678,
  "name": "Example test name",
  "options": {
    "accept_self_signed": false,
    "allow_insecure": false,
    "checkCertificateRevocation": false,
    "ci": {
      "executionRule": "string"
    },
    "device_ids": [
      "chrome.laptop_large"
    ],
    "disableCors": false,
    "disableCsp": false,
    "enableProfiling": false,
    "enableSecurityTesting": false,
    "follow_redirects": false,
    "httpVersion": "string",
    "ignoreServerCertificateError": false,
    "initialNavigationTimeout": "integer",
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "monitor_name": "string",
    "monitor_options": {
      "renotify_interval": "integer"
    },
    "monitor_priority": "integer",
    "noScreenshot": false,
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ],
    "retry": {
      "count": "integer",
      "interval": "number"
    },
    "rumSettings": {
      "applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "clientTokenId": 12345,
      "isEnabled": true
    },
    "scheduling": {
      "timeframes": [
        {
          "day": 1,
          "from": "07:00",
          "to": "16:00"
        }
      ],
      "timezone": "America/New_York"
    },
    "tick_every": "integer"
  },
  "public_id": "123-abc-456",
  "status": "live",
  "subtype": "http",
  "tags": [
    "env:production"
  ],
  "type": "api"
}

- JSON format is wrong - Creation failed

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Test quota is reached

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                          ## Create an API test.
# Example of an API test.

# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/tests/api" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "config": { "assertions": [ { "operator": "lessThan", "target": 1000, "type": "responseTime" }, { "operator": "is", "target": 200, "type": "statusCode" }, { "operator": "is", "property": "content-type", "target": "text/html; charset=UTF-8", "type": "header" } ], "request": { "method": "GET", "url": "https://example.com" } }, "locations": [ "azure:eastus", "aws:eu-west-3" ], "message": "MY_NOTIFICATION_MESSAGE", "name": "MY_TEST_NAME", "options": { "min_failure_duration": 0, "min_location_failed": 1, "monitor_options": { "include_tags": true, "locked": false, "new_host_delay": 300, "notify_audit": false, "notify_no_data": false, "renotify_interval": 0 }, "tick_every": 60 }, "status": "live", "subtype": "http", "tags": [ "env:production" ], "type": "api" } EOF
## Create a Multistep API test # Example of a multistep API test running on a fake furniture store. # It creates a card, select a product and then add the product to the card.
# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/tests/api" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "config": { "steps": [ { "assertions": [ { "operator": "lessThan", "target": 30000, "type": "responseTime" } ], "extractedValues": [ { "field": "location", "name": "CART_ID", "parser": { "type": "regex", "value": "(?:[^\\\\/](?!(\\\\|/)))+$" }, "type": "http_header" } ], "name": "Get a cart", "request": { "method": "POST", "timeout": 30, "url": "https://api.shopist.io/carts" }, "subtype": "http" }, { "assertions": [ { "operator": "is", "target": 200, "type": "statusCode" } ], "extractedValues": [ { "name": "PRODUCT_ID", "parser": { "type": "json_path", "value": "$[0].id['$oid']" }, "type": "http_body" } ], "name": "Get a product", "request": { "method": "GET", "timeout": 30, "url": "https://api.shopist.io/products.json" }, "subtype": "http" }, { "assertions": [ { "operator": "is", "target": 201, "type": "statusCode" } ], "name": "Add product to cart", "request": { "body": "{\n \"cart_item\": {\n \"product_id\": \"{{ PRODUCT_ID }}\",\n \"amount_paid\": 500,\n \"quantity\": 1\n },\n \"cart_id\": \"{{ CART_ID }}\"\n}", "headers": { "content-type": "application/json" }, "method": "POST", "timeout": 30, "url": "https://api.shopist.io/add_item.json" }, "subtype": "http" } ] }, "locations": [ "aws:us-west-2" ], "message": "MY_NOTIFICATION_MESSAGE", "name": "MY_TEST_NAME", "options": { "ci": { "executionRule": "blocking" }, "min_failure_duration": 5400, "min_location_failed": 1, "monitor_options": { "renotify_interval": 0 }, "retry": { "count": 3, "interval": 300 }, "tick_every": 900 }, "status": "live", "subtype": "multi", "tags": [ "env:prod" ], "type": "api" } EOF
                          ## Create an API test.
# Example of an API test.

# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/tests/api" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "config": { "assertions": [ { "operator": "lessThan", "target": 1000, "type": "responseTime" }, { "operator": "is", "target": 200, "type": "statusCode" }, { "operator": "is", "property": "content-type", "target": "text/html; charset=UTF-8", "type": "header" } ], "request": { "method": "GET", "url": "https://example.com" } }, "locations": [ "azure:eastus", "aws:eu-west-3" ], "message": "MY_NOTIFICATION_MESSAGE", "name": "MY_TEST_NAME", "options": { "min_failure_duration": 0, "min_location_failed": 1, "monitor_options": { "include_tags": true, "locked": false, "new_host_delay": 300, "notify_audit": false, "notify_no_data": false, "renotify_interval": 0 }, "tick_every": 60 }, "status": "live", "subtype": "http", "tags": [ "env:production" ], "type": "api" } EOF
## Create a Multistep API test # Example of a multistep API test running on a fake furniture store. # It creates a card, select a product and then add the product to the card.
# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/tests/api" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "config": { "steps": [ { "assertions": [ { "operator": "lessThan", "target": 30000, "type": "responseTime" } ], "extractedValues": [ { "field": "location", "name": "CART_ID", "parser": { "type": "regex", "value": "(?:[^\\\\/](?!(\\\\|/)))+$" }, "type": "http_header" } ], "name": "Get a cart", "request": { "method": "POST", "timeout": 30, "url": "https://api.shopist.io/carts" }, "subtype": "http" }, { "assertions": [ { "operator": "is", "target": 200, "type": "statusCode" } ], "extractedValues": [ { "name": "PRODUCT_ID", "parser": { "type": "json_path", "value": "$[0].id['$oid']" }, "type": "http_body" } ], "name": "Get a product", "request": { "method": "GET", "timeout": 30, "url": "https://api.shopist.io/products.json" }, "subtype": "http" }, { "assertions": [ { "operator": "is", "target": 201, "type": "statusCode" } ], "name": "Add product to cart", "request": { "body": "{\n \"cart_item\": {\n \"product_id\": \"{{ PRODUCT_ID }}\",\n \"amount_paid\": 500,\n \"quantity\": 1\n },\n \"cart_id\": \"{{ CART_ID }}\"\n}", "headers": { "content-type": "application/json" }, "method": "POST", "timeout": 30, "url": "https://api.shopist.io/add_item.json" }, "subtype": "http" } ] }, "locations": [ "aws:us-west-2" ], "message": "MY_NOTIFICATION_MESSAGE", "name": "MY_TEST_NAME", "options": { "ci": { "executionRule": "blocking" }, "min_failure_duration": 5400, "min_location_failed": 1, "monitor_options": { "renotify_interval": 0 }, "retry": { "count": 3, "interval": 300 }, "tick_every": 900 }, "status": "live", "subtype": "multi", "tags": [ "env:prod" ], "type": "api" } EOF
                          ## Create an API test.
# Example of an API test.

# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/tests/api" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "config": { "assertions": [ { "operator": "lessThan", "target": 1000, "type": "responseTime" }, { "operator": "is", "target": 200, "type": "statusCode" }, { "operator": "is", "property": "content-type", "target": "text/html; charset=UTF-8", "type": "header" } ], "request": { "method": "GET", "url": "https://example.com" } }, "locations": [ "azure:eastus", "aws:eu-west-3" ], "message": "MY_NOTIFICATION_MESSAGE", "name": "MY_TEST_NAME", "options": { "min_failure_duration": 0, "min_location_failed": 1, "monitor_options": { "include_tags": true, "locked": false, "new_host_delay": 300, "notify_audit": false, "notify_no_data": false, "renotify_interval": 0 }, "tick_every": 60 }, "status": "live", "subtype": "http", "tags": [ "env:production" ], "type": "api" } EOF
## Create a Multistep API test # Example of a multistep API test running on a fake furniture store. # It creates a card, select a product and then add the product to the card.
# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/tests/api" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "config": { "steps": [ { "assertions": [ { "operator": "lessThan", "target": 30000, "type": "responseTime" } ], "extractedValues": [ { "field": "location", "name": "CART_ID", "parser": { "type": "regex", "value": "(?:[^\\\\/](?!(\\\\|/)))+$" }, "type": "http_header" } ], "name": "Get a cart", "request": { "method": "POST", "timeout": 30, "url": "https://api.shopist.io/carts" }, "subtype": "http" }, { "assertions": [ { "operator": "is", "target": 200, "type": "statusCode" } ], "extractedValues": [ { "name": "PRODUCT_ID", "parser": { "type": "json_path", "value": "$[0].id['$oid']" }, "type": "http_body" } ], "name": "Get a product", "request": { "method": "GET", "timeout": 30, "url": "https://api.shopist.io/products.json" }, "subtype": "http" }, { "assertions": [ { "operator": "is", "target": 201, "type": "statusCode" } ], "name": "Add product to cart", "request": { "body": "{\n \"cart_item\": {\n \"product_id\": \"{{ PRODUCT_ID }}\",\n \"amount_paid\": 500,\n \"quantity\": 1\n },\n \"cart_id\": \"{{ CART_ID }}\"\n}", "headers": { "content-type": "application/json" }, "method": "POST", "timeout": 30, "url": "https://api.shopist.io/add_item.json" }, "subtype": "http" } ] }, "locations": [ "aws:us-west-2" ], "message": "MY_NOTIFICATION_MESSAGE", "name": "MY_TEST_NAME", "options": { "ci": { "executionRule": "blocking" }, "min_failure_duration": 5400, "min_location_failed": 1, "monitor_options": { "renotify_interval": 0 }, "retry": { "count": 3, "interval": 300 }, "tick_every": 900 }, "status": "live", "subtype": "multi", "tags": [ "env:prod" ], "type": "api" } EOF
// Create a multi-step api test with every type of basicAuth returns "OK - Returns the created test details." 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/datadogV1"
)

func main() {
	body := datadogV1.SyntheticsAPITest{
		Config: datadogV1.SyntheticsAPITestConfig{
			Steps: []datadogV1.SyntheticsAPIStep{
				datadogV1.SyntheticsAPIStep{
					SyntheticsAPITestStep: &datadogV1.SyntheticsAPITestStep{
						Assertions: []datadogV1.SyntheticsAssertion{
							datadogV1.SyntheticsAssertion{
								SyntheticsAssertionTarget: &datadogV1.SyntheticsAssertionTarget{
									Operator: datadogV1.SYNTHETICSASSERTIONOPERATOR_IS,
									Type:     datadogV1.SYNTHETICSASSERTIONTYPE_STATUS_CODE,
									Target:   200,
								}},
						},
						Name: "request is sent",
						Request: datadogV1.SyntheticsTestRequest{
							Url:    datadog.PtrString("https://httpbin.org/status/200"),
							Method: datadog.PtrString("GET"),
							BasicAuth: &datadogV1.SyntheticsBasicAuth{
								SyntheticsBasicAuthWeb: &datadogV1.SyntheticsBasicAuthWeb{
									Password: "password",
									Username: "username",
								}},
						},
						Subtype: datadogV1.SYNTHETICSAPITESTSTEPSUBTYPE_HTTP,
					}},
				datadogV1.SyntheticsAPIStep{
					SyntheticsAPITestStep: &datadogV1.SyntheticsAPITestStep{
						Assertions: []datadogV1.SyntheticsAssertion{
							datadogV1.SyntheticsAssertion{
								SyntheticsAssertionTarget: &datadogV1.SyntheticsAssertionTarget{
									Operator: datadogV1.SYNTHETICSASSERTIONOPERATOR_IS,
									Type:     datadogV1.SYNTHETICSASSERTIONTYPE_STATUS_CODE,
									Target:   200,
								}},
						},
						Name: "request is sent",
						Request: datadogV1.SyntheticsTestRequest{
							Url:    datadog.PtrString("https://httpbin.org/status/200"),
							Method: datadog.PtrString("GET"),
							BasicAuth: &datadogV1.SyntheticsBasicAuth{
								SyntheticsBasicAuthWeb: &datadogV1.SyntheticsBasicAuthWeb{
									Password: "password",
									Username: "username",
									Type:     datadogV1.SYNTHETICSBASICAUTHWEBTYPE_WEB.Ptr(),
								}},
						},
						Subtype: datadogV1.SYNTHETICSAPITESTSTEPSUBTYPE_HTTP,
					}},
				datadogV1.SyntheticsAPIStep{
					SyntheticsAPITestStep: &datadogV1.SyntheticsAPITestStep{
						Assertions: []datadogV1.SyntheticsAssertion{
							datadogV1.SyntheticsAssertion{
								SyntheticsAssertionTarget: &datadogV1.SyntheticsAssertionTarget{
									Operator: datadogV1.SYNTHETICSASSERTIONOPERATOR_IS,
									Type:     datadogV1.SYNTHETICSASSERTIONTYPE_STATUS_CODE,
									Target:   200,
								}},
						},
						Name: "request is sent",
						Request: datadogV1.SyntheticsTestRequest{
							Url:    datadog.PtrString("https://httpbin.org/status/200"),
							Method: datadog.PtrString("GET"),
							BasicAuth: &datadogV1.SyntheticsBasicAuth{
								SyntheticsBasicAuthSigv4: &datadogV1.SyntheticsBasicAuthSigv4{
									AccessKey: "accessKey",
									SecretKey: "secretKey",
									Type:      datadogV1.SYNTHETICSBASICAUTHSIGV4TYPE_SIGV4,
								}},
						},
						Subtype: datadogV1.SYNTHETICSAPITESTSTEPSUBTYPE_HTTP,
					}},
				datadogV1.SyntheticsAPIStep{
					SyntheticsAPITestStep: &datadogV1.SyntheticsAPITestStep{
						Assertions: []datadogV1.SyntheticsAssertion{
							datadogV1.SyntheticsAssertion{
								SyntheticsAssertionTarget: &datadogV1.SyntheticsAssertionTarget{
									Operator: datadogV1.SYNTHETICSASSERTIONOPERATOR_IS,
									Type:     datadogV1.SYNTHETICSASSERTIONTYPE_STATUS_CODE,
									Target:   200,
								}},
						},
						Name: "request is sent",
						Request: datadogV1.SyntheticsTestRequest{
							Url:    datadog.PtrString("https://httpbin.org/status/200"),
							Method: datadog.PtrString("GET"),
							BasicAuth: &datadogV1.SyntheticsBasicAuth{
								SyntheticsBasicAuthNTLM: &datadogV1.SyntheticsBasicAuthNTLM{
									Type: datadogV1.SYNTHETICSBASICAUTHNTLMTYPE_NTLM,
								}},
						},
						Subtype: datadogV1.SYNTHETICSAPITESTSTEPSUBTYPE_HTTP,
					}},
				datadogV1.SyntheticsAPIStep{
					SyntheticsAPITestStep: &datadogV1.SyntheticsAPITestStep{
						Assertions: []datadogV1.SyntheticsAssertion{
							datadogV1.SyntheticsAssertion{
								SyntheticsAssertionTarget: &datadogV1.SyntheticsAssertionTarget{
									Operator: datadogV1.SYNTHETICSASSERTIONOPERATOR_IS,
									Type:     datadogV1.SYNTHETICSASSERTIONTYPE_STATUS_CODE,
									Target:   200,
								}},
						},
						Name: "request is sent",
						Request: datadogV1.SyntheticsTestRequest{
							Url:    datadog.PtrString("https://httpbin.org/status/200"),
							Method: datadog.PtrString("GET"),
							BasicAuth: &datadogV1.SyntheticsBasicAuth{
								SyntheticsBasicAuthDigest: &datadogV1.SyntheticsBasicAuthDigest{
									Password: "password",
									Username: "username",
									Type:     datadogV1.SYNTHETICSBASICAUTHDIGESTTYPE_DIGEST,
								}},
						},
						Subtype: datadogV1.SYNTHETICSAPITESTSTEPSUBTYPE_HTTP,
					}},
				datadogV1.SyntheticsAPIStep{
					SyntheticsAPITestStep: &datadogV1.SyntheticsAPITestStep{
						Assertions: []datadogV1.SyntheticsAssertion{
							datadogV1.SyntheticsAssertion{
								SyntheticsAssertionTarget: &datadogV1.SyntheticsAssertionTarget{
									Operator: datadogV1.SYNTHETICSASSERTIONOPERATOR_IS,
									Type:     datadogV1.SYNTHETICSASSERTIONTYPE_STATUS_CODE,
									Target:   200,
								}},
						},
						Name: "request is sent",
						Request: datadogV1.SyntheticsTestRequest{
							Url:    datadog.PtrString("https://httpbin.org/status/200"),
							Method: datadog.PtrString("GET"),
							BasicAuth: &datadogV1.SyntheticsBasicAuth{
								SyntheticsBasicAuthOauthClient: &datadogV1.SyntheticsBasicAuthOauthClient{
									AccessTokenUrl:         "accessTokenUrl",
									TokenApiAuthentication: datadogV1.SYNTHETICSBASICAUTHOAUTHTOKENAPIAUTHENTICATION_HEADER,
									ClientId:               "clientId",
									ClientSecret:           "clientSecret",
									Type:                   datadogV1.SYNTHETICSBASICAUTHOAUTHCLIENTTYPE_OAUTH_CLIENT,
								}},
						},
						Subtype: datadogV1.SYNTHETICSAPITESTSTEPSUBTYPE_HTTP,
					}},
				datadogV1.SyntheticsAPIStep{
					SyntheticsAPITestStep: &datadogV1.SyntheticsAPITestStep{
						Assertions: []datadogV1.SyntheticsAssertion{
							datadogV1.SyntheticsAssertion{
								SyntheticsAssertionTarget: &datadogV1.SyntheticsAssertionTarget{
									Operator: datadogV1.SYNTHETICSASSERTIONOPERATOR_IS,
									Type:     datadogV1.SYNTHETICSASSERTIONTYPE_STATUS_CODE,
									Target:   200,
								}},
						},
						Name: "request is sent",
						Request: datadogV1.SyntheticsTestRequest{
							Url:    datadog.PtrString("https://httpbin.org/status/200"),
							Method: datadog.PtrString("GET"),
							BasicAuth: &datadogV1.SyntheticsBasicAuth{
								SyntheticsBasicAuthOauthROP: &datadogV1.SyntheticsBasicAuthOauthROP{
									AccessTokenUrl:         "accessTokenUrl",
									Password:               "password",
									TokenApiAuthentication: datadogV1.SYNTHETICSBASICAUTHOAUTHTOKENAPIAUTHENTICATION_HEADER,
									Username:               "username",
									Type:                   datadogV1.SYNTHETICSBASICAUTHOAUTHROPTYPE_OAUTH_ROP,
								}},
						},
						Subtype: datadogV1.SYNTHETICSAPITESTSTEPSUBTYPE_HTTP,
					}},
			},
		},
		Locations: []string{
			"aws:us-east-2",
		},
		Message: "BDD test payload: synthetics_api_test_multi_step_with_every_type_of_basic_auth.json",
		Name:    "Example-Synthetic",
		Options: datadogV1.SyntheticsTestOptions{
			TickEvery: datadog.PtrInt64(60),
		},
		Subtype: datadogV1.SYNTHETICSTESTDETAILSSUBTYPE_MULTI.Ptr(),
		Type:    datadogV1.SYNTHETICSAPITESTTYPE_API,
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.CreateSyntheticsAPITest(ctx, body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.CreateSyntheticsAPITest`:\n%s\n", responseContent)
}
// Create an API GRPC test returns "OK - Returns the created test details." 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/datadogV1"
)

func main() {
	body := datadogV1.SyntheticsAPITest{
		Config: datadogV1.SyntheticsAPITestConfig{
			Assertions: []datadogV1.SyntheticsAssertion{
				datadogV1.SyntheticsAssertion{
					SyntheticsAssertionTarget: &datadogV1.SyntheticsAssertionTarget{
						Operator: datadogV1.SYNTHETICSASSERTIONOPERATOR_IS,
						Target:   1,
						Type:     datadogV1.SYNTHETICSASSERTIONTYPE_GRPC_HEALTHCHECK_STATUS,
					}},
				datadogV1.SyntheticsAssertion{
					SyntheticsAssertionTarget: &datadogV1.SyntheticsAssertionTarget{
						Operator: datadogV1.SYNTHETICSASSERTIONOPERATOR_IS,
						Target:   "proto target",
						Type:     datadogV1.SYNTHETICSASSERTIONTYPE_GRPC_PROTO,
					}},
				datadogV1.SyntheticsAssertion{
					SyntheticsAssertionTarget: &datadogV1.SyntheticsAssertionTarget{
						Operator: datadogV1.SYNTHETICSASSERTIONOPERATOR_IS,
						Target:   "123",
						Property: datadog.PtrString("property"),
						Type:     datadogV1.SYNTHETICSASSERTIONTYPE_GRPC_METADATA,
					}},
			},
			Request: &datadogV1.SyntheticsTestRequest{
				Host:     datadog.PtrString("localhost"),
				Port:     datadog.PtrInt64(50051),
				Service:  datadog.PtrString("Hello"),
				Method:   datadog.PtrString("GET"),
				Message:  datadog.PtrString(""),
				Metadata: map[string]string{},
			},
		},
		Locations: []string{
			"aws:us-east-2",
		},
		Message: "BDD test payload: synthetics_api_grpc_test_payload.json",
		Name:    "Example-Synthetic",
		Options: datadogV1.SyntheticsTestOptions{
			MinFailureDuration: datadog.PtrInt64(0),
			MinLocationFailed:  datadog.PtrInt64(1),
			MonitorOptions: &datadogV1.SyntheticsTestOptionsMonitorOptions{
				RenotifyInterval: datadog.PtrInt64(0),
			},
			MonitorName: datadog.PtrString("Example-Synthetic"),
			TickEvery:   datadog.PtrInt64(60),
		},
		Subtype: datadogV1.SYNTHETICSTESTDETAILSSUBTYPE_GRPC.Ptr(),
		Tags: []string{
			"testing:api",
		},
		Type: datadogV1.SYNTHETICSAPITESTTYPE_API,
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.CreateSyntheticsAPITest(ctx, body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.CreateSyntheticsAPITest`:\n%s\n", responseContent)
}
// Create an API HTTP test has bodyHash filled out

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/datadogV1"
)

func main() {
	body := datadogV1.SyntheticsAPITest{
		Config: datadogV1.SyntheticsAPITestConfig{
			Assertions: []datadogV1.SyntheticsAssertion{
				datadogV1.SyntheticsAssertion{
					SyntheticsAssertionTarget: &datadogV1.SyntheticsAssertionTarget{
						Operator: datadogV1.SYNTHETICSASSERTIONOPERATOR_IS,
						Property: datadog.PtrString("{{ PROPERTY }}"),
						Target:   "text/html",
						Type:     datadogV1.SYNTHETICSASSERTIONTYPE_HEADER,
					}},
				datadogV1.SyntheticsAssertion{
					SyntheticsAssertionTarget: &datadogV1.SyntheticsAssertionTarget{
						Operator:     datadogV1.SYNTHETICSASSERTIONOPERATOR_LESS_THAN,
						Target:       2000,
						Type:         datadogV1.SYNTHETICSASSERTIONTYPE_RESPONSE_TIME,
						TimingsScope: datadogV1.SYNTHETICSASSERTIONTIMINGSSCOPE_WITHOUT_DNS.Ptr(),
					}},
				datadogV1.SyntheticsAssertion{
					SyntheticsAssertionJSONPathTarget: &datadogV1.SyntheticsAssertionJSONPathTarget{
						Operator: datadogV1.SYNTHETICSASSERTIONJSONPATHOPERATOR_VALIDATES_JSON_PATH,
						Target: &datadogV1.SyntheticsAssertionJSONPathTargetTarget{
							JsonPath:    datadog.PtrString("topKey"),
							Operator:    datadog.PtrString("isNot"),
							TargetValue: "0",
						},
						Type: datadogV1.SYNTHETICSASSERTIONTYPE_BODY,
					}},
				datadogV1.SyntheticsAssertion{
					SyntheticsAssertionJSONPathTarget: &datadogV1.SyntheticsAssertionJSONPathTarget{
						Operator: datadogV1.SYNTHETICSASSERTIONJSONPATHOPERATOR_VALIDATES_JSON_PATH,
						Target: &datadogV1.SyntheticsAssertionJSONPathTargetTarget{
							ElementsOperator: datadog.PtrString("atLeastOneElementMatches"),
							JsonPath:         datadog.PtrString("topKey"),
							Operator:         datadog.PtrString("isNot"),
							TargetValue:      "0",
						},
						Type: datadogV1.SYNTHETICSASSERTIONTYPE_BODY,
					}},
				datadogV1.SyntheticsAssertion{
					SyntheticsAssertionJSONSchemaTarget: &datadogV1.SyntheticsAssertionJSONSchemaTarget{
						Operator: datadogV1.SYNTHETICSASSERTIONJSONSCHEMAOPERATOR_VALIDATES_JSON_SCHEMA,
						Target: &datadogV1.SyntheticsAssertionJSONSchemaTargetTarget{
							MetaSchema: datadogV1.SYNTHETICSASSERTIONJSONSCHEMAMETASCHEMA_DRAFT_07.Ptr(),
							JsonSchema: datadog.PtrString(`{"type": "object", "properties":{"slideshow":{"type":"object"}}}`),
						},
						Type: datadogV1.SYNTHETICSASSERTIONTYPE_BODY,
					}},
				datadogV1.SyntheticsAssertion{
					SyntheticsAssertionXPathTarget: &datadogV1.SyntheticsAssertionXPathTarget{
						Operator: datadogV1.SYNTHETICSASSERTIONXPATHOPERATOR_VALIDATES_X_PATH,
						Target: &datadogV1.SyntheticsAssertionXPathTargetTarget{
							XPath:       datadog.PtrString("target-xpath"),
							TargetValue: "0",
							Operator:    datadog.PtrString("contains"),
						},
						Type: datadogV1.SYNTHETICSASSERTIONTYPE_BODY,
					}},
				datadogV1.SyntheticsAssertion{
					SyntheticsAssertionBodyHashTarget: &datadogV1.SyntheticsAssertionBodyHashTarget{
						Operator: datadogV1.SYNTHETICSASSERTIONBODYHASHOPERATOR_MD5,
						Target:   "a",
						Type:     datadogV1.SYNTHETICSASSERTIONBODYHASHTYPE_BODY_HASH,
					}},
			},
			ConfigVariables: []datadogV1.SyntheticsConfigVariable{
				{
					Example: datadog.PtrString("content-type"),
					Name:    "PROPERTY",
					Pattern: datadog.PtrString("content-type"),
					Type:    datadogV1.SYNTHETICSCONFIGVARIABLETYPE_TEXT,
				},
			},
			VariablesFromScript: datadog.PtrString(`dd.variable.set("FOO", "foo")`),
			Request: &datadogV1.SyntheticsTestRequest{
				Certificate: &datadogV1.SyntheticsTestRequestCertificate{
					Cert: &datadogV1.SyntheticsTestRequestCertificateItem{
						Content:   datadog.PtrString("cert-content"),
						Filename:  datadog.PtrString("cert-filename"),
						UpdatedAt: datadog.PtrString("2020-10-16T09:23:24.857Z"),
					},
					Key: &datadogV1.SyntheticsTestRequestCertificateItem{
						Content:   datadog.PtrString("key-content"),
						Filename:  datadog.PtrString("key-filename"),
						UpdatedAt: datadog.PtrString("2020-10-16T09:23:24.857Z"),
					},
				},
				Headers: map[string]string{
					"unique": "examplesynthetic",
				},
				Method:  datadog.PtrString("GET"),
				Timeout: datadog.PtrFloat64(10),
				Url:     datadog.PtrString("https://datadoghq.com"),
				Proxy: &datadogV1.SyntheticsTestRequestProxy{
					Url:     "https://datadoghq.com",
					Headers: map[string]string{},
				},
				BasicAuth: &datadogV1.SyntheticsBasicAuth{
					SyntheticsBasicAuthOauthClient: &datadogV1.SyntheticsBasicAuthOauthClient{
						AccessTokenUrl:         "https://datadog-token.com",
						Audience:               datadog.PtrString("audience"),
						ClientId:               "client-id",
						ClientSecret:           "client-secret",
						Resource:               datadog.PtrString("resource"),
						Scope:                  datadog.PtrString("yoyo"),
						TokenApiAuthentication: datadogV1.SYNTHETICSBASICAUTHOAUTHTOKENAPIAUTHENTICATION_HEADER,
						Type:                   datadogV1.SYNTHETICSBASICAUTHOAUTHCLIENTTYPE_OAUTH_CLIENT,
					}},
				PersistCookies: datadog.PtrBool(true),
			},
		},
		Locations: []string{
			"aws:us-east-2",
		},
		Message: "BDD test payload: synthetics_api_http_test_payload.json",
		Name:    "Example-Synthetic",
		Options: datadogV1.SyntheticsTestOptions{
			AcceptSelfSigned:   datadog.PtrBool(false),
			AllowInsecure:      datadog.PtrBool(true),
			FollowRedirects:    datadog.PtrBool(true),
			MinFailureDuration: datadog.PtrInt64(10),
			MinLocationFailed:  datadog.PtrInt64(1),
			MonitorName:        datadog.PtrString("Example-Synthetic"),
			MonitorPriority:    datadog.PtrInt32(5),
			Retry: &datadogV1.SyntheticsTestOptionsRetry{
				Count:    datadog.PtrInt64(3),
				Interval: datadog.PtrFloat64(10),
			},
			TickEvery:   datadog.PtrInt64(60),
			HttpVersion: datadogV1.SYNTHETICSTESTOPTIONSHTTPVERSION_HTTP2.Ptr(),
		},
		Subtype: datadogV1.SYNTHETICSTESTDETAILSSUBTYPE_HTTP.Ptr(),
		Tags: []string{
			"testing:api",
		},
		Type: datadogV1.SYNTHETICSAPITESTTYPE_API,
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.CreateSyntheticsAPITest(ctx, body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.CreateSyntheticsAPITest`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Create an API GRPC test returns "OK - Returns the created test details." response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsAPITest;
import com.datadog.api.client.v1.model.SyntheticsAPITestConfig;
import com.datadog.api.client.v1.model.SyntheticsAPITestType;
import com.datadog.api.client.v1.model.SyntheticsAssertion;
import com.datadog.api.client.v1.model.SyntheticsAssertionOperator;
import com.datadog.api.client.v1.model.SyntheticsAssertionTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionType;
import com.datadog.api.client.v1.model.SyntheticsTestDetailsSubType;
import com.datadog.api.client.v1.model.SyntheticsTestOptions;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsMonitorOptions;
import com.datadog.api.client.v1.model.SyntheticsTestRequest;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;

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

    SyntheticsAPITest body =
        new SyntheticsAPITest()
            .config(
                new SyntheticsAPITestConfig()
                    .assertions(
                        Arrays.asList(
                            new SyntheticsAssertion(
                                new SyntheticsAssertionTarget()
                                    .operator(SyntheticsAssertionOperator.IS)
                                    .target(1)
                                    .type(SyntheticsAssertionType.GRPC_HEALTHCHECK_STATUS)),
                            new SyntheticsAssertion(
                                new SyntheticsAssertionTarget()
                                    .operator(SyntheticsAssertionOperator.IS)
                                    .target("proto target")
                                    .type(SyntheticsAssertionType.GRPC_PROTO)),
                            new SyntheticsAssertion(
                                new SyntheticsAssertionTarget()
                                    .operator(SyntheticsAssertionOperator.IS)
                                    .target("123")
                                    .property("property")
                                    .type(SyntheticsAssertionType.GRPC_METADATA))))
                    .request(
                        new SyntheticsTestRequest()
                            .host("localhost")
                            .port(50051L)
                            .service("Hello")
                            .method("GET")
                            .message("")
                            .metadata(Map.ofEntries())))
            .locations(Collections.singletonList("aws:us-east-2"))
            .message("BDD test payload: synthetics_api_grpc_test_payload.json")
            .name("Example-Synthetic")
            .options(
                new SyntheticsTestOptions()
                    .minFailureDuration(0L)
                    .minLocationFailed(1L)
                    .monitorOptions(new SyntheticsTestOptionsMonitorOptions().renotifyInterval(0L))
                    .monitorName("Example-Synthetic")
                    .tickEvery(60L))
            .subtype(SyntheticsTestDetailsSubType.GRPC)
            .tags(Collections.singletonList("testing:api"))
            .type(SyntheticsAPITestType.API);

    try {
      SyntheticsAPITest result = apiInstance.createSyntheticsAPITest(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#createSyntheticsAPITest");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
// Create an API HTTP test has bodyHash filled out

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsAPITest;
import com.datadog.api.client.v1.model.SyntheticsAPITestConfig;
import com.datadog.api.client.v1.model.SyntheticsAPITestType;
import com.datadog.api.client.v1.model.SyntheticsAssertion;
import com.datadog.api.client.v1.model.SyntheticsAssertionBodyHashOperator;
import com.datadog.api.client.v1.model.SyntheticsAssertionBodyHashTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionBodyHashType;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONPathOperator;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONPathTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONPathTargetTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONSchemaMetaSchema;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONSchemaOperator;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONSchemaTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONSchemaTargetTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionOperator;
import com.datadog.api.client.v1.model.SyntheticsAssertionTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionTimingsScope;
import com.datadog.api.client.v1.model.SyntheticsAssertionType;
import com.datadog.api.client.v1.model.SyntheticsAssertionXPathOperator;
import com.datadog.api.client.v1.model.SyntheticsAssertionXPathTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionXPathTargetTarget;
import com.datadog.api.client.v1.model.SyntheticsBasicAuth;
import com.datadog.api.client.v1.model.SyntheticsBasicAuthOauthClient;
import com.datadog.api.client.v1.model.SyntheticsBasicAuthOauthClientType;
import com.datadog.api.client.v1.model.SyntheticsBasicAuthOauthTokenApiAuthentication;
import com.datadog.api.client.v1.model.SyntheticsConfigVariable;
import com.datadog.api.client.v1.model.SyntheticsConfigVariableType;
import com.datadog.api.client.v1.model.SyntheticsTestDetailsSubType;
import com.datadog.api.client.v1.model.SyntheticsTestOptions;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsHTTPVersion;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsRetry;
import com.datadog.api.client.v1.model.SyntheticsTestRequest;
import com.datadog.api.client.v1.model.SyntheticsTestRequestCertificate;
import com.datadog.api.client.v1.model.SyntheticsTestRequestCertificateItem;
import com.datadog.api.client.v1.model.SyntheticsTestRequestProxy;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;

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

    SyntheticsAPITest body =
        new SyntheticsAPITest()
            .config(
                new SyntheticsAPITestConfig()
                    .assertions(
                        Arrays.asList(
                            new SyntheticsAssertion(
                                new SyntheticsAssertionTarget()
                                    .operator(SyntheticsAssertionOperator.IS)
                                    .property("{{ PROPERTY }}")
                                    .target("text/html")
                                    .type(SyntheticsAssertionType.HEADER)),
                            new SyntheticsAssertion(
                                new SyntheticsAssertionTarget()
                                    .operator(SyntheticsAssertionOperator.LESS_THAN)
                                    .target(2000)
                                    .type(SyntheticsAssertionType.RESPONSE_TIME)
                                    .timingsScope(SyntheticsAssertionTimingsScope.WITHOUT_DNS)),
                            new SyntheticsAssertion(
                                new SyntheticsAssertionJSONPathTarget()
                                    .operator(
                                        SyntheticsAssertionJSONPathOperator.VALIDATES_JSON_PATH)
                                    .target(
                                        new SyntheticsAssertionJSONPathTargetTarget()
                                            .jsonPath("topKey")
                                            .operator("isNot")
                                            .targetValue("0"))
                                    .type(SyntheticsAssertionType.BODY)),
                            new SyntheticsAssertion(
                                new SyntheticsAssertionJSONPathTarget()
                                    .operator(
                                        SyntheticsAssertionJSONPathOperator.VALIDATES_JSON_PATH)
                                    .target(
                                        new SyntheticsAssertionJSONPathTargetTarget()
                                            .elementsOperator("atLeastOneElementMatches")
                                            .jsonPath("topKey")
                                            .operator("isNot")
                                            .targetValue("0"))
                                    .type(SyntheticsAssertionType.BODY)),
                            new SyntheticsAssertion(
                                new SyntheticsAssertionJSONSchemaTarget()
                                    .operator(
                                        SyntheticsAssertionJSONSchemaOperator.VALIDATES_JSON_SCHEMA)
                                    .target(
                                        new SyntheticsAssertionJSONSchemaTargetTarget()
                                            .metaSchema(
                                                SyntheticsAssertionJSONSchemaMetaSchema.DRAFT_07)
                                            .jsonSchema(
                                                """
{"type": "object", "properties":{"slideshow":{"type":"object"}}}
"""))
                                    .type(SyntheticsAssertionType.BODY)),
                            new SyntheticsAssertion(
                                new SyntheticsAssertionXPathTarget()
                                    .operator(SyntheticsAssertionXPathOperator.VALIDATES_X_PATH)
                                    .target(
                                        new SyntheticsAssertionXPathTargetTarget()
                                            .xPath("target-xpath")
                                            .targetValue("0")
                                            .operator("contains"))
                                    .type(SyntheticsAssertionType.BODY)),
                            new SyntheticsAssertion(
                                new SyntheticsAssertionBodyHashTarget()
                                    .operator(SyntheticsAssertionBodyHashOperator.MD5)
                                    .target("a")
                                    .type(SyntheticsAssertionBodyHashType.BODY_HASH))))
                    .configVariables(
                        Collections.singletonList(
                            new SyntheticsConfigVariable()
                                .example("content-type")
                                .name("PROPERTY")
                                .pattern("content-type")
                                .type(SyntheticsConfigVariableType.TEXT)))
                    .variablesFromScript("""
dd.variable.set("FOO", "foo")
""")
                    .request(
                        new SyntheticsTestRequest()
                            .certificate(
                                new SyntheticsTestRequestCertificate()
                                    .cert(
                                        new SyntheticsTestRequestCertificateItem()
                                            .content("cert-content")
                                            .filename("cert-filename")
                                            .updatedAt("2020-10-16T09:23:24.857Z"))
                                    .key(
                                        new SyntheticsTestRequestCertificateItem()
                                            .content("key-content")
                                            .filename("key-filename")
                                            .updatedAt("2020-10-16T09:23:24.857Z")))
                            .headers(Map.ofEntries(Map.entry("unique", "examplesynthetic")))
                            .method("GET")
                            .timeout(10.0)
                            .url("https://datadoghq.com")
                            .proxy(
                                new SyntheticsTestRequestProxy()
                                    .url("https://datadoghq.com")
                                    .headers(Map.ofEntries()))
                            .basicAuth(
                                new SyntheticsBasicAuth(
                                    new SyntheticsBasicAuthOauthClient()
                                        .accessTokenUrl("https://datadog-token.com")
                                        .audience("audience")
                                        .clientId("client-id")
                                        .clientSecret("client-secret")
                                        .resource("resource")
                                        .scope("yoyo")
                                        .tokenApiAuthentication(
                                            SyntheticsBasicAuthOauthTokenApiAuthentication.HEADER)
                                        .type(SyntheticsBasicAuthOauthClientType.OAUTH_CLIENT)))
                            .persistCookies(true)))
            .locations(Collections.singletonList("aws:us-east-2"))
            .message("BDD test payload: synthetics_api_http_test_payload.json")
            .name("Example-Synthetic")
            .options(
                new SyntheticsTestOptions()
                    .acceptSelfSigned(false)
                    .allowInsecure(true)
                    .followRedirects(true)
                    .minFailureDuration(10L)
                    .minLocationFailed(1L)
                    .monitorName("Example-Synthetic")
                    .monitorPriority(5)
                    .retry(new SyntheticsTestOptionsRetry().count(3L).interval(10.0))
                    .tickEvery(60L)
                    .httpVersion(SyntheticsTestOptionsHTTPVersion.HTTP2))
            .subtype(SyntheticsTestDetailsSubType.HTTP)
            .tags(Collections.singletonList("testing:api"))
            .type(SyntheticsAPITestType.API);

    try {
      SyntheticsAPITest result = apiInstance.createSyntheticsAPITest(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#createSyntheticsAPITest");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
// Create an API HTTP test returns "OK - Returns the created test details." response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsAPITest;
import com.datadog.api.client.v1.model.SyntheticsAPITestConfig;
import com.datadog.api.client.v1.model.SyntheticsAPITestType;
import com.datadog.api.client.v1.model.SyntheticsAssertion;
import com.datadog.api.client.v1.model.SyntheticsAssertionBodyHashOperator;
import com.datadog.api.client.v1.model.SyntheticsAssertionBodyHashTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionBodyHashType;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONPathOperator;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONPathTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONPathTargetTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONSchemaMetaSchema;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONSchemaOperator;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONSchemaTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONSchemaTargetTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionOperator;
import com.datadog.api.client.v1.model.SyntheticsAssertionTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionTimingsScope;
import com.datadog.api.client.v1.model.SyntheticsAssertionType;
import com.datadog.api.client.v1.model.SyntheticsAssertionXPathOperator;
import com.datadog.api.client.v1.model.SyntheticsAssertionXPathTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionXPathTargetTarget;
import com.datadog.api.client.v1.model.SyntheticsBasicAuth;
import com.datadog.api.client.v1.model.SyntheticsBasicAuthOauthClient;
import com.datadog.api.client.v1.model.SyntheticsBasicAuthOauthClientType;
import com.datadog.api.client.v1.model.SyntheticsBasicAuthOauthTokenApiAuthentication;
import com.datadog.api.client.v1.model.SyntheticsConfigVariable;
import com.datadog.api.client.v1.model.SyntheticsConfigVariableType;
import com.datadog.api.client.v1.model.SyntheticsTestDetailsSubType;
import com.datadog.api.client.v1.model.SyntheticsTestOptions;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsHTTPVersion;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsRetry;
import com.datadog.api.client.v1.model.SyntheticsTestRequest;
import com.datadog.api.client.v1.model.SyntheticsTestRequestCertificate;
import com.datadog.api.client.v1.model.SyntheticsTestRequestCertificateItem;
import com.datadog.api.client.v1.model.SyntheticsTestRequestProxy;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;

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

    SyntheticsAPITest body =
        new SyntheticsAPITest()
            .config(
                new SyntheticsAPITestConfig()
                    .assertions(
                        Arrays.asList(
                            new SyntheticsAssertion(
                                new SyntheticsAssertionTarget()
                                    .operator(SyntheticsAssertionOperator.IS)
                                    .property("{{ PROPERTY }}")
                                    .target("text/html")
                                    .type(SyntheticsAssertionType.HEADER)),
                            new SyntheticsAssertion(
                                new SyntheticsAssertionTarget()
                                    .operator(SyntheticsAssertionOperator.LESS_THAN)
                                    .target(2000)
                                    .type(SyntheticsAssertionType.RESPONSE_TIME)
                                    .timingsScope(SyntheticsAssertionTimingsScope.WITHOUT_DNS)),
                            new SyntheticsAssertion(
                                new SyntheticsAssertionJSONPathTarget()
                                    .operator(
                                        SyntheticsAssertionJSONPathOperator.VALIDATES_JSON_PATH)
                                    .target(
                                        new SyntheticsAssertionJSONPathTargetTarget()
                                            .jsonPath("topKey")
                                            .operator("isNot")
                                            .targetValue("0"))
                                    .type(SyntheticsAssertionType.BODY)),
                            new SyntheticsAssertion(
                                new SyntheticsAssertionJSONPathTarget()
                                    .operator(
                                        SyntheticsAssertionJSONPathOperator.VALIDATES_JSON_PATH)
                                    .target(
                                        new SyntheticsAssertionJSONPathTargetTarget()
                                            .elementsOperator("atLeastOneElementMatches")
                                            .jsonPath("topKey")
                                            .operator("isNot")
                                            .targetValue("0"))
                                    .type(SyntheticsAssertionType.BODY)),
                            new SyntheticsAssertion(
                                new SyntheticsAssertionJSONSchemaTarget()
                                    .operator(
                                        SyntheticsAssertionJSONSchemaOperator.VALIDATES_JSON_SCHEMA)
                                    .target(
                                        new SyntheticsAssertionJSONSchemaTargetTarget()
                                            .metaSchema(
                                                SyntheticsAssertionJSONSchemaMetaSchema.DRAFT_07)
                                            .jsonSchema(
                                                """
{"type": "object", "properties":{"slideshow":{"type":"object"}}}
"""))
                                    .type(SyntheticsAssertionType.BODY)),
                            new SyntheticsAssertion(
                                new SyntheticsAssertionXPathTarget()
                                    .operator(SyntheticsAssertionXPathOperator.VALIDATES_X_PATH)
                                    .target(
                                        new SyntheticsAssertionXPathTargetTarget()
                                            .xPath("target-xpath")
                                            .targetValue("0")
                                            .operator("contains"))
                                    .type(SyntheticsAssertionType.BODY)),
                            new SyntheticsAssertion(
                                new SyntheticsAssertionBodyHashTarget()
                                    .operator(SyntheticsAssertionBodyHashOperator.MD5)
                                    .target("a")
                                    .type(SyntheticsAssertionBodyHashType.BODY_HASH))))
                    .configVariables(
                        Collections.singletonList(
                            new SyntheticsConfigVariable()
                                .example("content-type")
                                .name("PROPERTY")
                                .pattern("content-type")
                                .type(SyntheticsConfigVariableType.TEXT)))
                    .variablesFromScript("""
dd.variable.set("FOO", "foo")
""")
                    .request(
                        new SyntheticsTestRequest()
                            .certificate(
                                new SyntheticsTestRequestCertificate()
                                    .cert(
                                        new SyntheticsTestRequestCertificateItem()
                                            .content("cert-content")
                                            .filename("cert-filename")
                                            .updatedAt("2020-10-16T09:23:24.857Z"))
                                    .key(
                                        new SyntheticsTestRequestCertificateItem()
                                            .content("key-content")
                                            .filename("key-filename")
                                            .updatedAt("2020-10-16T09:23:24.857Z")))
                            .headers(Map.ofEntries(Map.entry("unique", "examplesynthetic")))
                            .method("GET")
                            .timeout(10.0)
                            .url("https://datadoghq.com")
                            .proxy(
                                new SyntheticsTestRequestProxy()
                                    .url("https://datadoghq.com")
                                    .headers(Map.ofEntries()))
                            .basicAuth(
                                new SyntheticsBasicAuth(
                                    new SyntheticsBasicAuthOauthClient()
                                        .accessTokenUrl("https://datadog-token.com")
                                        .audience("audience")
                                        .clientId("client-id")
                                        .clientSecret("client-secret")
                                        .resource("resource")
                                        .scope("yoyo")
                                        .tokenApiAuthentication(
                                            SyntheticsBasicAuthOauthTokenApiAuthentication.HEADER)
                                        .type(SyntheticsBasicAuthOauthClientType.OAUTH_CLIENT)))
                            .persistCookies(true)))
            .locations(Collections.singletonList("aws:us-east-2"))
            .message("BDD test payload: synthetics_api_http_test_payload.json")
            .name("Example-Synthetic")
            .options(
                new SyntheticsTestOptions()
                    .acceptSelfSigned(false)
                    .allowInsecure(true)
                    .followRedirects(true)
                    .minFailureDuration(10L)
                    .minLocationFailed(1L)
                    .monitorName("Example-Synthetic")
                    .monitorPriority(5)
                    .retry(new SyntheticsTestOptionsRetry().count(3L).interval(10.0))
                    .tickEvery(60L)
                    .httpVersion(SyntheticsTestOptionsHTTPVersion.HTTP2))
            .subtype(SyntheticsTestDetailsSubType.HTTP)
            .tags(Collections.singletonList("testing:api"))
            .type(SyntheticsAPITestType.API);

    try {
      SyntheticsAPITest result = apiInstance.createSyntheticsAPITest(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#createSyntheticsAPITest");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Create an API GRPC test returns "OK - Returns the created test details." response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_api_test import SyntheticsAPITest
from datadog_api_client.v1.model.synthetics_api_test_config import SyntheticsAPITestConfig
from datadog_api_client.v1.model.synthetics_api_test_type import SyntheticsAPITestType
from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator
from datadog_api_client.v1.model.synthetics_assertion_target import SyntheticsAssertionTarget
from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType
from datadog_api_client.v1.model.synthetics_test_details_sub_type import SyntheticsTestDetailsSubType
from datadog_api_client.v1.model.synthetics_test_metadata import SyntheticsTestMetadata
from datadog_api_client.v1.model.synthetics_test_options import SyntheticsTestOptions
from datadog_api_client.v1.model.synthetics_test_options_monitor_options import SyntheticsTestOptionsMonitorOptions
from datadog_api_client.v1.model.synthetics_test_request import SyntheticsTestRequest

body = SyntheticsAPITest(
    config=SyntheticsAPITestConfig(
        assertions=[
            SyntheticsAssertionTarget(
                operator=SyntheticsAssertionOperator.IS,
                target=1,
                type=SyntheticsAssertionType.GRPC_HEALTHCHECK_STATUS,
            ),
            SyntheticsAssertionTarget(
                operator=SyntheticsAssertionOperator.IS,
                target="proto target",
                type=SyntheticsAssertionType.GRPC_PROTO,
            ),
            SyntheticsAssertionTarget(
                operator=SyntheticsAssertionOperator.IS,
                target="123",
                _property="property",
                type=SyntheticsAssertionType.GRPC_METADATA,
            ),
        ],
        request=SyntheticsTestRequest(
            host="localhost",
            port=50051,
            service="Hello",
            method="GET",
            message="",
            metadata=SyntheticsTestMetadata(),
        ),
    ),
    locations=[
        "aws:us-east-2",
    ],
    message="BDD test payload: synthetics_api_grpc_test_payload.json",
    name="Example-Synthetic",
    options=SyntheticsTestOptions(
        min_failure_duration=0,
        min_location_failed=1,
        monitor_options=SyntheticsTestOptionsMonitorOptions(
            renotify_interval=0,
        ),
        monitor_name="Example-Synthetic",
        tick_every=60,
    ),
    subtype=SyntheticsTestDetailsSubType.GRPC,
    tags=[
        "testing:api",
    ],
    type=SyntheticsAPITestType.API,
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.create_synthetics_api_test(body=body)

    print(response)
"""
Create an API HTTP test has bodyHash filled out
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_api_test import SyntheticsAPITest
from datadog_api_client.v1.model.synthetics_api_test_config import SyntheticsAPITestConfig
from datadog_api_client.v1.model.synthetics_api_test_type import SyntheticsAPITestType
from datadog_api_client.v1.model.synthetics_assertion_body_hash_operator import SyntheticsAssertionBodyHashOperator
from datadog_api_client.v1.model.synthetics_assertion_body_hash_target import SyntheticsAssertionBodyHashTarget
from datadog_api_client.v1.model.synthetics_assertion_body_hash_type import SyntheticsAssertionBodyHashType
from datadog_api_client.v1.model.synthetics_assertion_json_path_operator import SyntheticsAssertionJSONPathOperator
from datadog_api_client.v1.model.synthetics_assertion_json_path_target import SyntheticsAssertionJSONPathTarget
from datadog_api_client.v1.model.synthetics_assertion_json_path_target_target import (
    SyntheticsAssertionJSONPathTargetTarget,
)
from datadog_api_client.v1.model.synthetics_assertion_json_schema_meta_schema import (
    SyntheticsAssertionJSONSchemaMetaSchema,
)
from datadog_api_client.v1.model.synthetics_assertion_json_schema_operator import SyntheticsAssertionJSONSchemaOperator
from datadog_api_client.v1.model.synthetics_assertion_json_schema_target import SyntheticsAssertionJSONSchemaTarget
from datadog_api_client.v1.model.synthetics_assertion_json_schema_target_target import (
    SyntheticsAssertionJSONSchemaTargetTarget,
)
from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator
from datadog_api_client.v1.model.synthetics_assertion_target import SyntheticsAssertionTarget
from datadog_api_client.v1.model.synthetics_assertion_timings_scope import SyntheticsAssertionTimingsScope
from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType
from datadog_api_client.v1.model.synthetics_assertion_x_path_operator import SyntheticsAssertionXPathOperator
from datadog_api_client.v1.model.synthetics_assertion_x_path_target import SyntheticsAssertionXPathTarget
from datadog_api_client.v1.model.synthetics_assertion_x_path_target_target import SyntheticsAssertionXPathTargetTarget
from datadog_api_client.v1.model.synthetics_basic_auth_oauth_client import SyntheticsBasicAuthOauthClient
from datadog_api_client.v1.model.synthetics_basic_auth_oauth_client_type import SyntheticsBasicAuthOauthClientType
from datadog_api_client.v1.model.synthetics_basic_auth_oauth_token_api_authentication import (
    SyntheticsBasicAuthOauthTokenApiAuthentication,
)
from datadog_api_client.v1.model.synthetics_config_variable import SyntheticsConfigVariable
from datadog_api_client.v1.model.synthetics_config_variable_type import SyntheticsConfigVariableType
from datadog_api_client.v1.model.synthetics_test_details_sub_type import SyntheticsTestDetailsSubType
from datadog_api_client.v1.model.synthetics_test_headers import SyntheticsTestHeaders
from datadog_api_client.v1.model.synthetics_test_options import SyntheticsTestOptions
from datadog_api_client.v1.model.synthetics_test_options_http_version import SyntheticsTestOptionsHTTPVersion
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry
from datadog_api_client.v1.model.synthetics_test_request import SyntheticsTestRequest
from datadog_api_client.v1.model.synthetics_test_request_certificate import SyntheticsTestRequestCertificate
from datadog_api_client.v1.model.synthetics_test_request_certificate_item import SyntheticsTestRequestCertificateItem
from datadog_api_client.v1.model.synthetics_test_request_proxy import SyntheticsTestRequestProxy

body = SyntheticsAPITest(
    config=SyntheticsAPITestConfig(
        assertions=[
            SyntheticsAssertionTarget(
                operator=SyntheticsAssertionOperator.IS,
                _property="{{ PROPERTY }}",
                target="text/html",
                type=SyntheticsAssertionType.HEADER,
            ),
            SyntheticsAssertionTarget(
                operator=SyntheticsAssertionOperator.LESS_THAN,
                target=2000,
                type=SyntheticsAssertionType.RESPONSE_TIME,
                timings_scope=SyntheticsAssertionTimingsScope.WITHOUT_DNS,
            ),
            SyntheticsAssertionJSONPathTarget(
                operator=SyntheticsAssertionJSONPathOperator.VALIDATES_JSON_PATH,
                target=SyntheticsAssertionJSONPathTargetTarget(
                    json_path="topKey",
                    operator="isNot",
                    target_value="0",
                ),
                type=SyntheticsAssertionType.BODY,
            ),
            SyntheticsAssertionJSONPathTarget(
                operator=SyntheticsAssertionJSONPathOperator.VALIDATES_JSON_PATH,
                target=SyntheticsAssertionJSONPathTargetTarget(
                    elements_operator="atLeastOneElementMatches",
                    json_path="topKey",
                    operator="isNot",
                    target_value="0",
                ),
                type=SyntheticsAssertionType.BODY,
            ),
            SyntheticsAssertionJSONSchemaTarget(
                operator=SyntheticsAssertionJSONSchemaOperator.VALIDATES_JSON_SCHEMA,
                target=SyntheticsAssertionJSONSchemaTargetTarget(
                    meta_schema=SyntheticsAssertionJSONSchemaMetaSchema.DRAFT_07,
                    json_schema='{"type": "object", "properties":{"slideshow":{"type":"object"}}}',
                ),
                type=SyntheticsAssertionType.BODY,
            ),
            SyntheticsAssertionXPathTarget(
                operator=SyntheticsAssertionXPathOperator.VALIDATES_X_PATH,
                target=SyntheticsAssertionXPathTargetTarget(
                    x_path="target-xpath",
                    target_value="0",
                    operator="contains",
                ),
                type=SyntheticsAssertionType.BODY,
            ),
            SyntheticsAssertionBodyHashTarget(
                operator=SyntheticsAssertionBodyHashOperator.MD5,
                target="a",
                type=SyntheticsAssertionBodyHashType.BODY_HASH,
            ),
        ],
        config_variables=[
            SyntheticsConfigVariable(
                example="content-type",
                name="PROPERTY",
                pattern="content-type",
                type=SyntheticsConfigVariableType.TEXT,
            ),
        ],
        variables_from_script='dd.variable.set("FOO", "foo")',
        request=SyntheticsTestRequest(
            certificate=SyntheticsTestRequestCertificate(
                cert=SyntheticsTestRequestCertificateItem(
                    content="cert-content",
                    filename="cert-filename",
                    updated_at="2020-10-16T09:23:24.857Z",
                ),
                key=SyntheticsTestRequestCertificateItem(
                    content="key-content",
                    filename="key-filename",
                    updated_at="2020-10-16T09:23:24.857Z",
                ),
            ),
            headers=SyntheticsTestHeaders(
                unique="examplesynthetic",
            ),
            method="GET",
            timeout=10.0,
            url="https://datadoghq.com",
            proxy=SyntheticsTestRequestProxy(
                url="https://datadoghq.com",
                headers=SyntheticsTestHeaders(),
            ),
            basic_auth=SyntheticsBasicAuthOauthClient(
                access_token_url="https://datadog-token.com",
                audience="audience",
                client_id="client-id",
                client_secret="client-secret",
                resource="resource",
                scope="yoyo",
                token_api_authentication=SyntheticsBasicAuthOauthTokenApiAuthentication.HEADER,
                type=SyntheticsBasicAuthOauthClientType.OAUTH_CLIENT,
            ),
            persist_cookies=True,
        ),
    ),
    locations=[
        "aws:us-east-2",
    ],
    message="BDD test payload: synthetics_api_http_test_payload.json",
    name="Example-Synthetic",
    options=SyntheticsTestOptions(
        accept_self_signed=False,
        allow_insecure=True,
        follow_redirects=True,
        min_failure_duration=10,
        min_location_failed=1,
        monitor_name="Example-Synthetic",
        monitor_priority=5,
        retry=SyntheticsTestOptionsRetry(
            count=3,
            interval=10.0,
        ),
        tick_every=60,
        http_version=SyntheticsTestOptionsHTTPVersion.HTTP2,
    ),
    subtype=SyntheticsTestDetailsSubType.HTTP,
    tags=[
        "testing:api",
    ],
    type=SyntheticsAPITestType.API,
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.create_synthetics_api_test(body=body)

    print(response)
"""
Create an API HTTP test returns "OK - Returns the created test details." response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_api_test import SyntheticsAPITest
from datadog_api_client.v1.model.synthetics_api_test_config import SyntheticsAPITestConfig
from datadog_api_client.v1.model.synthetics_api_test_type import SyntheticsAPITestType
from datadog_api_client.v1.model.synthetics_assertion_body_hash_operator import SyntheticsAssertionBodyHashOperator
from datadog_api_client.v1.model.synthetics_assertion_body_hash_target import SyntheticsAssertionBodyHashTarget
from datadog_api_client.v1.model.synthetics_assertion_body_hash_type import SyntheticsAssertionBodyHashType
from datadog_api_client.v1.model.synthetics_assertion_json_path_operator import SyntheticsAssertionJSONPathOperator
from datadog_api_client.v1.model.synthetics_assertion_json_path_target import SyntheticsAssertionJSONPathTarget
from datadog_api_client.v1.model.synthetics_assertion_json_path_target_target import (
    SyntheticsAssertionJSONPathTargetTarget,
)
from datadog_api_client.v1.model.synthetics_assertion_json_schema_meta_schema import (
    SyntheticsAssertionJSONSchemaMetaSchema,
)
from datadog_api_client.v1.model.synthetics_assertion_json_schema_operator import SyntheticsAssertionJSONSchemaOperator
from datadog_api_client.v1.model.synthetics_assertion_json_schema_target import SyntheticsAssertionJSONSchemaTarget
from datadog_api_client.v1.model.synthetics_assertion_json_schema_target_target import (
    SyntheticsAssertionJSONSchemaTargetTarget,
)
from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator
from datadog_api_client.v1.model.synthetics_assertion_target import SyntheticsAssertionTarget
from datadog_api_client.v1.model.synthetics_assertion_timings_scope import SyntheticsAssertionTimingsScope
from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType
from datadog_api_client.v1.model.synthetics_assertion_x_path_operator import SyntheticsAssertionXPathOperator
from datadog_api_client.v1.model.synthetics_assertion_x_path_target import SyntheticsAssertionXPathTarget
from datadog_api_client.v1.model.synthetics_assertion_x_path_target_target import SyntheticsAssertionXPathTargetTarget
from datadog_api_client.v1.model.synthetics_basic_auth_oauth_client import SyntheticsBasicAuthOauthClient
from datadog_api_client.v1.model.synthetics_basic_auth_oauth_client_type import SyntheticsBasicAuthOauthClientType
from datadog_api_client.v1.model.synthetics_basic_auth_oauth_token_api_authentication import (
    SyntheticsBasicAuthOauthTokenApiAuthentication,
)
from datadog_api_client.v1.model.synthetics_config_variable import SyntheticsConfigVariable
from datadog_api_client.v1.model.synthetics_config_variable_type import SyntheticsConfigVariableType
from datadog_api_client.v1.model.synthetics_test_details_sub_type import SyntheticsTestDetailsSubType
from datadog_api_client.v1.model.synthetics_test_headers import SyntheticsTestHeaders
from datadog_api_client.v1.model.synthetics_test_options import SyntheticsTestOptions
from datadog_api_client.v1.model.synthetics_test_options_http_version import SyntheticsTestOptionsHTTPVersion
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry
from datadog_api_client.v1.model.synthetics_test_request import SyntheticsTestRequest
from datadog_api_client.v1.model.synthetics_test_request_certificate import SyntheticsTestRequestCertificate
from datadog_api_client.v1.model.synthetics_test_request_certificate_item import SyntheticsTestRequestCertificateItem
from datadog_api_client.v1.model.synthetics_test_request_proxy import SyntheticsTestRequestProxy

body = SyntheticsAPITest(
    config=SyntheticsAPITestConfig(
        assertions=[
            SyntheticsAssertionTarget(
                operator=SyntheticsAssertionOperator.IS,
                _property="{{ PROPERTY }}",
                target="text/html",
                type=SyntheticsAssertionType.HEADER,
            ),
            SyntheticsAssertionTarget(
                operator=SyntheticsAssertionOperator.LESS_THAN,
                target=2000,
                type=SyntheticsAssertionType.RESPONSE_TIME,
                timings_scope=SyntheticsAssertionTimingsScope.WITHOUT_DNS,
            ),
            SyntheticsAssertionJSONPathTarget(
                operator=SyntheticsAssertionJSONPathOperator.VALIDATES_JSON_PATH,
                target=SyntheticsAssertionJSONPathTargetTarget(
                    json_path="topKey",
                    operator="isNot",
                    target_value="0",
                ),
                type=SyntheticsAssertionType.BODY,
            ),
            SyntheticsAssertionJSONPathTarget(
                operator=SyntheticsAssertionJSONPathOperator.VALIDATES_JSON_PATH,
                target=SyntheticsAssertionJSONPathTargetTarget(
                    elements_operator="atLeastOneElementMatches",
                    json_path="topKey",
                    operator="isNot",
                    target_value="0",
                ),
                type=SyntheticsAssertionType.BODY,
            ),
            SyntheticsAssertionJSONSchemaTarget(
                operator=SyntheticsAssertionJSONSchemaOperator.VALIDATES_JSON_SCHEMA,
                target=SyntheticsAssertionJSONSchemaTargetTarget(
                    meta_schema=SyntheticsAssertionJSONSchemaMetaSchema.DRAFT_07,
                    json_schema='{"type": "object", "properties":{"slideshow":{"type":"object"}}}',
                ),
                type=SyntheticsAssertionType.BODY,
            ),
            SyntheticsAssertionXPathTarget(
                operator=SyntheticsAssertionXPathOperator.VALIDATES_X_PATH,
                target=SyntheticsAssertionXPathTargetTarget(
                    x_path="target-xpath",
                    target_value="0",
                    operator="contains",
                ),
                type=SyntheticsAssertionType.BODY,
            ),
            SyntheticsAssertionBodyHashTarget(
                operator=SyntheticsAssertionBodyHashOperator.MD5,
                target="a",
                type=SyntheticsAssertionBodyHashType.BODY_HASH,
            ),
        ],
        config_variables=[
            SyntheticsConfigVariable(
                example="content-type",
                name="PROPERTY",
                pattern="content-type",
                type=SyntheticsConfigVariableType.TEXT,
            ),
        ],
        variables_from_script='dd.variable.set("FOO", "foo")',
        request=SyntheticsTestRequest(
            certificate=SyntheticsTestRequestCertificate(
                cert=SyntheticsTestRequestCertificateItem(
                    content="cert-content",
                    filename="cert-filename",
                    updated_at="2020-10-16T09:23:24.857Z",
                ),
                key=SyntheticsTestRequestCertificateItem(
                    content="key-content",
                    filename="key-filename",
                    updated_at="2020-10-16T09:23:24.857Z",
                ),
            ),
            headers=SyntheticsTestHeaders(
                unique="examplesynthetic",
            ),
            method="GET",
            timeout=10.0,
            url="https://datadoghq.com",
            proxy=SyntheticsTestRequestProxy(
                url="https://datadoghq.com",
                headers=SyntheticsTestHeaders(),
            ),
            basic_auth=SyntheticsBasicAuthOauthClient(
                access_token_url="https://datadog-token.com",
                audience="audience",
                client_id="client-id",
                client_secret="client-secret",
                resource="resource",
                scope="yoyo",
                token_api_authentication=SyntheticsBasicAuthOauthTokenApiAuthentication.HEADER,
                type=SyntheticsBasicAuthOauthClientType.OAUTH_CLIENT,
            ),
            persist_cookies=True,
        ),
    ),
    locations=[
        "aws:us-east-2",
    ],
    message="BDD test payload: synthetics_api_http_test_payload.json",
    name="Example-Synthetic",
    options=SyntheticsTestOptions(
        accept_self_signed=False,
        allow_insecure=True,
        follow_redirects=True,
        min_failure_duration=10,
        min_location_failed=1,
        monitor_name="Example-Synthetic",
        monitor_priority=5,
        retry=SyntheticsTestOptionsRetry(
            count=3,
            interval=10.0,
        ),
        tick_every=60,
        http_version=SyntheticsTestOptionsHTTPVersion.HTTP2,
    ),
    subtype=SyntheticsTestDetailsSubType.HTTP,
    tags=[
        "testing:api",
    ],
    type=SyntheticsAPITestType.API,
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.create_synthetics_api_test(body=body)

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Create an API GRPC test returns "OK - Returns the created test details." response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new

body = DatadogAPIClient::V1::SyntheticsAPITest.new({
  config: DatadogAPIClient::V1::SyntheticsAPITestConfig.new({
    assertions: [
      DatadogAPIClient::V1::SyntheticsAssertionTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionOperator::IS,
        target: 1,
        type: DatadogAPIClient::V1::SyntheticsAssertionType::GRPC_HEALTHCHECK_STATUS,
      }),
      DatadogAPIClient::V1::SyntheticsAssertionTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionOperator::IS,
        target: "proto target",
        type: DatadogAPIClient::V1::SyntheticsAssertionType::GRPC_PROTO,
      }),
      DatadogAPIClient::V1::SyntheticsAssertionTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionOperator::IS,
        target: "123",
        property: "property",
        type: DatadogAPIClient::V1::SyntheticsAssertionType::GRPC_METADATA,
      }),
    ],
    request: DatadogAPIClient::V1::SyntheticsTestRequest.new({
      host: "localhost",
      port: 50051,
      service: "Hello",
      method: "GET",
      message: "",
      metadata: {},
    }),
  }),
  locations: [
    "aws:us-east-2",
  ],
  message: "BDD test payload: synthetics_api_grpc_test_payload.json",
  name: "Example-Synthetic",
  options: DatadogAPIClient::V1::SyntheticsTestOptions.new({
    min_failure_duration: 0,
    min_location_failed: 1,
    monitor_options: DatadogAPIClient::V1::SyntheticsTestOptionsMonitorOptions.new({
      renotify_interval: 0,
    }),
    monitor_name: "Example-Synthetic",
    tick_every: 60,
  }),
  subtype: DatadogAPIClient::V1::SyntheticsTestDetailsSubType::GRPC,
  tags: [
    "testing:api",
  ],
  type: DatadogAPIClient::V1::SyntheticsAPITestType::API,
})
p api_instance.create_synthetics_api_test(body)
# Create an API HTTP test has bodyHash filled out

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new

body = DatadogAPIClient::V1::SyntheticsAPITest.new({
  config: DatadogAPIClient::V1::SyntheticsAPITestConfig.new({
    assertions: [
      DatadogAPIClient::V1::SyntheticsAssertionTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionOperator::IS,
        property: "{{ PROPERTY }}",
        target: "text/html",
        type: DatadogAPIClient::V1::SyntheticsAssertionType::HEADER,
      }),
      DatadogAPIClient::V1::SyntheticsAssertionTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionOperator::LESS_THAN,
        target: 2000,
        type: DatadogAPIClient::V1::SyntheticsAssertionType::RESPONSE_TIME,
        timings_scope: DatadogAPIClient::V1::SyntheticsAssertionTimingsScope::WITHOUT_DNS,
      }),
      DatadogAPIClient::V1::SyntheticsAssertionJSONPathTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionJSONPathOperator::VALIDATES_JSON_PATH,
        target: DatadogAPIClient::V1::SyntheticsAssertionJSONPathTargetTarget.new({
          json_path: "topKey",
          operator: "isNot",
          target_value: "0",
        }),
        type: DatadogAPIClient::V1::SyntheticsAssertionType::BODY,
      }),
      DatadogAPIClient::V1::SyntheticsAssertionJSONPathTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionJSONPathOperator::VALIDATES_JSON_PATH,
        target: DatadogAPIClient::V1::SyntheticsAssertionJSONPathTargetTarget.new({
          elements_operator: "atLeastOneElementMatches",
          json_path: "topKey",
          operator: "isNot",
          target_value: "0",
        }),
        type: DatadogAPIClient::V1::SyntheticsAssertionType::BODY,
      }),
      DatadogAPIClient::V1::SyntheticsAssertionJSONSchemaTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionJSONSchemaOperator::VALIDATES_JSON_SCHEMA,
        target: DatadogAPIClient::V1::SyntheticsAssertionJSONSchemaTargetTarget.new({
          meta_schema: DatadogAPIClient::V1::SyntheticsAssertionJSONSchemaMetaSchema::DRAFT_07,
          json_schema: '{"type": "object", "properties":{"slideshow":{"type":"object"}}}',
        }),
        type: DatadogAPIClient::V1::SyntheticsAssertionType::BODY,
      }),
      DatadogAPIClient::V1::SyntheticsAssertionXPathTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionXPathOperator::VALIDATES_X_PATH,
        target: DatadogAPIClient::V1::SyntheticsAssertionXPathTargetTarget.new({
          x_path: "target-xpath",
          target_value: "0",
          operator: "contains",
        }),
        type: DatadogAPIClient::V1::SyntheticsAssertionType::BODY,
      }),
      DatadogAPIClient::V1::SyntheticsAssertionBodyHashTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionBodyHashOperator::MD5,
        target: "a",
        type: DatadogAPIClient::V1::SyntheticsAssertionBodyHashType::BODY_HASH,
      }),
    ],
    config_variables: [
      DatadogAPIClient::V1::SyntheticsConfigVariable.new({
        example: "content-type",
        name: "PROPERTY",
        pattern: "content-type",
        type: DatadogAPIClient::V1::SyntheticsConfigVariableType::TEXT,
      }),
    ],
    variables_from_script: 'dd.variable.set("FOO", "foo")',
    request: DatadogAPIClient::V1::SyntheticsTestRequest.new({
      certificate: DatadogAPIClient::V1::SyntheticsTestRequestCertificate.new({
        cert: DatadogAPIClient::V1::SyntheticsTestRequestCertificateItem.new({
          content: "cert-content",
          filename: "cert-filename",
          updated_at: "2020-10-16T09:23:24.857Z",
        }),
        key: DatadogAPIClient::V1::SyntheticsTestRequestCertificateItem.new({
          content: "key-content",
          filename: "key-filename",
          updated_at: "2020-10-16T09:23:24.857Z",
        }),
      }),
      headers: {
        unique: "examplesynthetic",
      },
      method: "GET",
      timeout: 10,
      url: "https://datadoghq.com",
      proxy: DatadogAPIClient::V1::SyntheticsTestRequestProxy.new({
        url: "https://datadoghq.com",
        headers: {},
      }),
      basic_auth: DatadogAPIClient::V1::SyntheticsBasicAuthOauthClient.new({
        access_token_url: "https://datadog-token.com",
        audience: "audience",
        client_id: "client-id",
        client_secret: "client-secret",
        resource: "resource",
        scope: "yoyo",
        token_api_authentication: DatadogAPIClient::V1::SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER,
        type: DatadogAPIClient::V1::SyntheticsBasicAuthOauthClientType::OAUTH_CLIENT,
      }),
      persist_cookies: true,
    }),
  }),
  locations: [
    "aws:us-east-2",
  ],
  message: "BDD test payload: synthetics_api_http_test_payload.json",
  name: "Example-Synthetic",
  options: DatadogAPIClient::V1::SyntheticsTestOptions.new({
    accept_self_signed: false,
    allow_insecure: true,
    follow_redirects: true,
    min_failure_duration: 10,
    min_location_failed: 1,
    monitor_name: "Example-Synthetic",
    monitor_priority: 5,
    _retry: DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({
      count: 3,
      interval: 10,
    }),
    tick_every: 60,
    http_version: DatadogAPIClient::V1::SyntheticsTestOptionsHTTPVersion::HTTP2,
  }),
  subtype: DatadogAPIClient::V1::SyntheticsTestDetailsSubType::HTTP,
  tags: [
    "testing:api",
  ],
  type: DatadogAPIClient::V1::SyntheticsAPITestType::API,
})
p api_instance.create_synthetics_api_test(body)
# Create an API HTTP test returns "OK - Returns the created test details." response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new

body = DatadogAPIClient::V1::SyntheticsAPITest.new({
  config: DatadogAPIClient::V1::SyntheticsAPITestConfig.new({
    assertions: [
      DatadogAPIClient::V1::SyntheticsAssertionTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionOperator::IS,
        property: "{{ PROPERTY }}",
        target: "text/html",
        type: DatadogAPIClient::V1::SyntheticsAssertionType::HEADER,
      }),
      DatadogAPIClient::V1::SyntheticsAssertionTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionOperator::LESS_THAN,
        target: 2000,
        type: DatadogAPIClient::V1::SyntheticsAssertionType::RESPONSE_TIME,
        timings_scope: DatadogAPIClient::V1::SyntheticsAssertionTimingsScope::WITHOUT_DNS,
      }),
      DatadogAPIClient::V1::SyntheticsAssertionJSONPathTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionJSONPathOperator::VALIDATES_JSON_PATH,
        target: DatadogAPIClient::V1::SyntheticsAssertionJSONPathTargetTarget.new({
          json_path: "topKey",
          operator: "isNot",
          target_value: "0",
        }),
        type: DatadogAPIClient::V1::SyntheticsAssertionType::BODY,
      }),
      DatadogAPIClient::V1::SyntheticsAssertionJSONPathTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionJSONPathOperator::VALIDATES_JSON_PATH,
        target: DatadogAPIClient::V1::SyntheticsAssertionJSONPathTargetTarget.new({
          elements_operator: "atLeastOneElementMatches",
          json_path: "topKey",
          operator: "isNot",
          target_value: "0",
        }),
        type: DatadogAPIClient::V1::SyntheticsAssertionType::BODY,
      }),
      DatadogAPIClient::V1::SyntheticsAssertionJSONSchemaTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionJSONSchemaOperator::VALIDATES_JSON_SCHEMA,
        target: DatadogAPIClient::V1::SyntheticsAssertionJSONSchemaTargetTarget.new({
          meta_schema: DatadogAPIClient::V1::SyntheticsAssertionJSONSchemaMetaSchema::DRAFT_07,
          json_schema: '{"type": "object", "properties":{"slideshow":{"type":"object"}}}',
        }),
        type: DatadogAPIClient::V1::SyntheticsAssertionType::BODY,
      }),
      DatadogAPIClient::V1::SyntheticsAssertionXPathTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionXPathOperator::VALIDATES_X_PATH,
        target: DatadogAPIClient::V1::SyntheticsAssertionXPathTargetTarget.new({
          x_path: "target-xpath",
          target_value: "0",
          operator: "contains",
        }),
        type: DatadogAPIClient::V1::SyntheticsAssertionType::BODY,
      }),
      DatadogAPIClient::V1::SyntheticsAssertionBodyHashTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionBodyHashOperator::MD5,
        target: "a",
        type: DatadogAPIClient::V1::SyntheticsAssertionBodyHashType::BODY_HASH,
      }),
    ],
    config_variables: [
      DatadogAPIClient::V1::SyntheticsConfigVariable.new({
        example: "content-type",
        name: "PROPERTY",
        pattern: "content-type",
        type: DatadogAPIClient::V1::SyntheticsConfigVariableType::TEXT,
      }),
    ],
    variables_from_script: 'dd.variable.set("FOO", "foo")',
    request: DatadogAPIClient::V1::SyntheticsTestRequest.new({
      certificate: DatadogAPIClient::V1::SyntheticsTestRequestCertificate.new({
        cert: DatadogAPIClient::V1::SyntheticsTestRequestCertificateItem.new({
          content: "cert-content",
          filename: "cert-filename",
          updated_at: "2020-10-16T09:23:24.857Z",
        }),
        key: DatadogAPIClient::V1::SyntheticsTestRequestCertificateItem.new({
          content: "key-content",
          filename: "key-filename",
          updated_at: "2020-10-16T09:23:24.857Z",
        }),
      }),
      headers: {
        unique: "examplesynthetic",
      },
      method: "GET",
      timeout: 10,
      url: "https://datadoghq.com",
      proxy: DatadogAPIClient::V1::SyntheticsTestRequestProxy.new({
        url: "https://datadoghq.com",
        headers: {},
      }),
      basic_auth: DatadogAPIClient::V1::SyntheticsBasicAuthOauthClient.new({
        access_token_url: "https://datadog-token.com",
        audience: "audience",
        client_id: "client-id",
        client_secret: "client-secret",
        resource: "resource",
        scope: "yoyo",
        token_api_authentication: DatadogAPIClient::V1::SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER,
        type: DatadogAPIClient::V1::SyntheticsBasicAuthOauthClientType::OAUTH_CLIENT,
      }),
      persist_cookies: true,
    }),
  }),
  locations: [
    "aws:us-east-2",
  ],
  message: "BDD test payload: synthetics_api_http_test_payload.json",
  name: "Example-Synthetic",
  options: DatadogAPIClient::V1::SyntheticsTestOptions.new({
    accept_self_signed: false,
    allow_insecure: true,
    follow_redirects: true,
    min_failure_duration: 10,
    min_location_failed: 1,
    monitor_name: "Example-Synthetic",
    monitor_priority: 5,
    _retry: DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({
      count: 3,
      interval: 10,
    }),
    tick_every: 60,
    http_version: DatadogAPIClient::V1::SyntheticsTestOptionsHTTPVersion::HTTP2,
  }),
  subtype: DatadogAPIClient::V1::SyntheticsTestDetailsSubType::HTTP,
  tags: [
    "testing:api",
  ],
  type: DatadogAPIClient::V1::SyntheticsAPITestType::API,
})
p api_instance.create_synthetics_api_test(body)

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
/**
 * Create an API GRPC test returns "OK - Returns the created test details." response
 */

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

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

const params: v1.SyntheticsApiCreateSyntheticsAPITestRequest = {
  body: {
    config: {
      assertions: [
        {
          operator: "is",
          target: 1,
          type: "grpcHealthcheckStatus",
        },
        {
          operator: "is",
          target: "proto target",
          type: "grpcProto",
        },
        {
          operator: "is",
          target: "123",
          property: "property",
          type: "grpcMetadata",
        },
      ],
      request: {
        host: "localhost",
        port: 50051,
        service: "Hello",
        method: "GET",
        message: "",
        metadata: {},
      },
    },
    locations: ["aws:us-east-2"],
    message: "BDD test payload: synthetics_api_grpc_test_payload.json",
    name: "Example-Synthetic",
    options: {
      minFailureDuration: 0,
      minLocationFailed: 1,
      monitorOptions: {
        renotifyInterval: 0,
      },
      monitorName: "Example-Synthetic",
      tickEvery: 60,
    },
    subtype: "grpc",
    tags: ["testing:api"],
    type: "api",
  },
};

apiInstance
  .createSyntheticsAPITest(params)
  .then((data: v1.SyntheticsAPITest) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
/**
 * Create an API HTTP test has bodyHash filled out
 */

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

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

const params: v1.SyntheticsApiCreateSyntheticsAPITestRequest = {
  body: {
    config: {
      assertions: [
        {
          operator: "is",
          property: "{{ PROPERTY }}",
          target: "text/html",
          type: "header",
        },
        {
          operator: "lessThan",
          target: 2000,
          type: "responseTime",
          timingsScope: "withoutDNS",
        },
        {
          operator: "validatesJSONPath",
          target: {
            jsonPath: "topKey",
            operator: "isNot",
            targetValue: "0",
          },
          type: "body",
        },
        {
          operator: "validatesJSONPath",
          target: {
            elementsOperator: "atLeastOneElementMatches",
            jsonPath: "topKey",
            operator: "isNot",
            targetValue: "0",
          },
          type: "body",
        },
        {
          operator: "validatesJSONSchema",
          target: {
            metaSchema: "draft-07",
            jsonSchema: `{"type": "object", "properties":{"slideshow":{"type":"object"}}}`,
          },
          type: "body",
        },
        {
          operator: "validatesXPath",
          target: {
            xPath: "target-xpath",
            targetValue: "0",
            operator: "contains",
          },
          type: "body",
        },
        {
          operator: "md5",
          target: "a",
          type: "bodyHash",
        },
      ],
      configVariables: [
        {
          example: "content-type",
          name: "PROPERTY",
          pattern: "content-type",
          type: "text",
        },
      ],
      variablesFromScript: `dd.variable.set("FOO", "foo")`,
      request: {
        certificate: {
          cert: {
            content: "cert-content",
            filename: "cert-filename",
            updatedAt: "2020-10-16T09:23:24.857Z",
          },
          key: {
            content: "key-content",
            filename: "key-filename",
            updatedAt: "2020-10-16T09:23:24.857Z",
          },
        },
        headers: {
          unique: "examplesynthetic",
        },
        method: "GET",
        timeout: 10,
        url: "https://datadoghq.com",
        proxy: {
          url: "https://datadoghq.com",
          headers: {},
        },
        basicAuth: {
          accessTokenUrl: "https://datadog-token.com",
          audience: "audience",
          clientId: "client-id",
          clientSecret: "client-secret",
          resource: "resource",
          scope: "yoyo",
          tokenApiAuthentication: "header",
          type: "oauth-client",
        },
        persistCookies: true,
      },
    },
    locations: ["aws:us-east-2"],
    message: "BDD test payload: synthetics_api_http_test_payload.json",
    name: "Example-Synthetic",
    options: {
      acceptSelfSigned: false,
      allowInsecure: true,
      followRedirects: true,
      minFailureDuration: 10,
      minLocationFailed: 1,
      monitorName: "Example-Synthetic",
      monitorPriority: 5,
      retry: {
        count: 3,
        interval: 10,
      },
      tickEvery: 60,
      httpVersion: "http2",
    },
    subtype: "http",
    tags: ["testing:api"],
    type: "api",
  },
};

apiInstance
  .createSyntheticsAPITest(params)
  .then((data: v1.SyntheticsAPITest) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
/**
 * Create an API HTTP test returns "OK - Returns the created test details." response
 */

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

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

const params: v1.SyntheticsApiCreateSyntheticsAPITestRequest = {
  body: {
    config: {
      assertions: [
        {
          operator: "is",
          property: "{{ PROPERTY }}",
          target: "text/html",
          type: "header",
        },
        {
          operator: "lessThan",
          target: 2000,
          type: "responseTime",
          timingsScope: "withoutDNS",
        },
        {
          operator: "validatesJSONPath",
          target: {
            jsonPath: "topKey",
            operator: "isNot",
            targetValue: "0",
          },
          type: "body",
        },
        {
          operator: "validatesJSONPath",
          target: {
            elementsOperator: "atLeastOneElementMatches",
            jsonPath: "topKey",
            operator: "isNot",
            targetValue: "0",
          },
          type: "body",
        },
        {
          operator: "validatesJSONSchema",
          target: {
            metaSchema: "draft-07",
            jsonSchema: `{"type": "object", "properties":{"slideshow":{"type":"object"}}}`,
          },
          type: "body",
        },
        {
          operator: "validatesXPath",
          target: {
            xPath: "target-xpath",
            targetValue: "0",
            operator: "contains",
          },
          type: "body",
        },
        {
          operator: "md5",
          target: "a",
          type: "bodyHash",
        },
      ],
      configVariables: [
        {
          example: "content-type",
          name: "PROPERTY",
          pattern: "content-type",
          type: "text",
        },
      ],
      variablesFromScript: `dd.variable.set("FOO", "foo")`,
      request: {
        certificate: {
          cert: {
            content: "cert-content",
            filename: "cert-filename",
            updatedAt: "2020-10-16T09:23:24.857Z",
          },
          key: {
            content: "key-content",
            filename: "key-filename",
            updatedAt: "2020-10-16T09:23:24.857Z",
          },
        },
        headers: {
          unique: "examplesynthetic",
        },
        method: "GET",
        timeout: 10,
        url: "https://datadoghq.com",
        proxy: {
          url: "https://datadoghq.com",
          headers: {},
        },
        basicAuth: {
          accessTokenUrl: "https://datadog-token.com",
          audience: "audience",
          clientId: "client-id",
          clientSecret: "client-secret",
          resource: "resource",
          scope: "yoyo",
          tokenApiAuthentication: "header",
          type: "oauth-client",
        },
        persistCookies: true,
      },
    },
    locations: ["aws:us-east-2"],
    message: "BDD test payload: synthetics_api_http_test_payload.json",
    name: "Example-Synthetic",
    options: {
      acceptSelfSigned: false,
      allowInsecure: true,
      followRedirects: true,
      minFailureDuration: 10,
      minLocationFailed: 1,
      monitorName: "Example-Synthetic",
      monitorPriority: 5,
      retry: {
        count: 3,
        interval: 10,
      },
      tickEvery: 60,
      httpVersion: "http2",
    },
    subtype: "http",
    tags: ["testing:api"],
    type: "api",
  },
};

apiInstance
  .createSyntheticsAPITest(params)
  .then((data: v1.SyntheticsAPITest) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v1/synthetics/tests/browserhttps://api.datadoghq.eu/api/v1/synthetics/tests/browserhttps://api.ddog-gov.com/api/v1/synthetics/tests/browserhttps://api.datadoghq.com/api/v1/synthetics/tests/browserhttps://api.us3.datadoghq.com/api/v1/synthetics/tests/browserhttps://api.us5.datadoghq.com/api/v1/synthetics/tests/browser

概要

Synthetic ブラウザテストを作成します。 This endpoint requires the synthetics_write authorization scope.

リクエスト

Body Data (required)

作成するテストの詳細。

Expand All

フィールド

種類

説明

config [required]

object

Configuration object for a Synthetic browser test.

assertions [required]

[ <oneOf>]

Array of assertions used for the test.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

configVariables

[object]

Array of variables used for the test.

example

string

Example for the variable.

id

string

ID of the variable for global variables.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Whether the value of this variable will be obfuscated in test results. Only for config variables of type text.

type [required]

enum

Type of the configuration variable. Allowed enum values: global,text

request [required]

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

setCookie

string

Cookies to be used for the request, using the Set-Cookie syntax.

variables

[object]

Array of variables used for the test steps.

example

string

Example for the variable.

id

string

ID for the variable. Global variables require an ID.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Determines whether or not the browser test variable is obfuscated. Can only be used with browser variables of type text.

type [required]

enum

Type of browser test variable. Allowed enum values: element,email,global,javascript,text

locations [required]

[string]

Array of locations used to run the test.

message [required]

string

Notification message associated with the test. Message can either be text or an empty string.

monitor_id

int64

The associated monitor ID.

name [required]

string

Name of the test.

options [required]

object

Object describing the extra options for a Synthetic test.

accept_self_signed

boolean

For SSL test, whether or not the test should allow self signed certificates.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in an API test.

checkCertificateRevocation

boolean

For SSL test, whether or not the test should fail on revoked certificate in stapled OCSP.

ci

object

CI/CD options for a Synthetic test.

executionRule

enum

Execution rule for a Synthetic test. Allowed enum values: blocking,non_blocking,skipped

device_ids

[string]

For browser test, array with the different device IDs used to run the test.

disableCors

boolean

Whether or not to disable CORS mechanism.

disableCsp

boolean

Disable Content Security Policy for browser tests.

enableProfiling

boolean

Enable profiling for browser tests.

enableSecurityTesting

boolean

DEPRECATED: Enable security testing for browser tests. Security testing is not available anymore. This field is deprecated and won't be used.

follow_redirects

boolean

For API HTTP test, whether or not the test should follow redirects.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

ignoreServerCertificateError

boolean

Ignore server certificate error for browser tests.

initialNavigationTimeout

int64

Timeout before declaring the initial step as failed (in seconds) for browser tests.

min_failure_duration

int64

Minimum amount of time in failure required to trigger an alert.

min_location_failed

int64

Minimum number of locations in failure required to trigger an alert.

monitor_name

string

The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.

monitor_options

object

Object containing the options for a Synthetic test as a monitor (for example, renotification).

renotify_interval

int64

Time interval before renotifying if the test is still failing (in minutes).

monitor_priority

int32

Integer from 1 (high) to 5 (low) indicating alert severity.

noScreenshot

boolean

Prevents saving screenshots of the steps.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

rumSettings

object

The RUM data collection settings for the Synthetic browser test. Note: There are 3 ways to format RUM settings:

{ isEnabled: false } RUM data is not collected.

{ isEnabled: true } RUM data is collected from the Synthetic test's default application.

{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 } RUM data is collected using the specified application.

applicationId

string

RUM application ID used to collect RUM data for the browser test.

clientTokenId

int64

RUM application API key ID used to collect RUM data for the browser test.

isEnabled [required]

boolean

Determines whether RUM data is collected during test runs.

scheduling

object

Object containing timeframes and timezone used for advanced scheduling.

timeframes

[object]

Array containing objects describing the scheduling pattern to apply to each day.

day

int32

Number representing the day of the week.

from

string

The hour of the day on which scheduling starts.

to

string

The hour of the day on which scheduling ends.

timezone

string

Timezone in which the timeframe is based.

tick_every

int64

The frequency at which to run the Synthetic test (in seconds).

public_id

string

The public ID of the test.

status

enum

Define whether you want to start (live) or pause (paused) a Synthetic test. Allowed enum values: live,paused

steps

[object]

Array of steps for the test.

allowFailure

boolean

A boolean set to allow this step to fail.

isCritical

boolean

A boolean to use in addition to allowFailure to determine if the test should be marked as failed when the step fails.

name

string

The name of the step.

noScreenshot

boolean

A boolean set to not take a screenshot for the step.

params

object

The parameters of the step.

timeout

int64

The time before declaring a step failed.

type

enum

Step type used in your Synthetic test. Allowed enum values: assertCurrentUrl,assertElementAttribute,assertElementContent,assertElementPresent,assertEmail,assertFileDownload,assertFromJavascript,assertPageContains,assertPageLacks,click,extractFromJavascript,extractVariable,goToEmailLink,goToUrl,goToUrlAndMeasureTti,hover,playSubTest,pressKey,refresh,runApiTest,scroll,selectOption,typeText,uploadFiles,wait

tags

[string]

Array of tags attached to the test.

type [required]

enum

Type of the Synthetic test, browser. Allowed enum values: browser

default: browser

{
  "config": {
    "assertions": [],
    "configVariables": [
      {
        "example": "content-type",
        "name": "PROPERTY",
        "pattern": "content-type",
        "type": "text"
      }
    ],
    "request": {
      "method": "GET",
      "url": "https://datadoghq.com",
      "certificateDomains": [
        "https://datadoghq.com"
      ]
    },
    "setCookie": "name:test"
  },
  "locations": [
    "aws:us-east-2"
  ],
  "message": "Test message",
  "name": "Example-Synthetic",
  "options": {
    "accept_self_signed": false,
    "allow_insecure": true,
    "device_ids": [
      "tablet"
    ],
    "disableCors": true,
    "follow_redirects": true,
    "min_failure_duration": 10,
    "min_location_failed": 1,
    "noScreenshot": true,
    "retry": {
      "count": 2,
      "interval": 10
    },
    "rumSettings": {
      "isEnabled": true,
      "applicationId": "mockApplicationId",
      "clientTokenId": 12345
    },
    "tick_every": 300,
    "ci": {
      "executionRule": "skipped"
    },
    "ignoreServerCertificateError": true,
    "disableCsp": true,
    "initialNavigationTimeout": 200
  },
  "tags": [
    "testing:browser"
  ],
  "type": "browser",
  "steps": [
    {
      "allowFailure": false,
      "isCritical": true,
      "name": "Refresh page",
      "params": {},
      "type": "refresh"
    }
  ]
}
{
  "config": {
    "assertions": [],
    "variables": [
      {
        "type": "text",
        "name": "TEST_VARIABLE",
        "pattern": "secret",
        "secure": true,
        "example": "secret"
      }
    ],
    "configVariables": [
      {
        "example": "content-type",
        "name": "PROPERTY",
        "pattern": "content-type",
        "type": "text",
        "secure": true
      }
    ],
    "request": {
      "method": "GET",
      "url": "https://datadoghq.com"
    },
    "setCookie": "name:test"
  },
  "locations": [
    "aws:us-east-2"
  ],
  "message": "Test message",
  "name": "Example-Synthetic",
  "options": {
    "accept_self_signed": false,
    "allow_insecure": true,
    "device_ids": [
      "chrome.laptop_large"
    ],
    "disableCors": true,
    "follow_redirects": true,
    "min_failure_duration": 10,
    "min_location_failed": 1,
    "noScreenshot": true,
    "retry": {
      "count": 2,
      "interval": 10
    },
    "tick_every": 300,
    "enableProfiling": true,
    "enableSecurityTesting": true
  },
  "tags": [
    "testing:browser"
  ],
  "type": "browser",
  "steps": [
    {
      "allowFailure": false,
      "isCritical": true,
      "name": "Refresh page",
      "params": {},
      "type": "refresh"
    }
  ]
}
{
  "config": {
    "assertions": [],
    "configVariables": [
      {
        "example": "content-type",
        "name": "PROPERTY",
        "pattern": "content-type",
        "type": "text"
      }
    ],
    "request": {
      "method": "GET",
      "url": "https://datadoghq.com"
    },
    "setCookie": "name:test"
  },
  "locations": [
    "aws:us-east-2"
  ],
  "message": "Test message",
  "name": "Example-Synthetic",
  "options": {
    "accept_self_signed": false,
    "allow_insecure": true,
    "device_ids": [
      "tablet"
    ],
    "disableCors": true,
    "follow_redirects": true,
    "min_failure_duration": 10,
    "min_location_failed": 1,
    "noScreenshot": true,
    "retry": {
      "count": 2,
      "interval": 10
    },
    "tick_every": 300,
    "scheduling": {
      "timeframes": [
        {
          "day": 1,
          "from": "07:00",
          "to": "16:00"
        },
        {
          "day": 3,
          "from": "07:00",
          "to": "16:00"
        }
      ],
      "timezone": "America/New_York"
    }
  },
  "tags": [
    "testing:browser"
  ],
  "type": "browser",
  "steps": [
    {
      "allowFailure": false,
      "isCritical": true,
      "name": "Refresh page",
      "params": {},
      "type": "refresh"
    }
  ]
}

応答

OK - Returns the created test details.

Object containing details about a Synthetic browser test.

Expand All

フィールド

種類

説明

config [required]

object

Configuration object for a Synthetic browser test.

assertions [required]

[ <oneOf>]

Array of assertions used for the test.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

configVariables

[object]

Array of variables used for the test.

example

string

Example for the variable.

id

string

ID of the variable for global variables.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Whether the value of this variable will be obfuscated in test results. Only for config variables of type text.

type [required]

enum

Type of the configuration variable. Allowed enum values: global,text

request [required]

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

setCookie

string

Cookies to be used for the request, using the Set-Cookie syntax.

variables

[object]

Array of variables used for the test steps.

example

string

Example for the variable.

id

string

ID for the variable. Global variables require an ID.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Determines whether or not the browser test variable is obfuscated. Can only be used with browser variables of type text.

type [required]

enum

Type of browser test variable. Allowed enum values: element,email,global,javascript,text

locations [required]

[string]

Array of locations used to run the test.

message [required]

string

Notification message associated with the test. Message can either be text or an empty string.

monitor_id

int64

The associated monitor ID.

name [required]

string

Name of the test.

options [required]

object

Object describing the extra options for a Synthetic test.

accept_self_signed

boolean

For SSL test, whether or not the test should allow self signed certificates.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in an API test.

checkCertificateRevocation

boolean

For SSL test, whether or not the test should fail on revoked certificate in stapled OCSP.

ci

object

CI/CD options for a Synthetic test.

executionRule

enum

Execution rule for a Synthetic test. Allowed enum values: blocking,non_blocking,skipped

device_ids

[string]

For browser test, array with the different device IDs used to run the test.

disableCors

boolean

Whether or not to disable CORS mechanism.

disableCsp

boolean

Disable Content Security Policy for browser tests.

enableProfiling

boolean

Enable profiling for browser tests.

enableSecurityTesting

boolean

DEPRECATED: Enable security testing for browser tests. Security testing is not available anymore. This field is deprecated and won't be used.

follow_redirects

boolean

For API HTTP test, whether or not the test should follow redirects.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

ignoreServerCertificateError

boolean

Ignore server certificate error for browser tests.

initialNavigationTimeout

int64

Timeout before declaring the initial step as failed (in seconds) for browser tests.

min_failure_duration

int64

Minimum amount of time in failure required to trigger an alert.

min_location_failed

int64

Minimum number of locations in failure required to trigger an alert.

monitor_name

string

The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.

monitor_options

object

Object containing the options for a Synthetic test as a monitor (for example, renotification).

renotify_interval

int64

Time interval before renotifying if the test is still failing (in minutes).

monitor_priority

int32

Integer from 1 (high) to 5 (low) indicating alert severity.

noScreenshot

boolean

Prevents saving screenshots of the steps.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

rumSettings

object

The RUM data collection settings for the Synthetic browser test. Note: There are 3 ways to format RUM settings:

{ isEnabled: false } RUM data is not collected.

{ isEnabled: true } RUM data is collected from the Synthetic test's default application.

{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 } RUM data is collected using the specified application.

applicationId

string

RUM application ID used to collect RUM data for the browser test.

clientTokenId

int64

RUM application API key ID used to collect RUM data for the browser test.

isEnabled [required]

boolean

Determines whether RUM data is collected during test runs.

scheduling

object

Object containing timeframes and timezone used for advanced scheduling.

timeframes

[object]

Array containing objects describing the scheduling pattern to apply to each day.

day

int32

Number representing the day of the week.

from

string

The hour of the day on which scheduling starts.

to

string

The hour of the day on which scheduling ends.

timezone

string

Timezone in which the timeframe is based.

tick_every

int64

The frequency at which to run the Synthetic test (in seconds).

public_id

string

The public ID of the test.

status

enum

Define whether you want to start (live) or pause (paused) a Synthetic test. Allowed enum values: live,paused

steps

[object]

Array of steps for the test.

allowFailure

boolean

A boolean set to allow this step to fail.

isCritical

boolean

A boolean to use in addition to allowFailure to determine if the test should be marked as failed when the step fails.

name

string

The name of the step.

noScreenshot

boolean

A boolean set to not take a screenshot for the step.

params

object

The parameters of the step.

timeout

int64

The time before declaring a step failed.

type

enum

Step type used in your Synthetic test. Allowed enum values: assertCurrentUrl,assertElementAttribute,assertElementContent,assertElementPresent,assertEmail,assertFileDownload,assertFromJavascript,assertPageContains,assertPageLacks,click,extractFromJavascript,extractVariable,goToEmailLink,goToUrl,goToUrlAndMeasureTti,hover,playSubTest,pressKey,refresh,runApiTest,scroll,selectOption,typeText,uploadFiles,wait

tags

[string]

Array of tags attached to the test.

type [required]

enum

Type of the Synthetic test, browser. Allowed enum values: browser

default: browser

{
  "config": {
    "assertions": [
      {
        "operator": "contains",
        "property": "string",
        "target": 123456,
        "timingsScope": "string",
        "type": "statusCode"
      }
    ],
    "configVariables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ],
    "request": {
      "allow_insecure": false,
      "basicAuth": {
        "password": "PaSSw0RD!",
        "type": "web",
        "username": "my_username"
      },
      "body": "string",
      "bodyType": "text/plain",
      "callType": "unary",
      "certificate": {
        "cert": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        },
        "key": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        }
      },
      "certificateDomains": [],
      "compressedJsonDescriptor": "string",
      "compressedProtoFile": "string",
      "dnsServer": "string",
      "dnsServerPort": "integer",
      "files": [
        {
          "bucketKey": "string",
          "content": "string",
          "name": "string",
          "originalFileName": "string",
          "size": "integer",
          "type": "string"
        }
      ],
      "follow_redirects": false,
      "headers": {
        "<any-key>": "string"
      },
      "host": "string",
      "httpVersion": "string",
      "message": "string",
      "metadata": {
        "<any-key>": "string"
      },
      "method": "string",
      "noSavingResponseBody": false,
      "numberOfPackets": "integer",
      "persistCookies": false,
      "port": "integer",
      "proxy": {
        "headers": {
          "<any-key>": "string"
        },
        "url": "https://example.com"
      },
      "query": {},
      "servername": "string",
      "service": "Greeter",
      "shouldTrackHops": false,
      "timeout": "number",
      "url": "https://example.com"
    },
    "setCookie": "string",
    "variables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ]
  },
  "locations": [
    "aws:eu-west-3"
  ],
  "message": "",
  "monitor_id": "integer",
  "name": "Example test name",
  "options": {
    "accept_self_signed": false,
    "allow_insecure": false,
    "checkCertificateRevocation": false,
    "ci": {
      "executionRule": "string"
    },
    "device_ids": [
      "chrome.laptop_large"
    ],
    "disableCors": false,
    "disableCsp": false,
    "enableProfiling": false,
    "enableSecurityTesting": false,
    "follow_redirects": false,
    "httpVersion": "string",
    "ignoreServerCertificateError": false,
    "initialNavigationTimeout": "integer",
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "monitor_name": "string",
    "monitor_options": {
      "renotify_interval": "integer"
    },
    "monitor_priority": "integer",
    "noScreenshot": false,
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ],
    "retry": {
      "count": "integer",
      "interval": "number"
    },
    "rumSettings": {
      "applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "clientTokenId": 12345,
      "isEnabled": true
    },
    "scheduling": {
      "timeframes": [
        {
          "day": 1,
          "from": "07:00",
          "to": "16:00"
        }
      ],
      "timezone": "America/New_York"
    },
    "tick_every": "integer"
  },
  "public_id": "string",
  "status": "live",
  "steps": [
    {
      "allowFailure": false,
      "isCritical": false,
      "name": "string",
      "noScreenshot": false,
      "params": {},
      "timeout": "integer",
      "type": "assertElementContent"
    }
  ],
  "tags": [
    "env:prod"
  ],
  "type": "browser"
}

- JSON format is wrong - Creation failed

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Test quota is reached

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                          # Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/tests/browser" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "config": { "assertions": [], "configVariables": [ { "example": "content-type", "name": "PROPERTY", "pattern": "content-type", "type": "text" } ], "request": { "method": "GET", "url": "https://datadoghq.com", "certificateDomains": [ "https://datadoghq.com" ] }, "setCookie": "name:test" }, "locations": [ "aws:us-east-2" ], "message": "Test message", "name": "Example-Synthetic", "options": { "accept_self_signed": false, "allow_insecure": true, "device_ids": [ "tablet" ], "disableCors": true, "follow_redirects": true, "min_failure_duration": 10, "min_location_failed": 1, "noScreenshot": true, "retry": { "count": 2, "interval": 10 }, "rumSettings": { "isEnabled": true, "applicationId": "mockApplicationId", "clientTokenId": 12345 }, "tick_every": 300, "ci": { "executionRule": "skipped" }, "ignoreServerCertificateError": true, "disableCsp": true, "initialNavigationTimeout": 200 }, "tags": [ "testing:browser" ], "type": "browser", "steps": [ { "allowFailure": false, "isCritical": true, "name": "Refresh page", "params": {}, "type": "refresh" } ] } EOF
                          # Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/tests/browser" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "config": { "assertions": [], "variables": [ { "type": "text", "name": "TEST_VARIABLE", "pattern": "secret", "secure": true, "example": "secret" } ], "configVariables": [ { "example": "content-type", "name": "PROPERTY", "pattern": "content-type", "type": "text", "secure": true } ], "request": { "method": "GET", "url": "https://datadoghq.com" }, "setCookie": "name:test" }, "locations": [ "aws:us-east-2" ], "message": "Test message", "name": "Example-Synthetic", "options": { "accept_self_signed": false, "allow_insecure": true, "device_ids": [ "chrome.laptop_large" ], "disableCors": true, "follow_redirects": true, "min_failure_duration": 10, "min_location_failed": 1, "noScreenshot": true, "retry": { "count": 2, "interval": 10 }, "tick_every": 300, "enableProfiling": true, "enableSecurityTesting": true }, "tags": [ "testing:browser" ], "type": "browser", "steps": [ { "allowFailure": false, "isCritical": true, "name": "Refresh page", "params": {}, "type": "refresh" } ] } EOF
                          # Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/tests/browser" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "config": { "assertions": [], "configVariables": [ { "example": "content-type", "name": "PROPERTY", "pattern": "content-type", "type": "text" } ], "request": { "method": "GET", "url": "https://datadoghq.com" }, "setCookie": "name:test" }, "locations": [ "aws:us-east-2" ], "message": "Test message", "name": "Example-Synthetic", "options": { "accept_self_signed": false, "allow_insecure": true, "device_ids": [ "tablet" ], "disableCors": true, "follow_redirects": true, "min_failure_duration": 10, "min_location_failed": 1, "noScreenshot": true, "retry": { "count": 2, "interval": 10 }, "tick_every": 300, "scheduling": { "timeframes": [ { "day": 1, "from": "07:00", "to": "16:00" }, { "day": 3, "from": "07:00", "to": "16:00" } ], "timezone": "America/New_York" } }, "tags": [ "testing:browser" ], "type": "browser", "steps": [ { "allowFailure": false, "isCritical": true, "name": "Refresh page", "params": {}, "type": "refresh" } ] } EOF
// Create a browser test returns "OK - Returns saved rumSettings." 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/datadogV1"
)

func main() {
	body := datadogV1.SyntheticsBrowserTest{
		Config: datadogV1.SyntheticsBrowserTestConfig{
			Assertions: []datadogV1.SyntheticsAssertion{},
			ConfigVariables: []datadogV1.SyntheticsConfigVariable{
				{
					Example: datadog.PtrString("content-type"),
					Name:    "PROPERTY",
					Pattern: datadog.PtrString("content-type"),
					Type:    datadogV1.SYNTHETICSCONFIGVARIABLETYPE_TEXT,
				},
			},
			Request: datadogV1.SyntheticsTestRequest{
				Method: datadog.PtrString("GET"),
				Url:    datadog.PtrString("https://datadoghq.com"),
				CertificateDomains: []string{
					"https://datadoghq.com",
				},
			},
			SetCookie: datadog.PtrString("name:test"),
		},
		Locations: []string{
			"aws:us-east-2",
		},
		Message: "Test message",
		Name:    "Example-Synthetic",
		Options: datadogV1.SyntheticsTestOptions{
			AcceptSelfSigned: datadog.PtrBool(false),
			AllowInsecure:    datadog.PtrBool(true),
			DeviceIds: []datadogV1.SyntheticsDeviceID{
				datadogV1.SYNTHETICSDEVICEID_TABLET,
			},
			DisableCors:        datadog.PtrBool(true),
			FollowRedirects:    datadog.PtrBool(true),
			MinFailureDuration: datadog.PtrInt64(10),
			MinLocationFailed:  datadog.PtrInt64(1),
			NoScreenshot:       datadog.PtrBool(true),
			Retry: &datadogV1.SyntheticsTestOptionsRetry{
				Count:    datadog.PtrInt64(2),
				Interval: datadog.PtrFloat64(10),
			},
			RumSettings: &datadogV1.SyntheticsBrowserTestRumSettings{
				IsEnabled:     true,
				ApplicationId: datadog.PtrString("mockApplicationId"),
				ClientTokenId: datadog.PtrInt64(12345),
			},
			TickEvery: datadog.PtrInt64(300),
			Ci: &datadogV1.SyntheticsTestCiOptions{
				ExecutionRule: datadogV1.SYNTHETICSTESTEXECUTIONRULE_SKIPPED.Ptr(),
			},
			IgnoreServerCertificateError: datadog.PtrBool(true),
			DisableCsp:                   datadog.PtrBool(true),
			InitialNavigationTimeout:     datadog.PtrInt64(200),
		},
		Tags: []string{
			"testing:browser",
		},
		Type: datadogV1.SYNTHETICSBROWSERTESTTYPE_BROWSER,
		Steps: []datadogV1.SyntheticsStep{
			{
				AllowFailure: datadog.PtrBool(false),
				IsCritical:   datadog.PtrBool(true),
				Name:         datadog.PtrString("Refresh page"),
				Params:       new(interface{}),
				Type:         datadogV1.SYNTHETICSSTEPTYPE_REFRESH.Ptr(),
			},
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.CreateSyntheticsBrowserTest(ctx, body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.CreateSyntheticsBrowserTest`:\n%s\n", responseContent)
}
// Create a browser test returns "OK - Returns the created test details." 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/datadogV1"
)

func main() {
	body := datadogV1.SyntheticsBrowserTest{
		Config: datadogV1.SyntheticsBrowserTestConfig{
			Assertions: []datadogV1.SyntheticsAssertion{},
			Variables: []datadogV1.SyntheticsBrowserVariable{
				{
					Type:    datadogV1.SYNTHETICSBROWSERVARIABLETYPE_TEXT,
					Name:    "TEST_VARIABLE",
					Pattern: datadog.PtrString("secret"),
					Secure:  datadog.PtrBool(true),
					Example: datadog.PtrString("secret"),
				},
			},
			ConfigVariables: []datadogV1.SyntheticsConfigVariable{
				{
					Example: datadog.PtrString("content-type"),
					Name:    "PROPERTY",
					Pattern: datadog.PtrString("content-type"),
					Type:    datadogV1.SYNTHETICSCONFIGVARIABLETYPE_TEXT,
					Secure:  datadog.PtrBool(true),
				},
			},
			Request: datadogV1.SyntheticsTestRequest{
				Method: datadog.PtrString("GET"),
				Url:    datadog.PtrString("https://datadoghq.com"),
			},
			SetCookie: datadog.PtrString("name:test"),
		},
		Locations: []string{
			"aws:us-east-2",
		},
		Message: "Test message",
		Name:    "Example-Synthetic",
		Options: datadogV1.SyntheticsTestOptions{
			AcceptSelfSigned: datadog.PtrBool(false),
			AllowInsecure:    datadog.PtrBool(true),
			DeviceIds: []datadogV1.SyntheticsDeviceID{
				datadogV1.SYNTHETICSDEVICEID_CHROME_LAPTOP_LARGE,
			},
			DisableCors:        datadog.PtrBool(true),
			FollowRedirects:    datadog.PtrBool(true),
			MinFailureDuration: datadog.PtrInt64(10),
			MinLocationFailed:  datadog.PtrInt64(1),
			NoScreenshot:       datadog.PtrBool(true),
			Retry: &datadogV1.SyntheticsTestOptionsRetry{
				Count:    datadog.PtrInt64(2),
				Interval: datadog.PtrFloat64(10),
			},
			TickEvery:             datadog.PtrInt64(300),
			EnableProfiling:       datadog.PtrBool(true),
			EnableSecurityTesting: datadog.PtrBool(true),
		},
		Tags: []string{
			"testing:browser",
		},
		Type: datadogV1.SYNTHETICSBROWSERTESTTYPE_BROWSER,
		Steps: []datadogV1.SyntheticsStep{
			{
				AllowFailure: datadog.PtrBool(false),
				IsCritical:   datadog.PtrBool(true),
				Name:         datadog.PtrString("Refresh page"),
				Params:       new(interface{}),
				Type:         datadogV1.SYNTHETICSSTEPTYPE_REFRESH.Ptr(),
			},
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.CreateSyntheticsBrowserTest(ctx, body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.CreateSyntheticsBrowserTest`:\n%s\n", responseContent)
}
// Create a browser test with advanced scheduling options returns "OK - Returns the created test details." 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/datadogV1"
)

func main() {
	body := datadogV1.SyntheticsBrowserTest{
		Config: datadogV1.SyntheticsBrowserTestConfig{
			Assertions: []datadogV1.SyntheticsAssertion{},
			ConfigVariables: []datadogV1.SyntheticsConfigVariable{
				{
					Example: datadog.PtrString("content-type"),
					Name:    "PROPERTY",
					Pattern: datadog.PtrString("content-type"),
					Type:    datadogV1.SYNTHETICSCONFIGVARIABLETYPE_TEXT,
				},
			},
			Request: datadogV1.SyntheticsTestRequest{
				Method: datadog.PtrString("GET"),
				Url:    datadog.PtrString("https://datadoghq.com"),
			},
			SetCookie: datadog.PtrString("name:test"),
		},
		Locations: []string{
			"aws:us-east-2",
		},
		Message: "Test message",
		Name:    "Example-Synthetic",
		Options: datadogV1.SyntheticsTestOptions{
			AcceptSelfSigned: datadog.PtrBool(false),
			AllowInsecure:    datadog.PtrBool(true),
			DeviceIds: []datadogV1.SyntheticsDeviceID{
				datadogV1.SYNTHETICSDEVICEID_TABLET,
			},
			DisableCors:        datadog.PtrBool(true),
			FollowRedirects:    datadog.PtrBool(true),
			MinFailureDuration: datadog.PtrInt64(10),
			MinLocationFailed:  datadog.PtrInt64(1),
			NoScreenshot:       datadog.PtrBool(true),
			Retry: &datadogV1.SyntheticsTestOptionsRetry{
				Count:    datadog.PtrInt64(2),
				Interval: datadog.PtrFloat64(10),
			},
			TickEvery: datadog.PtrInt64(300),
			Scheduling: &datadogV1.SyntheticsTestOptionsScheduling{
				Timeframes: []datadogV1.SyntheticsTestOptionsSchedulingTimeframe{
					{
						Day:  datadog.PtrInt32(1),
						From: datadog.PtrString("07:00"),
						To:   datadog.PtrString("16:00"),
					},
					{
						Day:  datadog.PtrInt32(3),
						From: datadog.PtrString("07:00"),
						To:   datadog.PtrString("16:00"),
					},
				},
				Timezone: datadog.PtrString("America/New_York"),
			},
		},
		Tags: []string{
			"testing:browser",
		},
		Type: datadogV1.SYNTHETICSBROWSERTESTTYPE_BROWSER,
		Steps: []datadogV1.SyntheticsStep{
			{
				AllowFailure: datadog.PtrBool(false),
				IsCritical:   datadog.PtrBool(true),
				Name:         datadog.PtrString("Refresh page"),
				Params:       new(interface{}),
				Type:         datadogV1.SYNTHETICSSTEPTYPE_REFRESH.Ptr(),
			},
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.CreateSyntheticsBrowserTest(ctx, body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.CreateSyntheticsBrowserTest`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Create a browser test returns "OK - Returns saved rumSettings." response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsBrowserTest;
import com.datadog.api.client.v1.model.SyntheticsBrowserTestConfig;
import com.datadog.api.client.v1.model.SyntheticsBrowserTestRumSettings;
import com.datadog.api.client.v1.model.SyntheticsBrowserTestType;
import com.datadog.api.client.v1.model.SyntheticsConfigVariable;
import com.datadog.api.client.v1.model.SyntheticsConfigVariableType;
import com.datadog.api.client.v1.model.SyntheticsDeviceID;
import com.datadog.api.client.v1.model.SyntheticsStep;
import com.datadog.api.client.v1.model.SyntheticsStepType;
import com.datadog.api.client.v1.model.SyntheticsTestCiOptions;
import com.datadog.api.client.v1.model.SyntheticsTestExecutionRule;
import com.datadog.api.client.v1.model.SyntheticsTestOptions;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsRetry;
import com.datadog.api.client.v1.model.SyntheticsTestRequest;
import java.util.Collections;

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

    SyntheticsBrowserTest body =
        new SyntheticsBrowserTest()
            .config(
                new SyntheticsBrowserTestConfig()
                    .configVariables(
                        Collections.singletonList(
                            new SyntheticsConfigVariable()
                                .example("content-type")
                                .name("PROPERTY")
                                .pattern("content-type")
                                .type(SyntheticsConfigVariableType.TEXT)))
                    .request(
                        new SyntheticsTestRequest()
                            .method("GET")
                            .url("https://datadoghq.com")
                            .certificateDomains(Collections.singletonList("https://datadoghq.com")))
                    .setCookie("name:test"))
            .locations(Collections.singletonList("aws:us-east-2"))
            .message("Test message")
            .name("Example-Synthetic")
            .options(
                new SyntheticsTestOptions()
                    .acceptSelfSigned(false)
                    .allowInsecure(true)
                    .deviceIds(Collections.singletonList(SyntheticsDeviceID.TABLET))
                    .disableCors(true)
                    .followRedirects(true)
                    .minFailureDuration(10L)
                    .minLocationFailed(1L)
                    .noScreenshot(true)
                    .retry(new SyntheticsTestOptionsRetry().count(2L).interval(10.0))
                    .rumSettings(
                        new SyntheticsBrowserTestRumSettings()
                            .isEnabled(true)
                            .applicationId("mockApplicationId")
                            .clientTokenId(12345L))
                    .tickEvery(300L)
                    .ci(
                        new SyntheticsTestCiOptions()
                            .executionRule(SyntheticsTestExecutionRule.SKIPPED))
                    .ignoreServerCertificateError(true)
                    .disableCsp(true)
                    .initialNavigationTimeout(200L))
            .tags(Collections.singletonList("testing:browser"))
            .type(SyntheticsBrowserTestType.BROWSER)
            .steps(
                Collections.singletonList(
                    new SyntheticsStep()
                        .allowFailure(false)
                        .isCritical(true)
                        .name("Refresh page")
                        .params(new Object())
                        .type(SyntheticsStepType.REFRESH)));

    try {
      SyntheticsBrowserTest result = apiInstance.createSyntheticsBrowserTest(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#createSyntheticsBrowserTest");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
// Create a browser test returns "OK - Returns the created test details." response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsBrowserTest;
import com.datadog.api.client.v1.model.SyntheticsBrowserTestConfig;
import com.datadog.api.client.v1.model.SyntheticsBrowserTestType;
import com.datadog.api.client.v1.model.SyntheticsBrowserVariable;
import com.datadog.api.client.v1.model.SyntheticsBrowserVariableType;
import com.datadog.api.client.v1.model.SyntheticsConfigVariable;
import com.datadog.api.client.v1.model.SyntheticsConfigVariableType;
import com.datadog.api.client.v1.model.SyntheticsDeviceID;
import com.datadog.api.client.v1.model.SyntheticsStep;
import com.datadog.api.client.v1.model.SyntheticsStepType;
import com.datadog.api.client.v1.model.SyntheticsTestOptions;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsRetry;
import com.datadog.api.client.v1.model.SyntheticsTestRequest;
import java.util.Collections;

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

    SyntheticsBrowserTest body =
        new SyntheticsBrowserTest()
            .config(
                new SyntheticsBrowserTestConfig()
                    .variables(
                        Collections.singletonList(
                            new SyntheticsBrowserVariable()
                                .type(SyntheticsBrowserVariableType.TEXT)
                                .name("TEST_VARIABLE")
                                .pattern("secret")
                                .secure(true)
                                .example("secret")))
                    .configVariables(
                        Collections.singletonList(
                            new SyntheticsConfigVariable()
                                .example("content-type")
                                .name("PROPERTY")
                                .pattern("content-type")
                                .type(SyntheticsConfigVariableType.TEXT)
                                .secure(true)))
                    .request(new SyntheticsTestRequest().method("GET").url("https://datadoghq.com"))
                    .setCookie("name:test"))
            .locations(Collections.singletonList("aws:us-east-2"))
            .message("Test message")
            .name("Example-Synthetic")
            .options(
                new SyntheticsTestOptions()
                    .acceptSelfSigned(false)
                    .allowInsecure(true)
                    .deviceIds(Collections.singletonList(SyntheticsDeviceID.CHROME_LAPTOP_LARGE))
                    .disableCors(true)
                    .followRedirects(true)
                    .minFailureDuration(10L)
                    .minLocationFailed(1L)
                    .noScreenshot(true)
                    .retry(new SyntheticsTestOptionsRetry().count(2L).interval(10.0))
                    .tickEvery(300L))
            .tags(Collections.singletonList("testing:browser"))
            .type(SyntheticsBrowserTestType.BROWSER)
            .steps(
                Collections.singletonList(
                    new SyntheticsStep()
                        .allowFailure(false)
                        .isCritical(true)
                        .name("Refresh page")
                        .params(new Object())
                        .type(SyntheticsStepType.REFRESH)));

    try {
      SyntheticsBrowserTest result = apiInstance.createSyntheticsBrowserTest(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#createSyntheticsBrowserTest");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
// Create a browser test with advanced scheduling options returns "OK - Returns the created test
// details." response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsBrowserTest;
import com.datadog.api.client.v1.model.SyntheticsBrowserTestConfig;
import com.datadog.api.client.v1.model.SyntheticsBrowserTestType;
import com.datadog.api.client.v1.model.SyntheticsConfigVariable;
import com.datadog.api.client.v1.model.SyntheticsConfigVariableType;
import com.datadog.api.client.v1.model.SyntheticsDeviceID;
import com.datadog.api.client.v1.model.SyntheticsStep;
import com.datadog.api.client.v1.model.SyntheticsStepType;
import com.datadog.api.client.v1.model.SyntheticsTestOptions;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsRetry;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsScheduling;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsSchedulingTimeframe;
import com.datadog.api.client.v1.model.SyntheticsTestRequest;
import java.util.Arrays;
import java.util.Collections;

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

    SyntheticsBrowserTest body =
        new SyntheticsBrowserTest()
            .config(
                new SyntheticsBrowserTestConfig()
                    .configVariables(
                        Collections.singletonList(
                            new SyntheticsConfigVariable()
                                .example("content-type")
                                .name("PROPERTY")
                                .pattern("content-type")
                                .type(SyntheticsConfigVariableType.TEXT)))
                    .request(new SyntheticsTestRequest().method("GET").url("https://datadoghq.com"))
                    .setCookie("name:test"))
            .locations(Collections.singletonList("aws:us-east-2"))
            .message("Test message")
            .name("Example-Synthetic")
            .options(
                new SyntheticsTestOptions()
                    .acceptSelfSigned(false)
                    .allowInsecure(true)
                    .deviceIds(Collections.singletonList(SyntheticsDeviceID.TABLET))
                    .disableCors(true)
                    .followRedirects(true)
                    .minFailureDuration(10L)
                    .minLocationFailed(1L)
                    .noScreenshot(true)
                    .retry(new SyntheticsTestOptionsRetry().count(2L).interval(10.0))
                    .tickEvery(300L)
                    .scheduling(
                        new SyntheticsTestOptionsScheduling()
                            .timeframes(
                                Arrays.asList(
                                    new SyntheticsTestOptionsSchedulingTimeframe()
                                        .day(1)
                                        .from("07:00")
                                        .to("16:00"),
                                    new SyntheticsTestOptionsSchedulingTimeframe()
                                        .day(3)
                                        .from("07:00")
                                        .to("16:00")))
                            .timezone("America/New_York")))
            .tags(Collections.singletonList("testing:browser"))
            .type(SyntheticsBrowserTestType.BROWSER)
            .steps(
                Collections.singletonList(
                    new SyntheticsStep()
                        .allowFailure(false)
                        .isCritical(true)
                        .name("Refresh page")
                        .params(new Object())
                        .type(SyntheticsStepType.REFRESH)));

    try {
      SyntheticsBrowserTest result = apiInstance.createSyntheticsBrowserTest(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#createSyntheticsBrowserTest");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Create a browser test returns "OK - Returns saved rumSettings." response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_browser_test import SyntheticsBrowserTest
from datadog_api_client.v1.model.synthetics_browser_test_config import SyntheticsBrowserTestConfig
from datadog_api_client.v1.model.synthetics_browser_test_rum_settings import SyntheticsBrowserTestRumSettings
from datadog_api_client.v1.model.synthetics_browser_test_type import SyntheticsBrowserTestType
from datadog_api_client.v1.model.synthetics_config_variable import SyntheticsConfigVariable
from datadog_api_client.v1.model.synthetics_config_variable_type import SyntheticsConfigVariableType
from datadog_api_client.v1.model.synthetics_device_id import SyntheticsDeviceID
from datadog_api_client.v1.model.synthetics_step import SyntheticsStep
from datadog_api_client.v1.model.synthetics_step_type import SyntheticsStepType
from datadog_api_client.v1.model.synthetics_test_ci_options import SyntheticsTestCiOptions
from datadog_api_client.v1.model.synthetics_test_execution_rule import SyntheticsTestExecutionRule
from datadog_api_client.v1.model.synthetics_test_options import SyntheticsTestOptions
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry
from datadog_api_client.v1.model.synthetics_test_request import SyntheticsTestRequest

body = SyntheticsBrowserTest(
    config=SyntheticsBrowserTestConfig(
        assertions=[],
        config_variables=[
            SyntheticsConfigVariable(
                example="content-type",
                name="PROPERTY",
                pattern="content-type",
                type=SyntheticsConfigVariableType.TEXT,
            ),
        ],
        request=SyntheticsTestRequest(
            method="GET",
            url="https://datadoghq.com",
            certificate_domains=[
                "https://datadoghq.com",
            ],
        ),
        set_cookie="name:test",
    ),
    locations=[
        "aws:us-east-2",
    ],
    message="Test message",
    name="Example-Synthetic",
    options=SyntheticsTestOptions(
        accept_self_signed=False,
        allow_insecure=True,
        device_ids=[
            SyntheticsDeviceID.TABLET,
        ],
        disable_cors=True,
        follow_redirects=True,
        min_failure_duration=10,
        min_location_failed=1,
        no_screenshot=True,
        retry=SyntheticsTestOptionsRetry(
            count=2,
            interval=10.0,
        ),
        rum_settings=SyntheticsBrowserTestRumSettings(
            is_enabled=True,
            application_id="mockApplicationId",
            client_token_id=12345,
        ),
        tick_every=300,
        ci=SyntheticsTestCiOptions(
            execution_rule=SyntheticsTestExecutionRule.SKIPPED,
        ),
        ignore_server_certificate_error=True,
        disable_csp=True,
        initial_navigation_timeout=200,
    ),
    tags=[
        "testing:browser",
    ],
    type=SyntheticsBrowserTestType.BROWSER,
    steps=[
        SyntheticsStep(
            allow_failure=False,
            is_critical=True,
            name="Refresh page",
            params=dict(),
            type=SyntheticsStepType.REFRESH,
        ),
    ],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.create_synthetics_browser_test(body=body)

    print(response)
"""
Create a browser test returns "OK - Returns the created test details." response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_browser_test import SyntheticsBrowserTest
from datadog_api_client.v1.model.synthetics_browser_test_config import SyntheticsBrowserTestConfig
from datadog_api_client.v1.model.synthetics_browser_test_type import SyntheticsBrowserTestType
from datadog_api_client.v1.model.synthetics_browser_variable import SyntheticsBrowserVariable
from datadog_api_client.v1.model.synthetics_browser_variable_type import SyntheticsBrowserVariableType
from datadog_api_client.v1.model.synthetics_config_variable import SyntheticsConfigVariable
from datadog_api_client.v1.model.synthetics_config_variable_type import SyntheticsConfigVariableType
from datadog_api_client.v1.model.synthetics_device_id import SyntheticsDeviceID
from datadog_api_client.v1.model.synthetics_step import SyntheticsStep
from datadog_api_client.v1.model.synthetics_step_type import SyntheticsStepType
from datadog_api_client.v1.model.synthetics_test_options import SyntheticsTestOptions
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry
from datadog_api_client.v1.model.synthetics_test_request import SyntheticsTestRequest

body = SyntheticsBrowserTest(
    config=SyntheticsBrowserTestConfig(
        assertions=[],
        variables=[
            SyntheticsBrowserVariable(
                type=SyntheticsBrowserVariableType.TEXT,
                name="TEST_VARIABLE",
                pattern="secret",
                secure=True,
                example="secret",
            ),
        ],
        config_variables=[
            SyntheticsConfigVariable(
                example="content-type",
                name="PROPERTY",
                pattern="content-type",
                type=SyntheticsConfigVariableType.TEXT,
                secure=True,
            ),
        ],
        request=SyntheticsTestRequest(
            method="GET",
            url="https://datadoghq.com",
        ),
        set_cookie="name:test",
    ),
    locations=[
        "aws:us-east-2",
    ],
    message="Test message",
    name="Example-Synthetic",
    options=SyntheticsTestOptions(
        accept_self_signed=False,
        allow_insecure=True,
        device_ids=[
            SyntheticsDeviceID.CHROME_LAPTOP_LARGE,
        ],
        disable_cors=True,
        follow_redirects=True,
        min_failure_duration=10,
        min_location_failed=1,
        no_screenshot=True,
        retry=SyntheticsTestOptionsRetry(
            count=2,
            interval=10.0,
        ),
        tick_every=300,
    ),
    tags=[
        "testing:browser",
    ],
    type=SyntheticsBrowserTestType.BROWSER,
    steps=[
        SyntheticsStep(
            allow_failure=False,
            is_critical=True,
            name="Refresh page",
            params=dict(),
            type=SyntheticsStepType.REFRESH,
        ),
    ],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.create_synthetics_browser_test(body=body)

    print(response)
"""
Create a browser test with advanced scheduling options returns "OK - Returns the created test details." response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_browser_test import SyntheticsBrowserTest
from datadog_api_client.v1.model.synthetics_browser_test_config import SyntheticsBrowserTestConfig
from datadog_api_client.v1.model.synthetics_browser_test_type import SyntheticsBrowserTestType
from datadog_api_client.v1.model.synthetics_config_variable import SyntheticsConfigVariable
from datadog_api_client.v1.model.synthetics_config_variable_type import SyntheticsConfigVariableType
from datadog_api_client.v1.model.synthetics_device_id import SyntheticsDeviceID
from datadog_api_client.v1.model.synthetics_step import SyntheticsStep
from datadog_api_client.v1.model.synthetics_step_type import SyntheticsStepType
from datadog_api_client.v1.model.synthetics_test_options import SyntheticsTestOptions
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry
from datadog_api_client.v1.model.synthetics_test_options_scheduling import SyntheticsTestOptionsScheduling
from datadog_api_client.v1.model.synthetics_test_options_scheduling_timeframe import (
    SyntheticsTestOptionsSchedulingTimeframe,
)
from datadog_api_client.v1.model.synthetics_test_request import SyntheticsTestRequest

body = SyntheticsBrowserTest(
    config=SyntheticsBrowserTestConfig(
        assertions=[],
        config_variables=[
            SyntheticsConfigVariable(
                example="content-type",
                name="PROPERTY",
                pattern="content-type",
                type=SyntheticsConfigVariableType.TEXT,
            ),
        ],
        request=SyntheticsTestRequest(
            method="GET",
            url="https://datadoghq.com",
        ),
        set_cookie="name:test",
    ),
    locations=[
        "aws:us-east-2",
    ],
    message="Test message",
    name="Example-Synthetic",
    options=SyntheticsTestOptions(
        accept_self_signed=False,
        allow_insecure=True,
        device_ids=[
            SyntheticsDeviceID.TABLET,
        ],
        disable_cors=True,
        follow_redirects=True,
        min_failure_duration=10,
        min_location_failed=1,
        no_screenshot=True,
        retry=SyntheticsTestOptionsRetry(
            count=2,
            interval=10.0,
        ),
        tick_every=300,
        scheduling=SyntheticsTestOptionsScheduling(
            timeframes=[
                SyntheticsTestOptionsSchedulingTimeframe(
                    day=1,
                    _from="07:00",
                    to="16:00",
                ),
                SyntheticsTestOptionsSchedulingTimeframe(
                    day=3,
                    _from="07:00",
                    to="16:00",
                ),
            ],
            timezone="America/New_York",
        ),
    ),
    tags=[
        "testing:browser",
    ],
    type=SyntheticsBrowserTestType.BROWSER,
    steps=[
        SyntheticsStep(
            allow_failure=False,
            is_critical=True,
            name="Refresh page",
            params=dict(),
            type=SyntheticsStepType.REFRESH,
        ),
    ],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.create_synthetics_browser_test(body=body)

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Create a browser test returns "OK - Returns saved rumSettings." response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new

body = DatadogAPIClient::V1::SyntheticsBrowserTest.new({
  config: DatadogAPIClient::V1::SyntheticsBrowserTestConfig.new({
    assertions: [],
    config_variables: [
      DatadogAPIClient::V1::SyntheticsConfigVariable.new({
        example: "content-type",
        name: "PROPERTY",
        pattern: "content-type",
        type: DatadogAPIClient::V1::SyntheticsConfigVariableType::TEXT,
      }),
    ],
    request: DatadogAPIClient::V1::SyntheticsTestRequest.new({
      method: "GET",
      url: "https://datadoghq.com",
      certificate_domains: [
        "https://datadoghq.com",
      ],
    }),
    set_cookie: "name:test",
  }),
  locations: [
    "aws:us-east-2",
  ],
  message: "Test message",
  name: "Example-Synthetic",
  options: DatadogAPIClient::V1::SyntheticsTestOptions.new({
    accept_self_signed: false,
    allow_insecure: true,
    device_ids: [
      DatadogAPIClient::V1::SyntheticsDeviceID::TABLET,
    ],
    disable_cors: true,
    follow_redirects: true,
    min_failure_duration: 10,
    min_location_failed: 1,
    no_screenshot: true,
    _retry: DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({
      count: 2,
      interval: 10,
    }),
    rum_settings: DatadogAPIClient::V1::SyntheticsBrowserTestRumSettings.new({
      is_enabled: true,
      application_id: "mockApplicationId",
      client_token_id: 12345,
    }),
    tick_every: 300,
    ci: DatadogAPIClient::V1::SyntheticsTestCiOptions.new({
      execution_rule: DatadogAPIClient::V1::SyntheticsTestExecutionRule::SKIPPED,
    }),
    ignore_server_certificate_error: true,
    disable_csp: true,
    initial_navigation_timeout: 200,
  }),
  tags: [
    "testing:browser",
  ],
  type: DatadogAPIClient::V1::SyntheticsBrowserTestType::BROWSER,
  steps: [
    DatadogAPIClient::V1::SyntheticsStep.new({
      allow_failure: false,
      is_critical: true,
      name: "Refresh page",
      params: {},
      type: DatadogAPIClient::V1::SyntheticsStepType::REFRESH,
    }),
  ],
})
p api_instance.create_synthetics_browser_test(body)
# Create a browser test returns "OK - Returns the created test details." response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new

body = DatadogAPIClient::V1::SyntheticsBrowserTest.new({
  config: DatadogAPIClient::V1::SyntheticsBrowserTestConfig.new({
    assertions: [],
    variables: [
      DatadogAPIClient::V1::SyntheticsBrowserVariable.new({
        type: DatadogAPIClient::V1::SyntheticsBrowserVariableType::TEXT,
        name: "TEST_VARIABLE",
        pattern: "secret",
        secure: true,
        example: "secret",
      }),
    ],
    config_variables: [
      DatadogAPIClient::V1::SyntheticsConfigVariable.new({
        example: "content-type",
        name: "PROPERTY",
        pattern: "content-type",
        type: DatadogAPIClient::V1::SyntheticsConfigVariableType::TEXT,
        secure: true,
      }),
    ],
    request: DatadogAPIClient::V1::SyntheticsTestRequest.new({
      method: "GET",
      url: "https://datadoghq.com",
    }),
    set_cookie: "name:test",
  }),
  locations: [
    "aws:us-east-2",
  ],
  message: "Test message",
  name: "Example-Synthetic",
  options: DatadogAPIClient::V1::SyntheticsTestOptions.new({
    accept_self_signed: false,
    allow_insecure: true,
    device_ids: [
      DatadogAPIClient::V1::SyntheticsDeviceID::CHROME_LAPTOP_LARGE,
    ],
    disable_cors: true,
    follow_redirects: true,
    min_failure_duration: 10,
    min_location_failed: 1,
    no_screenshot: true,
    _retry: DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({
      count: 2,
      interval: 10,
    }),
    tick_every: 300,
  }),
  tags: [
    "testing:browser",
  ],
  type: DatadogAPIClient::V1::SyntheticsBrowserTestType::BROWSER,
  steps: [
    DatadogAPIClient::V1::SyntheticsStep.new({
      allow_failure: false,
      is_critical: true,
      name: "Refresh page",
      params: {},
      type: DatadogAPIClient::V1::SyntheticsStepType::REFRESH,
    }),
  ],
})
p api_instance.create_synthetics_browser_test(body)
# Create a browser test with advanced scheduling options returns "OK - Returns the created test details." response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new

body = DatadogAPIClient::V1::SyntheticsBrowserTest.new({
  config: DatadogAPIClient::V1::SyntheticsBrowserTestConfig.new({
    assertions: [],
    config_variables: [
      DatadogAPIClient::V1::SyntheticsConfigVariable.new({
        example: "content-type",
        name: "PROPERTY",
        pattern: "content-type",
        type: DatadogAPIClient::V1::SyntheticsConfigVariableType::TEXT,
      }),
    ],
    request: DatadogAPIClient::V1::SyntheticsTestRequest.new({
      method: "GET",
      url: "https://datadoghq.com",
    }),
    set_cookie: "name:test",
  }),
  locations: [
    "aws:us-east-2",
  ],
  message: "Test message",
  name: "Example-Synthetic",
  options: DatadogAPIClient::V1::SyntheticsTestOptions.new({
    accept_self_signed: false,
    allow_insecure: true,
    device_ids: [
      DatadogAPIClient::V1::SyntheticsDeviceID::TABLET,
    ],
    disable_cors: true,
    follow_redirects: true,
    min_failure_duration: 10,
    min_location_failed: 1,
    no_screenshot: true,
    _retry: DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({
      count: 2,
      interval: 10,
    }),
    tick_every: 300,
    scheduling: DatadogAPIClient::V1::SyntheticsTestOptionsScheduling.new({
      timeframes: [
        DatadogAPIClient::V1::SyntheticsTestOptionsSchedulingTimeframe.new({
          day: 1,
          from: "07:00",
          to: "16:00",
        }),
        DatadogAPIClient::V1::SyntheticsTestOptionsSchedulingTimeframe.new({
          day: 3,
          from: "07:00",
          to: "16:00",
        }),
      ],
      timezone: "America/New_York",
    }),
  }),
  tags: [
    "testing:browser",
  ],
  type: DatadogAPIClient::V1::SyntheticsBrowserTestType::BROWSER,
  steps: [
    DatadogAPIClient::V1::SyntheticsStep.new({
      allow_failure: false,
      is_critical: true,
      name: "Refresh page",
      params: {},
      type: DatadogAPIClient::V1::SyntheticsStepType::REFRESH,
    }),
  ],
})
p api_instance.create_synthetics_browser_test(body)

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
/**
 * Create a browser test returns "OK - Returns saved rumSettings." response
 */

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

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

const params: v1.SyntheticsApiCreateSyntheticsBrowserTestRequest = {
  body: {
    config: {
      assertions: [],
      configVariables: [
        {
          example: "content-type",
          name: "PROPERTY",
          pattern: "content-type",
          type: "text",
        },
      ],
      request: {
        method: "GET",
        url: "https://datadoghq.com",
        certificateDomains: ["https://datadoghq.com"],
      },
      setCookie: "name:test",
    },
    locations: ["aws:us-east-2"],
    message: "Test message",
    name: "Example-Synthetic",
    options: {
      acceptSelfSigned: false,
      allowInsecure: true,
      deviceIds: ["tablet"],
      disableCors: true,
      followRedirects: true,
      minFailureDuration: 10,
      minLocationFailed: 1,
      noScreenshot: true,
      retry: {
        count: 2,
        interval: 10,
      },
      rumSettings: {
        isEnabled: true,
        applicationId: "mockApplicationId",
        clientTokenId: 12345,
      },
      tickEvery: 300,
      ci: {
        executionRule: "skipped",
      },
      ignoreServerCertificateError: true,
      disableCsp: true,
      initialNavigationTimeout: 200,
    },
    tags: ["testing:browser"],
    type: "browser",
    steps: [
      {
        allowFailure: false,
        isCritical: true,
        name: "Refresh page",
        params: {},
        type: "refresh",
      },
    ],
  },
};

apiInstance
  .createSyntheticsBrowserTest(params)
  .then((data: v1.SyntheticsBrowserTest) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
/**
 * Create a browser test returns "OK - Returns the created test details." response
 */

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

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

const params: v1.SyntheticsApiCreateSyntheticsBrowserTestRequest = {
  body: {
    config: {
      assertions: [],
      variables: [
        {
          type: "text",
          name: "TEST_VARIABLE",
          pattern: "secret",
          secure: true,
          example: "secret",
        },
      ],
      configVariables: [
        {
          example: "content-type",
          name: "PROPERTY",
          pattern: "content-type",
          type: "text",
          secure: true,
        },
      ],
      request: {
        method: "GET",
        url: "https://datadoghq.com",
      },
      setCookie: "name:test",
    },
    locations: ["aws:us-east-2"],
    message: "Test message",
    name: "Example-Synthetic",
    options: {
      acceptSelfSigned: false,
      allowInsecure: true,
      deviceIds: ["chrome.laptop_large"],
      disableCors: true,
      followRedirects: true,
      minFailureDuration: 10,
      minLocationFailed: 1,
      noScreenshot: true,
      retry: {
        count: 2,
        interval: 10,
      },
      tickEvery: 300,
    },
    tags: ["testing:browser"],
    type: "browser",
    steps: [
      {
        allowFailure: false,
        isCritical: true,
        name: "Refresh page",
        params: {},
        type: "refresh",
      },
    ],
  },
};

apiInstance
  .createSyntheticsBrowserTest(params)
  .then((data: v1.SyntheticsBrowserTest) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
/**
 * Create a browser test with advanced scheduling options returns "OK - Returns the created test details." response
 */

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

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

const params: v1.SyntheticsApiCreateSyntheticsBrowserTestRequest = {
  body: {
    config: {
      assertions: [],
      configVariables: [
        {
          example: "content-type",
          name: "PROPERTY",
          pattern: "content-type",
          type: "text",
        },
      ],
      request: {
        method: "GET",
        url: "https://datadoghq.com",
      },
      setCookie: "name:test",
    },
    locations: ["aws:us-east-2"],
    message: "Test message",
    name: "Example-Synthetic",
    options: {
      acceptSelfSigned: false,
      allowInsecure: true,
      deviceIds: ["tablet"],
      disableCors: true,
      followRedirects: true,
      minFailureDuration: 10,
      minLocationFailed: 1,
      noScreenshot: true,
      retry: {
        count: 2,
        interval: 10,
      },
      tickEvery: 300,
      scheduling: {
        timeframes: [
          {
            day: 1,
            from: "07:00",
            to: "16:00",
          },
          {
            day: 3,
            from: "07:00",
            to: "16:00",
          },
        ],
        timezone: "America/New_York",
      },
    },
    tags: ["testing:browser"],
    type: "browser",
    steps: [
      {
        allowFailure: false,
        isCritical: true,
        name: "Refresh page",
        params: {},
        type: "refresh",
      },
    ],
  },
};

apiInstance
  .createSyntheticsBrowserTest(params)
  .then((data: v1.SyntheticsBrowserTest) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

PUT https://api.ap1.datadoghq.com/api/v1/synthetics/tests/api/{public_id}https://api.datadoghq.eu/api/v1/synthetics/tests/api/{public_id}https://api.ddog-gov.com/api/v1/synthetics/tests/api/{public_id}https://api.datadoghq.com/api/v1/synthetics/tests/api/{public_id}https://api.us3.datadoghq.com/api/v1/synthetics/tests/api/{public_id}https://api.us5.datadoghq.com/api/v1/synthetics/tests/api/{public_id}

概要

Synthetic API テストのコンフィギュレーションを編集します。 This endpoint requires the synthetics_write authorization scope.

引数

パスパラメーター

名前

種類

説明

public_id [required]

string

The public ID of the test to get details from.

リクエスト

Body Data (required)

保存する新しいテストの詳細。

Expand All

フィールド

種類

説明

config [required]

object

Configuration object for a Synthetic API test.

assertions

[ <oneOf>]

Array of assertions used for the test. Required for single API tests.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

configVariables

[object]

Array of variables used for the test.

example

string

Example for the variable.

id

string

ID of the variable for global variables.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Whether the value of this variable will be obfuscated in test results. Only for config variables of type text.

type [required]

enum

Type of the configuration variable. Allowed enum values: global,text

request

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

steps

[object <oneOf>]

When the test subtype is multi, the steps of the test.

Option 1

object

The Test step used in a Synthetic multi-step API test.

allowFailure

boolean

Determines whether or not to continue with test if this step fails.

assertions [required]

[ <oneOf>]

Array of assertions used for the test.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

extractedValues

[object]

Array of values to parse and save as variables from the response.

field

string

When type is http_header, name of the header to use to extract the value.

name

string

Name of the variable to extract.

parser

object

Details of the parser to use for the global variable.

type [required]

enum

Type of parser for a Synthetic global variable from a synthetics test. Allowed enum values: raw,json_path,regex,x_path

value

string

Regex or JSON path used for the parser. Not used with type raw.

secure

boolean

Determines whether or not the extracted value will be obfuscated.

type

enum

Property of the Synthetic Test Response to use for a Synthetic global variable. Allowed enum values: http_body,http_header,local_variable

isCritical

boolean

Determines whether or not to consider the entire test as failed if this step fails. Can be used only if allowFailure is true.

name [required]

string

The name of the step.

request [required]

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

subtype [required]

enum

The subtype of the Synthetic multi-step API test step. Allowed enum values: http,grpc

Option 2

object

The Wait step used in a Synthetic multi-step API test.

name [required]

string

The name of the step.

subtype [required]

enum

The subtype of the Synthetic multi-step API wait step. Allowed enum values: wait

value [required]

int32

The time to wait in seconds. Minimum value: 0. Maximum value: 180.

variablesFromScript

string

Variables defined from JavaScript code.

locations [required]

[string]

Array of locations used to run the test.

message [required]

string

Notification message associated with the test.

monitor_id

int64

The associated monitor ID.

name [required]

string

Name of the test.

options [required]

object

Object describing the extra options for a Synthetic test.

accept_self_signed

boolean

For SSL test, whether or not the test should allow self signed certificates.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in an API test.

checkCertificateRevocation

boolean

For SSL test, whether or not the test should fail on revoked certificate in stapled OCSP.

ci

object

CI/CD options for a Synthetic test.

executionRule

enum

Execution rule for a Synthetic test. Allowed enum values: blocking,non_blocking,skipped

device_ids

[string]

For browser test, array with the different device IDs used to run the test.

disableCors

boolean

Whether or not to disable CORS mechanism.

disableCsp

boolean

Disable Content Security Policy for browser tests.

enableProfiling

boolean

Enable profiling for browser tests.

enableSecurityTesting

boolean

DEPRECATED: Enable security testing for browser tests. Security testing is not available anymore. This field is deprecated and won't be used.

follow_redirects

boolean

For API HTTP test, whether or not the test should follow redirects.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

ignoreServerCertificateError

boolean

Ignore server certificate error for browser tests.

initialNavigationTimeout

int64

Timeout before declaring the initial step as failed (in seconds) for browser tests.

min_failure_duration

int64

Minimum amount of time in failure required to trigger an alert.

min_location_failed

int64

Minimum number of locations in failure required to trigger an alert.

monitor_name

string

The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.

monitor_options

object

Object containing the options for a Synthetic test as a monitor (for example, renotification).

renotify_interval

int64

Time interval before renotifying if the test is still failing (in minutes).

monitor_priority

int32

Integer from 1 (high) to 5 (low) indicating alert severity.

noScreenshot

boolean

Prevents saving screenshots of the steps.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

rumSettings

object

The RUM data collection settings for the Synthetic browser test. Note: There are 3 ways to format RUM settings:

{ isEnabled: false } RUM data is not collected.

{ isEnabled: true } RUM data is collected from the Synthetic test's default application.

{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 } RUM data is collected using the specified application.

applicationId

string

RUM application ID used to collect RUM data for the browser test.

clientTokenId

int64

RUM application API key ID used to collect RUM data for the browser test.

isEnabled [required]

boolean

Determines whether RUM data is collected during test runs.

scheduling

object

Object containing timeframes and timezone used for advanced scheduling.

timeframes

[object]

Array containing objects describing the scheduling pattern to apply to each day.

day

int32

Number representing the day of the week.

from

string

The hour of the day on which scheduling starts.

to

string

The hour of the day on which scheduling ends.

timezone

string

Timezone in which the timeframe is based.

tick_every

int64

The frequency at which to run the Synthetic test (in seconds).

public_id

string

The public ID for the test.

status

enum

Define whether you want to start (live) or pause (paused) a Synthetic test. Allowed enum values: live,paused

subtype

enum

The subtype of the Synthetic API test, http, ssl, tcp, dns, icmp, udp, websocket, grpc or multi. Allowed enum values: http,ssl,tcp,dns,multi,icmp,udp,websocket,grpc

tags

[string]

Array of tags attached to the test.

type [required]

enum

Type of the Synthetic test, api. Allowed enum values: api

default: api

{
  "config": {
    "assertions": [
      {
        "operator": "is",
        "property": "{{ PROPERTY }}",
        "target": "text/html",
        "type": "header"
      },
      {
        "operator": "lessThan",
        "target": 2000,
        "type": "responseTime"
      },
      {
        "operator": "validatesJSONPath",
        "target": {
          "jsonPath": "topKey",
          "operator": "isNot",
          "targetValue": "0"
        },
        "type": "body"
      },
      {
        "operator": "validatesJSONSchema",
        "target": {
          "metaSchema": "draft-07",
          "jsonSchema": "{\"type\": \"object\", \"properties\":{\"slideshow\":{\"type\":\"object\"}}}"
        },
        "type": "body"
      }
    ],
    "configVariables": [
      {
        "example": "content-type",
        "name": "PROPERTY",
        "pattern": "content-type",
        "type": "text"
      }
    ],
    "request": {
      "certificate": {
        "cert": {
          "filename": "cert-filename",
          "updatedAt": "2020-10-16T09:23:24.857Z"
        },
        "key": {
          "filename": "key-filename",
          "updatedAt": "2020-10-16T09:23:24.857Z"
        }
      },
      "headers": {
        "unique": "examplesynthetic"
      },
      "method": "GET",
      "timeout": 10,
      "url": "https://datadoghq.com"
    }
  },
  "locations": [
    "aws:us-east-2"
  ],
  "message": "BDD test payload: synthetics_api_test_payload.json",
  "name": "Example-Synthetic-updated",
  "options": {
    "accept_self_signed": false,
    "allow_insecure": true,
    "follow_redirects": true,
    "min_failure_duration": 10,
    "min_location_failed": 1,
    "monitor_name": "Test-TestSyntheticsAPITestLifecycle-1623076664",
    "monitor_priority": 5,
    "retry": {
      "count": 3,
      "interval": 10
    },
    "tick_every": 60
  },
  "status": "live",
  "subtype": "http",
  "tags": [
    "testing:api"
  ],
  "type": "api"
}

応答

OK

Object containing details about a Synthetic API test.

Expand All

フィールド

種類

説明

config [required]

object

Configuration object for a Synthetic API test.

assertions

[ <oneOf>]

Array of assertions used for the test. Required for single API tests.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

configVariables

[object]

Array of variables used for the test.

example

string

Example for the variable.

id

string

ID of the variable for global variables.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Whether the value of this variable will be obfuscated in test results. Only for config variables of type text.

type [required]

enum

Type of the configuration variable. Allowed enum values: global,text

request

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

steps

[object <oneOf>]

When the test subtype is multi, the steps of the test.

Option 1

object

The Test step used in a Synthetic multi-step API test.

allowFailure

boolean

Determines whether or not to continue with test if this step fails.

assertions [required]

[ <oneOf>]

Array of assertions used for the test.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

extractedValues

[object]

Array of values to parse and save as variables from the response.

field

string

When type is http_header, name of the header to use to extract the value.

name

string

Name of the variable to extract.

parser

object

Details of the parser to use for the global variable.

type [required]

enum

Type of parser for a Synthetic global variable from a synthetics test. Allowed enum values: raw,json_path,regex,x_path

value

string

Regex or JSON path used for the parser. Not used with type raw.

secure

boolean

Determines whether or not the extracted value will be obfuscated.

type

enum

Property of the Synthetic Test Response to use for a Synthetic global variable. Allowed enum values: http_body,http_header,local_variable

isCritical

boolean

Determines whether or not to consider the entire test as failed if this step fails. Can be used only if allowFailure is true.

name [required]

string

The name of the step.

request [required]

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

subtype [required]

enum

The subtype of the Synthetic multi-step API test step. Allowed enum values: http,grpc

Option 2

object

The Wait step used in a Synthetic multi-step API test.

name [required]

string

The name of the step.

subtype [required]

enum

The subtype of the Synthetic multi-step API wait step. Allowed enum values: wait

value [required]

int32

The time to wait in seconds. Minimum value: 0. Maximum value: 180.

variablesFromScript

string

Variables defined from JavaScript code.

locations [required]

[string]

Array of locations used to run the test.

message [required]

string

Notification message associated with the test.

monitor_id

int64

The associated monitor ID.

name [required]

string

Name of the test.

options [required]

object

Object describing the extra options for a Synthetic test.

accept_self_signed

boolean

For SSL test, whether or not the test should allow self signed certificates.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in an API test.

checkCertificateRevocation

boolean

For SSL test, whether or not the test should fail on revoked certificate in stapled OCSP.

ci

object

CI/CD options for a Synthetic test.

executionRule

enum

Execution rule for a Synthetic test. Allowed enum values: blocking,non_blocking,skipped

device_ids

[string]

For browser test, array with the different device IDs used to run the test.

disableCors

boolean

Whether or not to disable CORS mechanism.

disableCsp

boolean

Disable Content Security Policy for browser tests.

enableProfiling

boolean

Enable profiling for browser tests.

enableSecurityTesting

boolean

DEPRECATED: Enable security testing for browser tests. Security testing is not available anymore. This field is deprecated and won't be used.

follow_redirects

boolean

For API HTTP test, whether or not the test should follow redirects.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

ignoreServerCertificateError

boolean

Ignore server certificate error for browser tests.

initialNavigationTimeout

int64

Timeout before declaring the initial step as failed (in seconds) for browser tests.

min_failure_duration

int64

Minimum amount of time in failure required to trigger an alert.

min_location_failed

int64

Minimum number of locations in failure required to trigger an alert.

monitor_name

string

The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.

monitor_options

object

Object containing the options for a Synthetic test as a monitor (for example, renotification).

renotify_interval

int64

Time interval before renotifying if the test is still failing (in minutes).

monitor_priority

int32

Integer from 1 (high) to 5 (low) indicating alert severity.

noScreenshot

boolean

Prevents saving screenshots of the steps.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

rumSettings

object

The RUM data collection settings for the Synthetic browser test. Note: There are 3 ways to format RUM settings:

{ isEnabled: false } RUM data is not collected.

{ isEnabled: true } RUM data is collected from the Synthetic test's default application.

{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 } RUM data is collected using the specified application.

applicationId

string

RUM application ID used to collect RUM data for the browser test.

clientTokenId

int64

RUM application API key ID used to collect RUM data for the browser test.

isEnabled [required]

boolean

Determines whether RUM data is collected during test runs.

scheduling

object

Object containing timeframes and timezone used for advanced scheduling.

timeframes

[object]

Array containing objects describing the scheduling pattern to apply to each day.

day

int32

Number representing the day of the week.

from

string

The hour of the day on which scheduling starts.

to

string

The hour of the day on which scheduling ends.

timezone

string

Timezone in which the timeframe is based.

tick_every

int64

The frequency at which to run the Synthetic test (in seconds).

public_id

string

The public ID for the test.

status

enum

Define whether you want to start (live) or pause (paused) a Synthetic test. Allowed enum values: live,paused

subtype

enum

The subtype of the Synthetic API test, http, ssl, tcp, dns, icmp, udp, websocket, grpc or multi. Allowed enum values: http,ssl,tcp,dns,multi,icmp,udp,websocket,grpc

tags

[string]

Array of tags attached to the test.

type [required]

enum

Type of the Synthetic test, api. Allowed enum values: api

default: api

{
  "config": {
    "assertions": [
      []
    ],
    "configVariables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ],
    "request": {
      "allow_insecure": false,
      "basicAuth": {
        "password": "PaSSw0RD!",
        "type": "web",
        "username": "my_username"
      },
      "body": "string",
      "bodyType": "text/plain",
      "callType": "unary",
      "certificate": {
        "cert": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        },
        "key": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        }
      },
      "certificateDomains": [],
      "compressedJsonDescriptor": "string",
      "compressedProtoFile": "string",
      "dnsServer": "string",
      "dnsServerPort": "integer",
      "files": [
        {
          "bucketKey": "string",
          "content": "string",
          "name": "string",
          "originalFileName": "string",
          "size": "integer",
          "type": "string"
        }
      ],
      "follow_redirects": false,
      "headers": {
        "<any-key>": "string"
      },
      "host": "string",
      "httpVersion": "string",
      "message": "string",
      "metadata": {
        "<any-key>": "string"
      },
      "method": "string",
      "noSavingResponseBody": false,
      "numberOfPackets": "integer",
      "persistCookies": false,
      "port": "integer",
      "proxy": {
        "headers": {
          "<any-key>": "string"
        },
        "url": "https://example.com"
      },
      "query": {},
      "servername": "string",
      "service": "Greeter",
      "shouldTrackHops": false,
      "timeout": "number",
      "url": "https://example.com"
    },
    "steps": [],
    "variablesFromScript": "dd.variable.set(\"FOO\", \"foo\")"
  },
  "locations": [
    "aws:eu-west-3"
  ],
  "message": "Notification message",
  "monitor_id": 12345678,
  "name": "Example test name",
  "options": {
    "accept_self_signed": false,
    "allow_insecure": false,
    "checkCertificateRevocation": false,
    "ci": {
      "executionRule": "string"
    },
    "device_ids": [
      "chrome.laptop_large"
    ],
    "disableCors": false,
    "disableCsp": false,
    "enableProfiling": false,
    "enableSecurityTesting": false,
    "follow_redirects": false,
    "httpVersion": "string",
    "ignoreServerCertificateError": false,
    "initialNavigationTimeout": "integer",
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "monitor_name": "string",
    "monitor_options": {
      "renotify_interval": "integer"
    },
    "monitor_priority": "integer",
    "noScreenshot": false,
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ],
    "retry": {
      "count": "integer",
      "interval": "number"
    },
    "rumSettings": {
      "applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "clientTokenId": 12345,
      "isEnabled": true
    },
    "scheduling": {
      "timeframes": [
        {
          "day": 1,
          "from": "07:00",
          "to": "16:00"
        }
      ],
      "timezone": "America/New_York"
    },
    "tick_every": "integer"
  },
  "public_id": "123-abc-456",
  "status": "live",
  "subtype": "http",
  "tags": [
    "env:production"
  ],
  "type": "api"
}

- JSON format is wrong - Updating sub-type is forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

- Synthetic Monitoring is not activated for the user - Test is not owned by the user - Test can't be found

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                          # Path parameters
export public_id="CHANGE_ME"
# Curl command
curl -X PUT "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/tests/api/${public_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "config": { "assertions": [ { "operator": "is", "property": "{{ PROPERTY }}", "target": "text/html", "type": "header" }, { "operator": "lessThan", "target": 2000, "type": "responseTime" }, { "operator": "validatesJSONPath", "target": { "jsonPath": "topKey", "operator": "isNot", "targetValue": "0" }, "type": "body" }, { "operator": "validatesJSONSchema", "target": { "metaSchema": "draft-07", "jsonSchema": "{\"type\": \"object\", \"properties\":{\"slideshow\":{\"type\":\"object\"}}}" }, "type": "body" } ], "configVariables": [ { "example": "content-type", "name": "PROPERTY", "pattern": "content-type", "type": "text" } ], "request": { "certificate": { "cert": { "filename": "cert-filename", "updatedAt": "2020-10-16T09:23:24.857Z" }, "key": { "filename": "key-filename", "updatedAt": "2020-10-16T09:23:24.857Z" } }, "headers": { "unique": "examplesynthetic" }, "method": "GET", "timeout": 10, "url": "https://datadoghq.com" } }, "locations": [ "aws:us-east-2" ], "message": "BDD test payload: synthetics_api_test_payload.json", "name": "Example-Synthetic-updated", "options": { "accept_self_signed": false, "allow_insecure": true, "follow_redirects": true, "min_failure_duration": 10, "min_location_failed": 1, "monitor_name": "Test-TestSyntheticsAPITestLifecycle-1623076664", "monitor_priority": 5, "retry": { "count": 3, "interval": 10 }, "tick_every": 60 }, "status": "live", "subtype": "http", "tags": [ "testing:api" ], "type": "api" } EOF
// Edit an API test 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/datadogV1"
)

func main() {
	// there is a valid "synthetics_api_test" in the system
	SyntheticsAPITestPublicID := os.Getenv("SYNTHETICS_API_TEST_PUBLIC_ID")

	body := datadogV1.SyntheticsAPITest{
		Config: datadogV1.SyntheticsAPITestConfig{
			Assertions: []datadogV1.SyntheticsAssertion{
				datadogV1.SyntheticsAssertion{
					SyntheticsAssertionTarget: &datadogV1.SyntheticsAssertionTarget{
						Operator: datadogV1.SYNTHETICSASSERTIONOPERATOR_IS,
						Property: datadog.PtrString("{{ PROPERTY }}"),
						Target:   "text/html",
						Type:     datadogV1.SYNTHETICSASSERTIONTYPE_HEADER,
					}},
				datadogV1.SyntheticsAssertion{
					SyntheticsAssertionTarget: &datadogV1.SyntheticsAssertionTarget{
						Operator: datadogV1.SYNTHETICSASSERTIONOPERATOR_LESS_THAN,
						Target:   2000,
						Type:     datadogV1.SYNTHETICSASSERTIONTYPE_RESPONSE_TIME,
					}},
				datadogV1.SyntheticsAssertion{
					SyntheticsAssertionJSONPathTarget: &datadogV1.SyntheticsAssertionJSONPathTarget{
						Operator: datadogV1.SYNTHETICSASSERTIONJSONPATHOPERATOR_VALIDATES_JSON_PATH,
						Target: &datadogV1.SyntheticsAssertionJSONPathTargetTarget{
							JsonPath:    datadog.PtrString("topKey"),
							Operator:    datadog.PtrString("isNot"),
							TargetValue: "0",
						},
						Type: datadogV1.SYNTHETICSASSERTIONTYPE_BODY,
					}},
				datadogV1.SyntheticsAssertion{
					SyntheticsAssertionJSONSchemaTarget: &datadogV1.SyntheticsAssertionJSONSchemaTarget{
						Operator: datadogV1.SYNTHETICSASSERTIONJSONSCHEMAOPERATOR_VALIDATES_JSON_SCHEMA,
						Target: &datadogV1.SyntheticsAssertionJSONSchemaTargetTarget{
							MetaSchema: datadogV1.SYNTHETICSASSERTIONJSONSCHEMAMETASCHEMA_DRAFT_07.Ptr(),
							JsonSchema: datadog.PtrString(`{"type": "object", "properties":{"slideshow":{"type":"object"}}}`),
						},
						Type: datadogV1.SYNTHETICSASSERTIONTYPE_BODY,
					}},
			},
			ConfigVariables: []datadogV1.SyntheticsConfigVariable{
				{
					Example: datadog.PtrString("content-type"),
					Name:    "PROPERTY",
					Pattern: datadog.PtrString("content-type"),
					Type:    datadogV1.SYNTHETICSCONFIGVARIABLETYPE_TEXT,
				},
			},
			Request: &datadogV1.SyntheticsTestRequest{
				Certificate: &datadogV1.SyntheticsTestRequestCertificate{
					Cert: &datadogV1.SyntheticsTestRequestCertificateItem{
						Filename:  datadog.PtrString("cert-filename"),
						UpdatedAt: datadog.PtrString("2020-10-16T09:23:24.857Z"),
					},
					Key: &datadogV1.SyntheticsTestRequestCertificateItem{
						Filename:  datadog.PtrString("key-filename"),
						UpdatedAt: datadog.PtrString("2020-10-16T09:23:24.857Z"),
					},
				},
				Headers: map[string]string{
					"unique": "examplesynthetic",
				},
				Method:  datadog.PtrString("GET"),
				Timeout: datadog.PtrFloat64(10),
				Url:     datadog.PtrString("https://datadoghq.com"),
			},
		},
		Locations: []string{
			"aws:us-east-2",
		},
		Message: "BDD test payload: synthetics_api_test_payload.json",
		Name:    "Example-Synthetic-updated",
		Options: datadogV1.SyntheticsTestOptions{
			AcceptSelfSigned:   datadog.PtrBool(false),
			AllowInsecure:      datadog.PtrBool(true),
			FollowRedirects:    datadog.PtrBool(true),
			MinFailureDuration: datadog.PtrInt64(10),
			MinLocationFailed:  datadog.PtrInt64(1),
			MonitorName:        datadog.PtrString("Test-TestSyntheticsAPITestLifecycle-1623076664"),
			MonitorPriority:    datadog.PtrInt32(5),
			Retry: &datadogV1.SyntheticsTestOptionsRetry{
				Count:    datadog.PtrInt64(3),
				Interval: datadog.PtrFloat64(10),
			},
			TickEvery: datadog.PtrInt64(60),
		},
		Status:  datadogV1.SYNTHETICSTESTPAUSESTATUS_LIVE.Ptr(),
		Subtype: datadogV1.SYNTHETICSTESTDETAILSSUBTYPE_HTTP.Ptr(),
		Tags: []string{
			"testing:api",
		},
		Type: datadogV1.SYNTHETICSAPITESTTYPE_API,
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.UpdateAPITest(ctx, SyntheticsAPITestPublicID, body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.UpdateAPITest`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Edit an API test returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsAPITest;
import com.datadog.api.client.v1.model.SyntheticsAPITestConfig;
import com.datadog.api.client.v1.model.SyntheticsAPITestType;
import com.datadog.api.client.v1.model.SyntheticsAssertion;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONPathOperator;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONPathTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONPathTargetTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONSchemaMetaSchema;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONSchemaOperator;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONSchemaTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionJSONSchemaTargetTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionOperator;
import com.datadog.api.client.v1.model.SyntheticsAssertionTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionType;
import com.datadog.api.client.v1.model.SyntheticsConfigVariable;
import com.datadog.api.client.v1.model.SyntheticsConfigVariableType;
import com.datadog.api.client.v1.model.SyntheticsTestDetailsSubType;
import com.datadog.api.client.v1.model.SyntheticsTestOptions;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsRetry;
import com.datadog.api.client.v1.model.SyntheticsTestPauseStatus;
import com.datadog.api.client.v1.model.SyntheticsTestRequest;
import com.datadog.api.client.v1.model.SyntheticsTestRequestCertificate;
import com.datadog.api.client.v1.model.SyntheticsTestRequestCertificateItem;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;

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

    // there is a valid "synthetics_api_test" in the system
    String SYNTHETICS_API_TEST_PUBLIC_ID = System.getenv("SYNTHETICS_API_TEST_PUBLIC_ID");

    SyntheticsAPITest body =
        new SyntheticsAPITest()
            .config(
                new SyntheticsAPITestConfig()
                    .assertions(
                        Arrays.asList(
                            new SyntheticsAssertion(
                                new SyntheticsAssertionTarget()
                                    .operator(SyntheticsAssertionOperator.IS)
                                    .property("{{ PROPERTY }}")
                                    .target("text/html")
                                    .type(SyntheticsAssertionType.HEADER)),
                            new SyntheticsAssertion(
                                new SyntheticsAssertionTarget()
                                    .operator(SyntheticsAssertionOperator.LESS_THAN)
                                    .target(2000)
                                    .type(SyntheticsAssertionType.RESPONSE_TIME)),
                            new SyntheticsAssertion(
                                new SyntheticsAssertionJSONPathTarget()
                                    .operator(
                                        SyntheticsAssertionJSONPathOperator.VALIDATES_JSON_PATH)
                                    .target(
                                        new SyntheticsAssertionJSONPathTargetTarget()
                                            .jsonPath("topKey")
                                            .operator("isNot")
                                            .targetValue("0"))
                                    .type(SyntheticsAssertionType.BODY)),
                            new SyntheticsAssertion(
                                new SyntheticsAssertionJSONSchemaTarget()
                                    .operator(
                                        SyntheticsAssertionJSONSchemaOperator.VALIDATES_JSON_SCHEMA)
                                    .target(
                                        new SyntheticsAssertionJSONSchemaTargetTarget()
                                            .metaSchema(
                                                SyntheticsAssertionJSONSchemaMetaSchema.DRAFT_07)
                                            .jsonSchema(
                                                """
{"type": "object", "properties":{"slideshow":{"type":"object"}}}
"""))
                                    .type(SyntheticsAssertionType.BODY))))
                    .configVariables(
                        Collections.singletonList(
                            new SyntheticsConfigVariable()
                                .example("content-type")
                                .name("PROPERTY")
                                .pattern("content-type")
                                .type(SyntheticsConfigVariableType.TEXT)))
                    .request(
                        new SyntheticsTestRequest()
                            .certificate(
                                new SyntheticsTestRequestCertificate()
                                    .cert(
                                        new SyntheticsTestRequestCertificateItem()
                                            .filename("cert-filename")
                                            .updatedAt("2020-10-16T09:23:24.857Z"))
                                    .key(
                                        new SyntheticsTestRequestCertificateItem()
                                            .filename("key-filename")
                                            .updatedAt("2020-10-16T09:23:24.857Z")))
                            .headers(Map.ofEntries(Map.entry("unique", "examplesynthetic")))
                            .method("GET")
                            .timeout(10.0)
                            .url("https://datadoghq.com")))
            .locations(Collections.singletonList("aws:us-east-2"))
            .message("BDD test payload: synthetics_api_test_payload.json")
            .name("Example-Synthetic-updated")
            .options(
                new SyntheticsTestOptions()
                    .acceptSelfSigned(false)
                    .allowInsecure(true)
                    .followRedirects(true)
                    .minFailureDuration(10L)
                    .minLocationFailed(1L)
                    .monitorName("Test-TestSyntheticsAPITestLifecycle-1623076664")
                    .monitorPriority(5)
                    .retry(new SyntheticsTestOptionsRetry().count(3L).interval(10.0))
                    .tickEvery(60L))
            .status(SyntheticsTestPauseStatus.LIVE)
            .subtype(SyntheticsTestDetailsSubType.HTTP)
            .tags(Collections.singletonList("testing:api"))
            .type(SyntheticsAPITestType.API);

    try {
      SyntheticsAPITest result = apiInstance.updateAPITest(SYNTHETICS_API_TEST_PUBLIC_ID, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#updateAPITest");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Edit an API test returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_api_test import SyntheticsAPITest
from datadog_api_client.v1.model.synthetics_api_test_config import SyntheticsAPITestConfig
from datadog_api_client.v1.model.synthetics_api_test_type import SyntheticsAPITestType
from datadog_api_client.v1.model.synthetics_assertion_json_path_operator import SyntheticsAssertionJSONPathOperator
from datadog_api_client.v1.model.synthetics_assertion_json_path_target import SyntheticsAssertionJSONPathTarget
from datadog_api_client.v1.model.synthetics_assertion_json_path_target_target import (
    SyntheticsAssertionJSONPathTargetTarget,
)
from datadog_api_client.v1.model.synthetics_assertion_json_schema_meta_schema import (
    SyntheticsAssertionJSONSchemaMetaSchema,
)
from datadog_api_client.v1.model.synthetics_assertion_json_schema_operator import SyntheticsAssertionJSONSchemaOperator
from datadog_api_client.v1.model.synthetics_assertion_json_schema_target import SyntheticsAssertionJSONSchemaTarget
from datadog_api_client.v1.model.synthetics_assertion_json_schema_target_target import (
    SyntheticsAssertionJSONSchemaTargetTarget,
)
from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator
from datadog_api_client.v1.model.synthetics_assertion_target import SyntheticsAssertionTarget
from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType
from datadog_api_client.v1.model.synthetics_config_variable import SyntheticsConfigVariable
from datadog_api_client.v1.model.synthetics_config_variable_type import SyntheticsConfigVariableType
from datadog_api_client.v1.model.synthetics_test_details_sub_type import SyntheticsTestDetailsSubType
from datadog_api_client.v1.model.synthetics_test_headers import SyntheticsTestHeaders
from datadog_api_client.v1.model.synthetics_test_options import SyntheticsTestOptions
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry
from datadog_api_client.v1.model.synthetics_test_pause_status import SyntheticsTestPauseStatus
from datadog_api_client.v1.model.synthetics_test_request import SyntheticsTestRequest
from datadog_api_client.v1.model.synthetics_test_request_certificate import SyntheticsTestRequestCertificate
from datadog_api_client.v1.model.synthetics_test_request_certificate_item import SyntheticsTestRequestCertificateItem

# there is a valid "synthetics_api_test" in the system
SYNTHETICS_API_TEST_PUBLIC_ID = environ["SYNTHETICS_API_TEST_PUBLIC_ID"]

body = SyntheticsAPITest(
    config=SyntheticsAPITestConfig(
        assertions=[
            SyntheticsAssertionTarget(
                operator=SyntheticsAssertionOperator.IS,
                _property="{{ PROPERTY }}",
                target="text/html",
                type=SyntheticsAssertionType.HEADER,
            ),
            SyntheticsAssertionTarget(
                operator=SyntheticsAssertionOperator.LESS_THAN,
                target=2000,
                type=SyntheticsAssertionType.RESPONSE_TIME,
            ),
            SyntheticsAssertionJSONPathTarget(
                operator=SyntheticsAssertionJSONPathOperator.VALIDATES_JSON_PATH,
                target=SyntheticsAssertionJSONPathTargetTarget(
                    json_path="topKey",
                    operator="isNot",
                    target_value="0",
                ),
                type=SyntheticsAssertionType.BODY,
            ),
            SyntheticsAssertionJSONSchemaTarget(
                operator=SyntheticsAssertionJSONSchemaOperator.VALIDATES_JSON_SCHEMA,
                target=SyntheticsAssertionJSONSchemaTargetTarget(
                    meta_schema=SyntheticsAssertionJSONSchemaMetaSchema.DRAFT_07,
                    json_schema='{"type": "object", "properties":{"slideshow":{"type":"object"}}}',
                ),
                type=SyntheticsAssertionType.BODY,
            ),
        ],
        config_variables=[
            SyntheticsConfigVariable(
                example="content-type",
                name="PROPERTY",
                pattern="content-type",
                type=SyntheticsConfigVariableType.TEXT,
            ),
        ],
        request=SyntheticsTestRequest(
            certificate=SyntheticsTestRequestCertificate(
                cert=SyntheticsTestRequestCertificateItem(
                    filename="cert-filename",
                    updated_at="2020-10-16T09:23:24.857Z",
                ),
                key=SyntheticsTestRequestCertificateItem(
                    filename="key-filename",
                    updated_at="2020-10-16T09:23:24.857Z",
                ),
            ),
            headers=SyntheticsTestHeaders(
                unique="examplesynthetic",
            ),
            method="GET",
            timeout=10.0,
            url="https://datadoghq.com",
        ),
    ),
    locations=[
        "aws:us-east-2",
    ],
    message="BDD test payload: synthetics_api_test_payload.json",
    name="Example-Synthetic-updated",
    options=SyntheticsTestOptions(
        accept_self_signed=False,
        allow_insecure=True,
        follow_redirects=True,
        min_failure_duration=10,
        min_location_failed=1,
        monitor_name="Test-TestSyntheticsAPITestLifecycle-1623076664",
        monitor_priority=5,
        retry=SyntheticsTestOptionsRetry(
            count=3,
            interval=10.0,
        ),
        tick_every=60,
    ),
    status=SyntheticsTestPauseStatus.LIVE,
    subtype=SyntheticsTestDetailsSubType.HTTP,
    tags=[
        "testing:api",
    ],
    type=SyntheticsAPITestType.API,
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.update_api_test(public_id=SYNTHETICS_API_TEST_PUBLIC_ID, body=body)

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Edit an API test returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new

# there is a valid "synthetics_api_test" in the system
SYNTHETICS_API_TEST_PUBLIC_ID = ENV["SYNTHETICS_API_TEST_PUBLIC_ID"]

body = DatadogAPIClient::V1::SyntheticsAPITest.new({
  config: DatadogAPIClient::V1::SyntheticsAPITestConfig.new({
    assertions: [
      DatadogAPIClient::V1::SyntheticsAssertionTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionOperator::IS,
        property: "{{ PROPERTY }}",
        target: "text/html",
        type: DatadogAPIClient::V1::SyntheticsAssertionType::HEADER,
      }),
      DatadogAPIClient::V1::SyntheticsAssertionTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionOperator::LESS_THAN,
        target: 2000,
        type: DatadogAPIClient::V1::SyntheticsAssertionType::RESPONSE_TIME,
      }),
      DatadogAPIClient::V1::SyntheticsAssertionJSONPathTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionJSONPathOperator::VALIDATES_JSON_PATH,
        target: DatadogAPIClient::V1::SyntheticsAssertionJSONPathTargetTarget.new({
          json_path: "topKey",
          operator: "isNot",
          target_value: "0",
        }),
        type: DatadogAPIClient::V1::SyntheticsAssertionType::BODY,
      }),
      DatadogAPIClient::V1::SyntheticsAssertionJSONSchemaTarget.new({
        operator: DatadogAPIClient::V1::SyntheticsAssertionJSONSchemaOperator::VALIDATES_JSON_SCHEMA,
        target: DatadogAPIClient::V1::SyntheticsAssertionJSONSchemaTargetTarget.new({
          meta_schema: DatadogAPIClient::V1::SyntheticsAssertionJSONSchemaMetaSchema::DRAFT_07,
          json_schema: '{"type": "object", "properties":{"slideshow":{"type":"object"}}}',
        }),
        type: DatadogAPIClient::V1::SyntheticsAssertionType::BODY,
      }),
    ],
    config_variables: [
      DatadogAPIClient::V1::SyntheticsConfigVariable.new({
        example: "content-type",
        name: "PROPERTY",
        pattern: "content-type",
        type: DatadogAPIClient::V1::SyntheticsConfigVariableType::TEXT,
      }),
    ],
    request: DatadogAPIClient::V1::SyntheticsTestRequest.new({
      certificate: DatadogAPIClient::V1::SyntheticsTestRequestCertificate.new({
        cert: DatadogAPIClient::V1::SyntheticsTestRequestCertificateItem.new({
          filename: "cert-filename",
          updated_at: "2020-10-16T09:23:24.857Z",
        }),
        key: DatadogAPIClient::V1::SyntheticsTestRequestCertificateItem.new({
          filename: "key-filename",
          updated_at: "2020-10-16T09:23:24.857Z",
        }),
      }),
      headers: {
        unique: "examplesynthetic",
      },
      method: "GET",
      timeout: 10,
      url: "https://datadoghq.com",
    }),
  }),
  locations: [
    "aws:us-east-2",
  ],
  message: "BDD test payload: synthetics_api_test_payload.json",
  name: "Example-Synthetic-updated",
  options: DatadogAPIClient::V1::SyntheticsTestOptions.new({
    accept_self_signed: false,
    allow_insecure: true,
    follow_redirects: true,
    min_failure_duration: 10,
    min_location_failed: 1,
    monitor_name: "Test-TestSyntheticsAPITestLifecycle-1623076664",
    monitor_priority: 5,
    _retry: DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({
      count: 3,
      interval: 10,
    }),
    tick_every: 60,
  }),
  status: DatadogAPIClient::V1::SyntheticsTestPauseStatus::LIVE,
  subtype: DatadogAPIClient::V1::SyntheticsTestDetailsSubType::HTTP,
  tags: [
    "testing:api",
  ],
  type: DatadogAPIClient::V1::SyntheticsAPITestType::API,
})
p api_instance.update_api_test(SYNTHETICS_API_TEST_PUBLIC_ID, body)

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
/**
 * Edit an API test returns "OK" response
 */

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

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

// there is a valid "synthetics_api_test" in the system
const SYNTHETICS_API_TEST_PUBLIC_ID = process.env
  .SYNTHETICS_API_TEST_PUBLIC_ID as string;

const params: v1.SyntheticsApiUpdateAPITestRequest = {
  body: {
    config: {
      assertions: [
        {
          operator: "is",
          property: "{{ PROPERTY }}",
          target: "text/html",
          type: "header",
        },
        {
          operator: "lessThan",
          target: 2000,
          type: "responseTime",
        },
        {
          operator: "validatesJSONPath",
          target: {
            jsonPath: "topKey",
            operator: "isNot",
            targetValue: "0",
          },
          type: "body",
        },
        {
          operator: "validatesJSONSchema",
          target: {
            metaSchema: "draft-07",
            jsonSchema: `{"type": "object", "properties":{"slideshow":{"type":"object"}}}`,
          },
          type: "body",
        },
      ],
      configVariables: [
        {
          example: "content-type",
          name: "PROPERTY",
          pattern: "content-type",
          type: "text",
        },
      ],
      request: {
        certificate: {
          cert: {
            filename: "cert-filename",
            updatedAt: "2020-10-16T09:23:24.857Z",
          },
          key: {
            filename: "key-filename",
            updatedAt: "2020-10-16T09:23:24.857Z",
          },
        },
        headers: {
          unique: "examplesynthetic",
        },
        method: "GET",
        timeout: 10,
        url: "https://datadoghq.com",
      },
    },
    locations: ["aws:us-east-2"],
    message: "BDD test payload: synthetics_api_test_payload.json",
    name: "Example-Synthetic-updated",
    options: {
      acceptSelfSigned: false,
      allowInsecure: true,
      followRedirects: true,
      minFailureDuration: 10,
      minLocationFailed: 1,
      monitorName: "Test-TestSyntheticsAPITestLifecycle-1623076664",
      monitorPriority: 5,
      retry: {
        count: 3,
        interval: 10,
      },
      tickEvery: 60,
    },
    status: "live",
    subtype: "http",
    tags: ["testing:api"],
    type: "api",
  },
  publicId: SYNTHETICS_API_TEST_PUBLIC_ID,
};

apiInstance
  .updateAPITest(params)
  .then((data: v1.SyntheticsAPITest) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

PUT https://api.ap1.datadoghq.com/api/v1/synthetics/tests/browser/{public_id}https://api.datadoghq.eu/api/v1/synthetics/tests/browser/{public_id}https://api.ddog-gov.com/api/v1/synthetics/tests/browser/{public_id}https://api.datadoghq.com/api/v1/synthetics/tests/browser/{public_id}https://api.us3.datadoghq.com/api/v1/synthetics/tests/browser/{public_id}https://api.us5.datadoghq.com/api/v1/synthetics/tests/browser/{public_id}

概要

Synthetic ブラウザテストのコンフィギュレーションを編集します。 This endpoint requires the synthetics_write authorization scope.

引数

パスパラメーター

名前

種類

説明

public_id [required]

string

The public ID of the test to edit.

リクエスト

Body Data (required)

保存する新しいテストの詳細。

Expand All

フィールド

種類

説明

config [required]

object

Configuration object for a Synthetic browser test.

assertions [required]

[ <oneOf>]

Array of assertions used for the test.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

configVariables

[object]

Array of variables used for the test.

example

string

Example for the variable.

id

string

ID of the variable for global variables.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Whether the value of this variable will be obfuscated in test results. Only for config variables of type text.

type [required]

enum

Type of the configuration variable. Allowed enum values: global,text

request [required]

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

setCookie

string

Cookies to be used for the request, using the Set-Cookie syntax.

variables

[object]

Array of variables used for the test steps.

example

string

Example for the variable.

id

string

ID for the variable. Global variables require an ID.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Determines whether or not the browser test variable is obfuscated. Can only be used with browser variables of type text.

type [required]

enum

Type of browser test variable. Allowed enum values: element,email,global,javascript,text

locations [required]

[string]

Array of locations used to run the test.

message [required]

string

Notification message associated with the test. Message can either be text or an empty string.

monitor_id

int64

The associated monitor ID.

name [required]

string

Name of the test.

options [required]

object

Object describing the extra options for a Synthetic test.

accept_self_signed

boolean

For SSL test, whether or not the test should allow self signed certificates.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in an API test.

checkCertificateRevocation

boolean

For SSL test, whether or not the test should fail on revoked certificate in stapled OCSP.

ci

object

CI/CD options for a Synthetic test.

executionRule

enum

Execution rule for a Synthetic test. Allowed enum values: blocking,non_blocking,skipped

device_ids

[string]

For browser test, array with the different device IDs used to run the test.

disableCors

boolean

Whether or not to disable CORS mechanism.

disableCsp

boolean

Disable Content Security Policy for browser tests.

enableProfiling

boolean

Enable profiling for browser tests.

enableSecurityTesting

boolean

DEPRECATED: Enable security testing for browser tests. Security testing is not available anymore. This field is deprecated and won't be used.

follow_redirects

boolean

For API HTTP test, whether or not the test should follow redirects.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

ignoreServerCertificateError

boolean

Ignore server certificate error for browser tests.

initialNavigationTimeout

int64

Timeout before declaring the initial step as failed (in seconds) for browser tests.

min_failure_duration

int64

Minimum amount of time in failure required to trigger an alert.

min_location_failed

int64

Minimum number of locations in failure required to trigger an alert.

monitor_name

string

The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.

monitor_options

object

Object containing the options for a Synthetic test as a monitor (for example, renotification).

renotify_interval

int64

Time interval before renotifying if the test is still failing (in minutes).

monitor_priority

int32

Integer from 1 (high) to 5 (low) indicating alert severity.

noScreenshot

boolean

Prevents saving screenshots of the steps.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

rumSettings

object

The RUM data collection settings for the Synthetic browser test. Note: There are 3 ways to format RUM settings:

{ isEnabled: false } RUM data is not collected.

{ isEnabled: true } RUM data is collected from the Synthetic test's default application.

{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 } RUM data is collected using the specified application.

applicationId

string

RUM application ID used to collect RUM data for the browser test.

clientTokenId

int64

RUM application API key ID used to collect RUM data for the browser test.

isEnabled [required]

boolean

Determines whether RUM data is collected during test runs.

scheduling

object

Object containing timeframes and timezone used for advanced scheduling.

timeframes

[object]

Array containing objects describing the scheduling pattern to apply to each day.

day

int32

Number representing the day of the week.

from

string

The hour of the day on which scheduling starts.

to

string

The hour of the day on which scheduling ends.

timezone

string

Timezone in which the timeframe is based.

tick_every

int64

The frequency at which to run the Synthetic test (in seconds).

public_id

string

The public ID of the test.

status

enum

Define whether you want to start (live) or pause (paused) a Synthetic test. Allowed enum values: live,paused

steps

[object]

Array of steps for the test.

allowFailure

boolean

A boolean set to allow this step to fail.

isCritical

boolean

A boolean to use in addition to allowFailure to determine if the test should be marked as failed when the step fails.

name

string

The name of the step.

noScreenshot

boolean

A boolean set to not take a screenshot for the step.

params

object

The parameters of the step.

timeout

int64

The time before declaring a step failed.

type

enum

Step type used in your Synthetic test. Allowed enum values: assertCurrentUrl,assertElementAttribute,assertElementContent,assertElementPresent,assertEmail,assertFileDownload,assertFromJavascript,assertPageContains,assertPageLacks,click,extractFromJavascript,extractVariable,goToEmailLink,goToUrl,goToUrlAndMeasureTti,hover,playSubTest,pressKey,refresh,runApiTest,scroll,selectOption,typeText,uploadFiles,wait

tags

[string]

Array of tags attached to the test.

type [required]

enum

Type of the Synthetic test, browser. Allowed enum values: browser

default: browser

{
  "config": {
    "assertions": [
      {
        "operator": "contains",
        "property": "string",
        "target": 123456,
        "timingsScope": "string",
        "type": "statusCode"
      }
    ],
    "configVariables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ],
    "request": {
      "allow_insecure": false,
      "basicAuth": {
        "password": "PaSSw0RD!",
        "type": "web",
        "username": "my_username"
      },
      "body": "string",
      "bodyType": "text/plain",
      "callType": "unary",
      "certificate": {
        "cert": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        },
        "key": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        }
      },
      "certificateDomains": [],
      "compressedJsonDescriptor": "string",
      "compressedProtoFile": "string",
      "dnsServer": "string",
      "dnsServerPort": "integer",
      "files": [
        {
          "bucketKey": "string",
          "content": "string",
          "name": "string",
          "originalFileName": "string",
          "size": "integer",
          "type": "string"
        }
      ],
      "follow_redirects": false,
      "headers": {
        "<any-key>": "string"
      },
      "host": "string",
      "httpVersion": "string",
      "message": "string",
      "metadata": {
        "<any-key>": "string"
      },
      "method": "string",
      "noSavingResponseBody": false,
      "numberOfPackets": "integer",
      "persistCookies": false,
      "port": "integer",
      "proxy": {
        "headers": {
          "<any-key>": "string"
        },
        "url": "https://example.com"
      },
      "query": {},
      "servername": "string",
      "service": "Greeter",
      "shouldTrackHops": false,
      "timeout": "number",
      "url": "https://example.com"
    },
    "setCookie": "string",
    "variables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ]
  },
  "locations": [
    "aws:eu-west-3"
  ],
  "message": "",
  "name": "Example test name",
  "options": {
    "accept_self_signed": false,
    "allow_insecure": false,
    "checkCertificateRevocation": false,
    "ci": {
      "executionRule": "string"
    },
    "device_ids": [
      "chrome.laptop_large"
    ],
    "disableCors": false,
    "disableCsp": false,
    "enableProfiling": false,
    "enableSecurityTesting": false,
    "follow_redirects": false,
    "httpVersion": "string",
    "ignoreServerCertificateError": false,
    "initialNavigationTimeout": "integer",
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "monitor_name": "string",
    "monitor_options": {
      "renotify_interval": "integer"
    },
    "monitor_priority": "integer",
    "noScreenshot": false,
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ],
    "retry": {
      "count": "integer",
      "interval": "number"
    },
    "rumSettings": {
      "applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "clientTokenId": 12345,
      "isEnabled": true
    },
    "scheduling": {
      "timeframes": [
        {
          "day": 1,
          "from": "07:00",
          "to": "16:00"
        }
      ],
      "timezone": "America/New_York"
    },
    "tick_every": "integer"
  },
  "status": "live",
  "steps": [
    {
      "allowFailure": false,
      "isCritical": false,
      "name": "string",
      "noScreenshot": false,
      "params": {},
      "timeout": "integer",
      "type": "assertElementContent"
    }
  ],
  "tags": [
    "env:prod"
  ],
  "type": "browser"
}

応答

OK

Object containing details about a Synthetic browser test.

Expand All

フィールド

種類

説明

config [required]

object

Configuration object for a Synthetic browser test.

assertions [required]

[ <oneOf>]

Array of assertions used for the test.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

configVariables

[object]

Array of variables used for the test.

example

string

Example for the variable.

id

string

ID of the variable for global variables.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Whether the value of this variable will be obfuscated in test results. Only for config variables of type text.

type [required]

enum

Type of the configuration variable. Allowed enum values: global,text

request [required]

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

setCookie

string

Cookies to be used for the request, using the Set-Cookie syntax.

variables

[object]

Array of variables used for the test steps.

example

string

Example for the variable.

id

string

ID for the variable. Global variables require an ID.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Determines whether or not the browser test variable is obfuscated. Can only be used with browser variables of type text.

type [required]

enum

Type of browser test variable. Allowed enum values: element,email,global,javascript,text

locations [required]

[string]

Array of locations used to run the test.

message [required]

string

Notification message associated with the test. Message can either be text or an empty string.

monitor_id

int64

The associated monitor ID.

name [required]

string

Name of the test.

options [required]

object

Object describing the extra options for a Synthetic test.

accept_self_signed

boolean

For SSL test, whether or not the test should allow self signed certificates.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in an API test.

checkCertificateRevocation

boolean

For SSL test, whether or not the test should fail on revoked certificate in stapled OCSP.

ci

object

CI/CD options for a Synthetic test.

executionRule

enum

Execution rule for a Synthetic test. Allowed enum values: blocking,non_blocking,skipped

device_ids

[string]

For browser test, array with the different device IDs used to run the test.

disableCors

boolean

Whether or not to disable CORS mechanism.

disableCsp

boolean

Disable Content Security Policy for browser tests.

enableProfiling

boolean

Enable profiling for browser tests.

enableSecurityTesting

boolean

DEPRECATED: Enable security testing for browser tests. Security testing is not available anymore. This field is deprecated and won't be used.

follow_redirects

boolean

For API HTTP test, whether or not the test should follow redirects.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

ignoreServerCertificateError

boolean

Ignore server certificate error for browser tests.

initialNavigationTimeout

int64

Timeout before declaring the initial step as failed (in seconds) for browser tests.

min_failure_duration

int64

Minimum amount of time in failure required to trigger an alert.

min_location_failed

int64

Minimum number of locations in failure required to trigger an alert.

monitor_name

string

The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.

monitor_options

object

Object containing the options for a Synthetic test as a monitor (for example, renotification).

renotify_interval

int64

Time interval before renotifying if the test is still failing (in minutes).

monitor_priority

int32

Integer from 1 (high) to 5 (low) indicating alert severity.

noScreenshot

boolean

Prevents saving screenshots of the steps.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

rumSettings

object

The RUM data collection settings for the Synthetic browser test. Note: There are 3 ways to format RUM settings:

{ isEnabled: false } RUM data is not collected.

{ isEnabled: true } RUM data is collected from the Synthetic test's default application.

{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 } RUM data is collected using the specified application.

applicationId

string

RUM application ID used to collect RUM data for the browser test.

clientTokenId

int64

RUM application API key ID used to collect RUM data for the browser test.

isEnabled [required]

boolean

Determines whether RUM data is collected during test runs.

scheduling

object

Object containing timeframes and timezone used for advanced scheduling.

timeframes

[object]

Array containing objects describing the scheduling pattern to apply to each day.

day

int32

Number representing the day of the week.

from

string

The hour of the day on which scheduling starts.

to

string

The hour of the day on which scheduling ends.

timezone

string

Timezone in which the timeframe is based.

tick_every

int64

The frequency at which to run the Synthetic test (in seconds).

public_id

string

The public ID of the test.

status

enum

Define whether you want to start (live) or pause (paused) a Synthetic test. Allowed enum values: live,paused

steps

[object]

Array of steps for the test.

allowFailure

boolean

A boolean set to allow this step to fail.

isCritical

boolean

A boolean to use in addition to allowFailure to determine if the test should be marked as failed when the step fails.

name

string

The name of the step.

noScreenshot

boolean

A boolean set to not take a screenshot for the step.

params

object

The parameters of the step.

timeout

int64

The time before declaring a step failed.

type

enum

Step type used in your Synthetic test. Allowed enum values: assertCurrentUrl,assertElementAttribute,assertElementContent,assertElementPresent,assertEmail,assertFileDownload,assertFromJavascript,assertPageContains,assertPageLacks,click,extractFromJavascript,extractVariable,goToEmailLink,goToUrl,goToUrlAndMeasureTti,hover,playSubTest,pressKey,refresh,runApiTest,scroll,selectOption,typeText,uploadFiles,wait

tags

[string]

Array of tags attached to the test.

type [required]

enum

Type of the Synthetic test, browser. Allowed enum values: browser

default: browser

{
  "config": {
    "assertions": [
      {
        "operator": "contains",
        "property": "string",
        "target": 123456,
        "timingsScope": "string",
        "type": "statusCode"
      }
    ],
    "configVariables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ],
    "request": {
      "allow_insecure": false,
      "basicAuth": {
        "password": "PaSSw0RD!",
        "type": "web",
        "username": "my_username"
      },
      "body": "string",
      "bodyType": "text/plain",
      "callType": "unary",
      "certificate": {
        "cert": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        },
        "key": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        }
      },
      "certificateDomains": [],
      "compressedJsonDescriptor": "string",
      "compressedProtoFile": "string",
      "dnsServer": "string",
      "dnsServerPort": "integer",
      "files": [
        {
          "bucketKey": "string",
          "content": "string",
          "name": "string",
          "originalFileName": "string",
          "size": "integer",
          "type": "string"
        }
      ],
      "follow_redirects": false,
      "headers": {
        "<any-key>": "string"
      },
      "host": "string",
      "httpVersion": "string",
      "message": "string",
      "metadata": {
        "<any-key>": "string"
      },
      "method": "string",
      "noSavingResponseBody": false,
      "numberOfPackets": "integer",
      "persistCookies": false,
      "port": "integer",
      "proxy": {
        "headers": {
          "<any-key>": "string"
        },
        "url": "https://example.com"
      },
      "query": {},
      "servername": "string",
      "service": "Greeter",
      "shouldTrackHops": false,
      "timeout": "number",
      "url": "https://example.com"
    },
    "setCookie": "string",
    "variables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ]
  },
  "locations": [
    "aws:eu-west-3"
  ],
  "message": "",
  "monitor_id": "integer",
  "name": "Example test name",
  "options": {
    "accept_self_signed": false,
    "allow_insecure": false,
    "checkCertificateRevocation": false,
    "ci": {
      "executionRule": "string"
    },
    "device_ids": [
      "chrome.laptop_large"
    ],
    "disableCors": false,
    "disableCsp": false,
    "enableProfiling": false,
    "enableSecurityTesting": false,
    "follow_redirects": false,
    "httpVersion": "string",
    "ignoreServerCertificateError": false,
    "initialNavigationTimeout": "integer",
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "monitor_name": "string",
    "monitor_options": {
      "renotify_interval": "integer"
    },
    "monitor_priority": "integer",
    "noScreenshot": false,
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ],
    "retry": {
      "count": "integer",
      "interval": "number"
    },
    "rumSettings": {
      "applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "clientTokenId": 12345,
      "isEnabled": true
    },
    "scheduling": {
      "timeframes": [
        {
          "day": 1,
          "from": "07:00",
          "to": "16:00"
        }
      ],
      "timezone": "America/New_York"
    },
    "tick_every": "integer"
  },
  "public_id": "string",
  "status": "live",
  "steps": [
    {
      "allowFailure": false,
      "isCritical": false,
      "name": "string",
      "noScreenshot": false,
      "params": {},
      "timeout": "integer",
      "type": "assertElementContent"
    }
  ],
  "tags": [
    "env:prod"
  ],
  "type": "browser"
}

- JSON format is wrong - Updating sub-type is forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

- Synthetic Monitoring is not activated for the user - Test is not owned by the user - Test can't be found

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                  # Path parameters
export public_id="CHANGE_ME"
# Curl command
curl -X PUT "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/tests/browser/${public_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "config": { "assertions": [ {} ], "configVariables": [ { "name": "VARIABLE_NAME", "type": "text" } ], "request": { "proxy": { "url": "https://example.com" } }, "variables": [ { "name": "VARIABLE_NAME", "type": "text" } ] }, "locations": [ "aws:eu-west-3" ], "message": "", "name": "Example test name", "options": { "rumSettings": { "isEnabled": true } }, "type": "browser" } EOF
"""
Edit a browser test returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_basic_auth_web import SyntheticsBasicAuthWeb
from datadog_api_client.v1.model.synthetics_basic_auth_web_type import SyntheticsBasicAuthWebType
from datadog_api_client.v1.model.synthetics_browser_test import SyntheticsBrowserTest
from datadog_api_client.v1.model.synthetics_browser_test_config import SyntheticsBrowserTestConfig
from datadog_api_client.v1.model.synthetics_browser_test_rum_settings import SyntheticsBrowserTestRumSettings
from datadog_api_client.v1.model.synthetics_browser_test_type import SyntheticsBrowserTestType
from datadog_api_client.v1.model.synthetics_browser_variable import SyntheticsBrowserVariable
from datadog_api_client.v1.model.synthetics_browser_variable_type import SyntheticsBrowserVariableType
from datadog_api_client.v1.model.synthetics_config_variable import SyntheticsConfigVariable
from datadog_api_client.v1.model.synthetics_config_variable_type import SyntheticsConfigVariableType
from datadog_api_client.v1.model.synthetics_device_id import SyntheticsDeviceID
from datadog_api_client.v1.model.synthetics_restricted_roles import SyntheticsRestrictedRoles
from datadog_api_client.v1.model.synthetics_step import SyntheticsStep
from datadog_api_client.v1.model.synthetics_step_type import SyntheticsStepType
from datadog_api_client.v1.model.synthetics_test_call_type import SyntheticsTestCallType
from datadog_api_client.v1.model.synthetics_test_ci_options import SyntheticsTestCiOptions
from datadog_api_client.v1.model.synthetics_test_execution_rule import SyntheticsTestExecutionRule
from datadog_api_client.v1.model.synthetics_test_options import SyntheticsTestOptions
from datadog_api_client.v1.model.synthetics_test_options_http_version import SyntheticsTestOptionsHTTPVersion
from datadog_api_client.v1.model.synthetics_test_options_monitor_options import SyntheticsTestOptionsMonitorOptions
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry
from datadog_api_client.v1.model.synthetics_test_options_scheduling import SyntheticsTestOptionsScheduling
from datadog_api_client.v1.model.synthetics_test_options_scheduling_timeframe import (
    SyntheticsTestOptionsSchedulingTimeframe,
)
from datadog_api_client.v1.model.synthetics_test_pause_status import SyntheticsTestPauseStatus
from datadog_api_client.v1.model.synthetics_test_request import SyntheticsTestRequest
from datadog_api_client.v1.model.synthetics_test_request_body_file import SyntheticsTestRequestBodyFile
from datadog_api_client.v1.model.synthetics_test_request_body_type import SyntheticsTestRequestBodyType
from datadog_api_client.v1.model.synthetics_test_request_certificate import SyntheticsTestRequestCertificate
from datadog_api_client.v1.model.synthetics_test_request_certificate_item import SyntheticsTestRequestCertificateItem
from datadog_api_client.v1.model.synthetics_test_request_proxy import SyntheticsTestRequestProxy

body = SyntheticsBrowserTest(
    config=SyntheticsBrowserTestConfig(
        assertions=[],
        config_variables=[
            SyntheticsConfigVariable(
                name="VARIABLE_NAME",
                secure=False,
                type=SyntheticsConfigVariableType.TEXT,
            ),
        ],
        request=SyntheticsTestRequest(
            basic_auth=SyntheticsBasicAuthWeb(
                password="PaSSw0RD!",
                type=SyntheticsBasicAuthWebType.WEB,
                username="my_username",
            ),
            body_type=SyntheticsTestRequestBodyType.TEXT_PLAIN,
            call_type=SyntheticsTestCallType.UNARY,
            certificate=SyntheticsTestRequestCertificate(
                cert=SyntheticsTestRequestCertificateItem(),
                key=SyntheticsTestRequestCertificateItem(),
            ),
            certificate_domains=[],
            files=[
                SyntheticsTestRequestBodyFile(),
            ],
            http_version=SyntheticsTestOptionsHTTPVersion.HTTP1,
            proxy=SyntheticsTestRequestProxy(
                url="https://example.com",
            ),
            service="Greeter",
            url="https://example.com",
        ),
        variables=[
            SyntheticsBrowserVariable(
                name="VARIABLE_NAME",
                type=SyntheticsBrowserVariableType.TEXT,
            ),
        ],
    ),
    locations=[
        "aws:eu-west-3",
    ],
    message="",
    name="Example test name",
    options=SyntheticsTestOptions(
        ci=SyntheticsTestCiOptions(
            execution_rule=SyntheticsTestExecutionRule.BLOCKING,
        ),
        device_ids=[
            SyntheticsDeviceID.CHROME_LAPTOP_LARGE,
        ],
        http_version=SyntheticsTestOptionsHTTPVersion.HTTP1,
        monitor_options=SyntheticsTestOptionsMonitorOptions(),
        restricted_roles=SyntheticsRestrictedRoles(
            [
                "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
            ]
        ),
        retry=SyntheticsTestOptionsRetry(),
        rum_settings=SyntheticsBrowserTestRumSettings(
            application_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
            client_token_id=12345,
            is_enabled=True,
        ),
        scheduling=SyntheticsTestOptionsScheduling(
            timeframes=[
                SyntheticsTestOptionsSchedulingTimeframe(
                    day=1,
                    _from="07:00",
                    to="16:00",
                ),
                SyntheticsTestOptionsSchedulingTimeframe(
                    day=3,
                    _from="07:00",
                    to="16:00",
                ),
            ],
            timezone="America/New_York",
        ),
    ),
    status=SyntheticsTestPauseStatus.LIVE,
    steps=[
        SyntheticsStep(
            type=SyntheticsStepType.ASSERT_ELEMENT_CONTENT,
        ),
    ],
    tags=[
        "env:prod",
    ],
    type=SyntheticsBrowserTestType.BROWSER,
)

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

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Edit a browser test returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new

body = DatadogAPIClient::V1::SyntheticsBrowserTest.new({
  config: DatadogAPIClient::V1::SyntheticsBrowserTestConfig.new({
    assertions: [],
    config_variables: [
      DatadogAPIClient::V1::SyntheticsConfigVariable.new({
        name: "VARIABLE_NAME",
        secure: false,
        type: DatadogAPIClient::V1::SyntheticsConfigVariableType::TEXT,
      }),
    ],
    request: DatadogAPIClient::V1::SyntheticsTestRequest.new({
      basic_auth: DatadogAPIClient::V1::SyntheticsBasicAuthWeb.new({
        password: "PaSSw0RD!",
        type: DatadogAPIClient::V1::SyntheticsBasicAuthWebType::WEB,
        username: "my_username",
      }),
      body_type: DatadogAPIClient::V1::SyntheticsTestRequestBodyType::TEXT_PLAIN,
      call_type: DatadogAPIClient::V1::SyntheticsTestCallType::UNARY,
      certificate: DatadogAPIClient::V1::SyntheticsTestRequestCertificate.new({
        cert: DatadogAPIClient::V1::SyntheticsTestRequestCertificateItem.new({}),
        key: DatadogAPIClient::V1::SyntheticsTestRequestCertificateItem.new({}),
      }),
      certificate_domains: [],
      files: [
        DatadogAPIClient::V1::SyntheticsTestRequestBodyFile.new({}),
      ],
      http_version: DatadogAPIClient::V1::SyntheticsTestOptionsHTTPVersion::HTTP1,
      proxy: DatadogAPIClient::V1::SyntheticsTestRequestProxy.new({
        url: "https://example.com",
      }),
      service: "Greeter",
      url: "https://example.com",
    }),
    variables: [
      DatadogAPIClient::V1::SyntheticsBrowserVariable.new({
        name: "VARIABLE_NAME",
        type: DatadogAPIClient::V1::SyntheticsBrowserVariableType::TEXT,
      }),
    ],
  }),
  locations: [
    "aws:eu-west-3",
  ],
  message: "",
  name: "Example test name",
  options: DatadogAPIClient::V1::SyntheticsTestOptions.new({
    ci: DatadogAPIClient::V1::SyntheticsTestCiOptions.new({
      execution_rule: DatadogAPIClient::V1::SyntheticsTestExecutionRule::BLOCKING,
    }),
    device_ids: [
      DatadogAPIClient::V1::SyntheticsDeviceID::CHROME_LAPTOP_LARGE,
    ],
    http_version: DatadogAPIClient::V1::SyntheticsTestOptionsHTTPVersion::HTTP1,
    monitor_options: DatadogAPIClient::V1::SyntheticsTestOptionsMonitorOptions.new({}),
    restricted_roles: [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    ],
    _retry: DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({}),
    rum_settings: DatadogAPIClient::V1::SyntheticsBrowserTestRumSettings.new({
      application_id: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      client_token_id: 12345,
      is_enabled: true,
    }),
    scheduling: DatadogAPIClient::V1::SyntheticsTestOptionsScheduling.new({
      timeframes: [
        DatadogAPIClient::V1::SyntheticsTestOptionsSchedulingTimeframe.new({
          day: 1,
          from: "07:00",
          to: "16:00",
        }),
        DatadogAPIClient::V1::SyntheticsTestOptionsSchedulingTimeframe.new({
          day: 3,
          from: "07:00",
          to: "16:00",
        }),
      ],
      timezone: "America/New_York",
    }),
  }),
  status: DatadogAPIClient::V1::SyntheticsTestPauseStatus::LIVE,
  steps: [
    DatadogAPIClient::V1::SyntheticsStep.new({
      type: DatadogAPIClient::V1::SyntheticsStepType::ASSERT_ELEMENT_CONTENT,
    }),
  ],
  tags: [
    "env:prod",
  ],
  type: DatadogAPIClient::V1::SyntheticsBrowserTestType::BROWSER,
})
p api_instance.update_browser_test("public_id", body)

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Edit a browser test 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/datadogV1"
)

func main() {
	body := datadogV1.SyntheticsBrowserTest{
		Config: datadogV1.SyntheticsBrowserTestConfig{
			Assertions: []datadogV1.SyntheticsAssertion{},
			ConfigVariables: []datadogV1.SyntheticsConfigVariable{
				{
					Name:   "VARIABLE_NAME",
					Secure: datadog.PtrBool(false),
					Type:   datadogV1.SYNTHETICSCONFIGVARIABLETYPE_TEXT,
				},
			},
			Request: datadogV1.SyntheticsTestRequest{
				BasicAuth: &datadogV1.SyntheticsBasicAuth{
					SyntheticsBasicAuthWeb: &datadogV1.SyntheticsBasicAuthWeb{
						Password: "PaSSw0RD!",
						Type:     datadogV1.SYNTHETICSBASICAUTHWEBTYPE_WEB.Ptr(),
						Username: "my_username",
					}},
				BodyType: datadogV1.SYNTHETICSTESTREQUESTBODYTYPE_TEXT_PLAIN.Ptr(),
				CallType: datadogV1.SYNTHETICSTESTCALLTYPE_UNARY.Ptr(),
				Certificate: &datadogV1.SyntheticsTestRequestCertificate{
					Cert: &datadogV1.SyntheticsTestRequestCertificateItem{},
					Key:  &datadogV1.SyntheticsTestRequestCertificateItem{},
				},
				CertificateDomains: []string{},
				Files: []datadogV1.SyntheticsTestRequestBodyFile{
					{},
				},
				HttpVersion: datadogV1.SYNTHETICSTESTOPTIONSHTTPVERSION_HTTP1.Ptr(),
				Proxy: &datadogV1.SyntheticsTestRequestProxy{
					Url: "https://example.com",
				},
				Service: datadog.PtrString("Greeter"),
				Url:     datadog.PtrString("https://example.com"),
			},
			Variables: []datadogV1.SyntheticsBrowserVariable{
				{
					Name: "VARIABLE_NAME",
					Type: datadogV1.SYNTHETICSBROWSERVARIABLETYPE_TEXT,
				},
			},
		},
		Locations: []string{
			"aws:eu-west-3",
		},
		Message: "",
		Name:    "Example test name",
		Options: datadogV1.SyntheticsTestOptions{
			Ci: &datadogV1.SyntheticsTestCiOptions{
				ExecutionRule: datadogV1.SYNTHETICSTESTEXECUTIONRULE_BLOCKING.Ptr(),
			},
			DeviceIds: []datadogV1.SyntheticsDeviceID{
				datadogV1.SYNTHETICSDEVICEID_CHROME_LAPTOP_LARGE,
			},
			HttpVersion:    datadogV1.SYNTHETICSTESTOPTIONSHTTPVERSION_HTTP1.Ptr(),
			MonitorOptions: &datadogV1.SyntheticsTestOptionsMonitorOptions{},
			RestrictedRoles: []string{
				"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
			},
			Retry: &datadogV1.SyntheticsTestOptionsRetry{},
			RumSettings: &datadogV1.SyntheticsBrowserTestRumSettings{
				ApplicationId: datadog.PtrString("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"),
				ClientTokenId: datadog.PtrInt64(12345),
				IsEnabled:     true,
			},
			Scheduling: &datadogV1.SyntheticsTestOptionsScheduling{
				Timeframes: []datadogV1.SyntheticsTestOptionsSchedulingTimeframe{
					{
						Day:  datadog.PtrInt32(1),
						From: datadog.PtrString("07:00"),
						To:   datadog.PtrString("16:00"),
					},
					{
						Day:  datadog.PtrInt32(3),
						From: datadog.PtrString("07:00"),
						To:   datadog.PtrString("16:00"),
					},
				},
				Timezone: datadog.PtrString("America/New_York"),
			},
		},
		Status: datadogV1.SYNTHETICSTESTPAUSESTATUS_LIVE.Ptr(),
		Steps: []datadogV1.SyntheticsStep{
			{
				Type: datadogV1.SYNTHETICSSTEPTYPE_ASSERT_ELEMENT_CONTENT.Ptr(),
			},
		},
		Tags: []string{
			"env:prod",
		},
		Type: datadogV1.SYNTHETICSBROWSERTESTTYPE_BROWSER,
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.UpdateBrowserTest(ctx, "public_id", body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.UpdateBrowserTest`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Edit a browser test returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsBasicAuth;
import com.datadog.api.client.v1.model.SyntheticsBasicAuthWeb;
import com.datadog.api.client.v1.model.SyntheticsBasicAuthWebType;
import com.datadog.api.client.v1.model.SyntheticsBrowserTest;
import com.datadog.api.client.v1.model.SyntheticsBrowserTestConfig;
import com.datadog.api.client.v1.model.SyntheticsBrowserTestRumSettings;
import com.datadog.api.client.v1.model.SyntheticsBrowserTestType;
import com.datadog.api.client.v1.model.SyntheticsBrowserVariable;
import com.datadog.api.client.v1.model.SyntheticsBrowserVariableType;
import com.datadog.api.client.v1.model.SyntheticsConfigVariable;
import com.datadog.api.client.v1.model.SyntheticsConfigVariableType;
import com.datadog.api.client.v1.model.SyntheticsDeviceID;
import com.datadog.api.client.v1.model.SyntheticsStep;
import com.datadog.api.client.v1.model.SyntheticsStepType;
import com.datadog.api.client.v1.model.SyntheticsTestCallType;
import com.datadog.api.client.v1.model.SyntheticsTestCiOptions;
import com.datadog.api.client.v1.model.SyntheticsTestExecutionRule;
import com.datadog.api.client.v1.model.SyntheticsTestOptions;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsHTTPVersion;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsMonitorOptions;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsRetry;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsScheduling;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsSchedulingTimeframe;
import com.datadog.api.client.v1.model.SyntheticsTestPauseStatus;
import com.datadog.api.client.v1.model.SyntheticsTestRequest;
import com.datadog.api.client.v1.model.SyntheticsTestRequestBodyFile;
import com.datadog.api.client.v1.model.SyntheticsTestRequestBodyType;
import com.datadog.api.client.v1.model.SyntheticsTestRequestCertificate;
import com.datadog.api.client.v1.model.SyntheticsTestRequestCertificateItem;
import com.datadog.api.client.v1.model.SyntheticsTestRequestProxy;
import java.util.Arrays;
import java.util.Collections;

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

    SyntheticsBrowserTest body =
        new SyntheticsBrowserTest()
            .config(
                new SyntheticsBrowserTestConfig()
                    .configVariables(
                        Collections.singletonList(
                            new SyntheticsConfigVariable()
                                .name("VARIABLE_NAME")
                                .secure(false)
                                .type(SyntheticsConfigVariableType.TEXT)))
                    .request(
                        new SyntheticsTestRequest()
                            .basicAuth(
                                new SyntheticsBasicAuth(
                                    new SyntheticsBasicAuthWeb()
                                        .password("PaSSw0RD!")
                                        .type(SyntheticsBasicAuthWebType.WEB)
                                        .username("my_username")))
                            .bodyType(SyntheticsTestRequestBodyType.TEXT_PLAIN)
                            .callType(SyntheticsTestCallType.UNARY)
                            .certificate(
                                new SyntheticsTestRequestCertificate()
                                    .cert(new SyntheticsTestRequestCertificateItem())
                                    .key(new SyntheticsTestRequestCertificateItem()))
                            .files(Collections.singletonList(new SyntheticsTestRequestBodyFile()))
                            .httpVersion(SyntheticsTestOptionsHTTPVersion.HTTP1)
                            .proxy(new SyntheticsTestRequestProxy().url("https://example.com"))
                            .service("Greeter")
                            .url("https://example.com"))
                    .variables(
                        Collections.singletonList(
                            new SyntheticsBrowserVariable()
                                .name("VARIABLE_NAME")
                                .type(SyntheticsBrowserVariableType.TEXT))))
            .locations(Collections.singletonList("aws:eu-west-3"))
            .message("")
            .name("Example test name")
            .options(
                new SyntheticsTestOptions()
                    .ci(
                        new SyntheticsTestCiOptions()
                            .executionRule(SyntheticsTestExecutionRule.BLOCKING))
                    .deviceIds(Collections.singletonList(SyntheticsDeviceID.CHROME_LAPTOP_LARGE))
                    .httpVersion(SyntheticsTestOptionsHTTPVersion.HTTP1)
                    .monitorOptions(new SyntheticsTestOptionsMonitorOptions())
                    .restrictedRoles(
                        Collections.singletonList("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"))
                    .retry(new SyntheticsTestOptionsRetry())
                    .rumSettings(
                        new SyntheticsBrowserTestRumSettings()
                            .applicationId("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")
                            .clientTokenId(12345L)
                            .isEnabled(true))
                    .scheduling(
                        new SyntheticsTestOptionsScheduling()
                            .timeframes(
                                Arrays.asList(
                                    new SyntheticsTestOptionsSchedulingTimeframe()
                                        .day(1)
                                        .from("07:00")
                                        .to("16:00"),
                                    new SyntheticsTestOptionsSchedulingTimeframe()
                                        .day(3)
                                        .from("07:00")
                                        .to("16:00")))
                            .timezone("America/New_York")))
            .status(SyntheticsTestPauseStatus.LIVE)
            .steps(
                Collections.singletonList(
                    new SyntheticsStep().type(SyntheticsStepType.ASSERT_ELEMENT_CONTENT)))
            .tags(Collections.singletonList("env:prod"))
            .type(SyntheticsBrowserTestType.BROWSER);

    try {
      SyntheticsBrowserTest result = apiInstance.updateBrowserTest("public_id", body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#updateBrowserTest");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Edit a browser test returns "OK" response
 */

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

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

const params: v1.SyntheticsApiUpdateBrowserTestRequest = {
  body: {
    config: {
      assertions: [],
      configVariables: [
        {
          name: "VARIABLE_NAME",
          secure: false,
          type: "text",
        },
      ],
      request: {
        basicAuth: {
          password: "PaSSw0RD!",
          type: "web",
          username: "my_username",
        },
        bodyType: "text/plain",
        callType: "unary",
        certificate: {
          cert: {},
          key: {},
        },
        certificateDomains: [],
        files: [{}],
        httpVersion: "http1",
        proxy: {
          url: "https://example.com",
        },
        service: "Greeter",
        url: "https://example.com",
      },
      variables: [
        {
          name: "VARIABLE_NAME",
          type: "text",
        },
      ],
    },
    locations: ["aws:eu-west-3"],
    message: "",
    name: "Example test name",
    options: {
      ci: {
        executionRule: "blocking",
      },
      deviceIds: ["chrome.laptop_large"],
      httpVersion: "http1",
      monitorOptions: {},
      restrictedRoles: ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"],
      retry: {},
      rumSettings: {
        applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        clientTokenId: 12345,
        isEnabled: true,
      },
      scheduling: {
        timeframes: [
          {
            day: 1,
            from: "07:00",
            to: "16:00",
          },
          {
            day: 3,
            from: "07:00",
            to: "16:00",
          },
        ],
        timezone: "America/New_York",
      },
    },
    status: "live",
    steps: [
      {
        type: "assertElementContent",
      },
    ],
    tags: ["env:prod"],
    type: "browser",
  },
  publicId: "public_id",
};

apiInstance
  .updateBrowserTest(params)
  .then((data: v1.SyntheticsBrowserTest) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

PATCH https://api.ap1.datadoghq.com/api/v1/synthetics/tests/{public_id}https://api.datadoghq.eu/api/v1/synthetics/tests/{public_id}https://api.ddog-gov.com/api/v1/synthetics/tests/{public_id}https://api.datadoghq.com/api/v1/synthetics/tests/{public_id}https://api.us3.datadoghq.com/api/v1/synthetics/tests/{public_id}https://api.us5.datadoghq.com/api/v1/synthetics/tests/{public_id}

概要

部分的なデータを使用して Synthetic テストの構成をパッチします。 This endpoint requires the synthetics_write authorization scope.

引数

パスパラメーター

名前

種類

説明

public_id [required]

string

The public ID of the test to patch.

リクエスト

Body Data (required)

JSON Patch 準拠の操作リスト

Expand All

フィールド

種類

説明

data

[object]

Array of JSON Patch operations to perform on the test

op

enum

The operation to perform Allowed enum values: add,remove,replace,move,copy,test

path

string

The path to the value to modify

value

A value to use in a JSON Patch operation

{
  "data": [
    {
      "op": "replace",
      "path": "/name",
      "value": "New test name"
    },
    {
      "op": "remove",
      "path": "/config/assertions/0"
    }
  ]
}

応答

OK

Object containing details about your Synthetic test.

Expand All

フィールド

種類

説明

config

object

Configuration object for a Synthetic test.

assertions

[ <oneOf>]

Array of assertions used for the test. Required for single API tests.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

configVariables

[object]

Array of variables used for the test.

example

string

Example for the variable.

id

string

ID of the variable for global variables.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Whether the value of this variable will be obfuscated in test results. Only for config variables of type text.

type [required]

enum

Type of the configuration variable. Allowed enum values: global,text

request

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

variables

[object]

Browser tests only - array of variables used for the test steps.

example

string

Example for the variable.

id

string

ID for the variable. Global variables require an ID.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Determines whether or not the browser test variable is obfuscated. Can only be used with browser variables of type text.

type [required]

enum

Type of browser test variable. Allowed enum values: element,email,global,javascript,text

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

locations

[string]

Array of locations used to run the test.

message

string

Notification message associated with the test.

monitor_id

int64

The associated monitor ID.

name

string

Name of the test.

options

object

Object describing the extra options for a Synthetic test.

accept_self_signed

boolean

For SSL test, whether or not the test should allow self signed certificates.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in an API test.

checkCertificateRevocation

boolean

For SSL test, whether or not the test should fail on revoked certificate in stapled OCSP.

ci

object

CI/CD options for a Synthetic test.

executionRule

enum

Execution rule for a Synthetic test. Allowed enum values: blocking,non_blocking,skipped

device_ids

[string]

For browser test, array with the different device IDs used to run the test.

disableCors

boolean

Whether or not to disable CORS mechanism.

disableCsp

boolean

Disable Content Security Policy for browser tests.

enableProfiling

boolean

Enable profiling for browser tests.

enableSecurityTesting

boolean

DEPRECATED: Enable security testing for browser tests. Security testing is not available anymore. This field is deprecated and won't be used.

follow_redirects

boolean

For API HTTP test, whether or not the test should follow redirects.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

ignoreServerCertificateError

boolean

Ignore server certificate error for browser tests.

initialNavigationTimeout

int64

Timeout before declaring the initial step as failed (in seconds) for browser tests.

min_failure_duration

int64

Minimum amount of time in failure required to trigger an alert.

min_location_failed

int64

Minimum number of locations in failure required to trigger an alert.

monitor_name

string

The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.

monitor_options

object

Object containing the options for a Synthetic test as a monitor (for example, renotification).

renotify_interval

int64

Time interval before renotifying if the test is still failing (in minutes).

monitor_priority

int32

Integer from 1 (high) to 5 (low) indicating alert severity.

noScreenshot

boolean

Prevents saving screenshots of the steps.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

rumSettings

object

The RUM data collection settings for the Synthetic browser test. Note: There are 3 ways to format RUM settings:

{ isEnabled: false } RUM data is not collected.

{ isEnabled: true } RUM data is collected from the Synthetic test's default application.

{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 } RUM data is collected using the specified application.

applicationId

string

RUM application ID used to collect RUM data for the browser test.

clientTokenId

int64

RUM application API key ID used to collect RUM data for the browser test.

isEnabled [required]

boolean

Determines whether RUM data is collected during test runs.

scheduling

object

Object containing timeframes and timezone used for advanced scheduling.

timeframes

[object]

Array containing objects describing the scheduling pattern to apply to each day.

day

int32

Number representing the day of the week.

from

string

The hour of the day on which scheduling starts.

to

string

The hour of the day on which scheduling ends.

timezone

string

Timezone in which the timeframe is based.

tick_every

int64

The frequency at which to run the Synthetic test (in seconds).

public_id

string

The test public ID.

status

enum

Define whether you want to start (live) or pause (paused) a Synthetic test. Allowed enum values: live,paused

steps

[object]

For browser test, the steps of the test.

allowFailure

boolean

A boolean set to allow this step to fail.

isCritical

boolean

A boolean to use in addition to allowFailure to determine if the test should be marked as failed when the step fails.

name

string

The name of the step.

noScreenshot

boolean

A boolean set to not take a screenshot for the step.

params

object

The parameters of the step.

timeout

int64

The time before declaring a step failed.

type

enum

Step type used in your Synthetic test. Allowed enum values: assertCurrentUrl,assertElementAttribute,assertElementContent,assertElementPresent,assertEmail,assertFileDownload,assertFromJavascript,assertPageContains,assertPageLacks,click,extractFromJavascript,extractVariable,goToEmailLink,goToUrl,goToUrlAndMeasureTti,hover,playSubTest,pressKey,refresh,runApiTest,scroll,selectOption,typeText,uploadFiles,wait

subtype

enum

The subtype of the Synthetic API test, http, ssl, tcp, dns, icmp, udp, websocket, grpc or multi. Allowed enum values: http,ssl,tcp,dns,multi,icmp,udp,websocket,grpc

tags

[string]

Array of tags attached to the test.

type

enum

Type of the Synthetic test, either api or browser. Allowed enum values: api,browser

{
  "config": {
    "assertions": [
      {
        "operator": "contains",
        "property": "string",
        "target": 123456,
        "timingsScope": "string",
        "type": "statusCode"
      }
    ],
    "configVariables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ],
    "request": {
      "allow_insecure": false,
      "basicAuth": {
        "password": "PaSSw0RD!",
        "type": "web",
        "username": "my_username"
      },
      "body": "string",
      "bodyType": "text/plain",
      "callType": "unary",
      "certificate": {
        "cert": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        },
        "key": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        }
      },
      "certificateDomains": [],
      "compressedJsonDescriptor": "string",
      "compressedProtoFile": "string",
      "dnsServer": "string",
      "dnsServerPort": "integer",
      "files": [
        {
          "bucketKey": "string",
          "content": "string",
          "name": "string",
          "originalFileName": "string",
          "size": "integer",
          "type": "string"
        }
      ],
      "follow_redirects": false,
      "headers": {
        "<any-key>": "string"
      },
      "host": "string",
      "httpVersion": "string",
      "message": "string",
      "metadata": {
        "<any-key>": "string"
      },
      "method": "string",
      "noSavingResponseBody": false,
      "numberOfPackets": "integer",
      "persistCookies": false,
      "port": "integer",
      "proxy": {
        "headers": {
          "<any-key>": "string"
        },
        "url": "https://example.com"
      },
      "query": {},
      "servername": "string",
      "service": "Greeter",
      "shouldTrackHops": false,
      "timeout": "number",
      "url": "https://example.com"
    },
    "variables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ]
  },
  "creator": {
    "email": "string",
    "handle": "string",
    "name": "string"
  },
  "locations": [
    "aws:eu-west-3"
  ],
  "message": "string",
  "monitor_id": "integer",
  "name": "string",
  "options": {
    "accept_self_signed": false,
    "allow_insecure": false,
    "checkCertificateRevocation": false,
    "ci": {
      "executionRule": "string"
    },
    "device_ids": [
      "chrome.laptop_large"
    ],
    "disableCors": false,
    "disableCsp": false,
    "enableProfiling": false,
    "enableSecurityTesting": false,
    "follow_redirects": false,
    "httpVersion": "string",
    "ignoreServerCertificateError": false,
    "initialNavigationTimeout": "integer",
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "monitor_name": "string",
    "monitor_options": {
      "renotify_interval": "integer"
    },
    "monitor_priority": "integer",
    "noScreenshot": false,
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ],
    "retry": {
      "count": "integer",
      "interval": "number"
    },
    "rumSettings": {
      "applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "clientTokenId": 12345,
      "isEnabled": true
    },
    "scheduling": {
      "timeframes": [
        {
          "day": 1,
          "from": "07:00",
          "to": "16:00"
        }
      ],
      "timezone": "America/New_York"
    },
    "tick_every": "integer"
  },
  "public_id": "string",
  "status": "live",
  "steps": [
    {
      "allowFailure": false,
      "isCritical": false,
      "name": "string",
      "noScreenshot": false,
      "params": {},
      "timeout": "integer",
      "type": "assertElementContent"
    }
  ],
  "subtype": "http",
  "tags": [],
  "type": "string"
}

- JSON format is wrong - Updating sub-type is forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

- Synthetic Monitoring is not activated for the user - Test is not owned by the user - Test can't be found

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                          # Path parameters
export public_id="CHANGE_ME"
# Curl command
curl -X PATCH "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/tests/${public_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": [ { "op": "replace", "path": "/name", "value": "New test name" }, { "op": "remove", "path": "/config/assertions/0" } ] } EOF
// Patch a Synthetic test 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/datadogV1"
)

func main() {
	// there is a valid "synthetics_api_test" in the system
	SyntheticsAPITestPublicID := os.Getenv("SYNTHETICS_API_TEST_PUBLIC_ID")

	body := datadogV1.SyntheticsPatchTestBody{
		Data: []datadogV1.SyntheticsPatchTestOperation{
			{
				Op:    datadogV1.SYNTHETICSPATCHTESTOPERATIONNAME_REPLACE.Ptr(),
				Path:  datadog.PtrString("/name"),
				Value: "New test name",
			},
			{
				Op:   datadogV1.SYNTHETICSPATCHTESTOPERATIONNAME_REMOVE.Ptr(),
				Path: datadog.PtrString("/config/assertions/0"),
			},
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.PatchTest(ctx, SyntheticsAPITestPublicID, body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.PatchTest`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Patch a Synthetic test returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsPatchTestBody;
import com.datadog.api.client.v1.model.SyntheticsPatchTestOperation;
import com.datadog.api.client.v1.model.SyntheticsPatchTestOperationName;
import com.datadog.api.client.v1.model.SyntheticsTestDetails;
import java.util.Arrays;

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

    // there is a valid "synthetics_api_test" in the system
    String SYNTHETICS_API_TEST_PUBLIC_ID = System.getenv("SYNTHETICS_API_TEST_PUBLIC_ID");

    SyntheticsPatchTestBody body =
        new SyntheticsPatchTestBody()
            .data(
                Arrays.asList(
                    new SyntheticsPatchTestOperation()
                        .op(SyntheticsPatchTestOperationName.REPLACE)
                        .path("/name")
                        .value("New test name"),
                    new SyntheticsPatchTestOperation()
                        .op(SyntheticsPatchTestOperationName.REMOVE)
                        .path("/config/assertions/0")));

    try {
      SyntheticsTestDetails result = apiInstance.patchTest(SYNTHETICS_API_TEST_PUBLIC_ID, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#patchTest");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Patch a Synthetic test returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_patch_test_body import SyntheticsPatchTestBody
from datadog_api_client.v1.model.synthetics_patch_test_operation import SyntheticsPatchTestOperation
from datadog_api_client.v1.model.synthetics_patch_test_operation_name import SyntheticsPatchTestOperationName

# there is a valid "synthetics_api_test" in the system
SYNTHETICS_API_TEST_PUBLIC_ID = environ["SYNTHETICS_API_TEST_PUBLIC_ID"]

body = SyntheticsPatchTestBody(
    data=[
        SyntheticsPatchTestOperation(
            op=SyntheticsPatchTestOperationName.REPLACE,
            path="/name",
            value="New test name",
        ),
        SyntheticsPatchTestOperation(
            op=SyntheticsPatchTestOperationName.REMOVE,
            path="/config/assertions/0",
        ),
    ],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.patch_test(public_id=SYNTHETICS_API_TEST_PUBLIC_ID, body=body)

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Patch a Synthetic test returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new

# there is a valid "synthetics_api_test" in the system
SYNTHETICS_API_TEST_PUBLIC_ID = ENV["SYNTHETICS_API_TEST_PUBLIC_ID"]

body = DatadogAPIClient::V1::SyntheticsPatchTestBody.new({
  data: [
    DatadogAPIClient::V1::SyntheticsPatchTestOperation.new({
      op: DatadogAPIClient::V1::SyntheticsPatchTestOperationName::REPLACE,
      path: "/name",
      value: "New test name",
    }),
    DatadogAPIClient::V1::SyntheticsPatchTestOperation.new({
      op: DatadogAPIClient::V1::SyntheticsPatchTestOperationName::REMOVE,
      path: "/config/assertions/0",
    }),
  ],
})
p api_instance.patch_test(SYNTHETICS_API_TEST_PUBLIC_ID, body)

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
/**
 * Patch a Synthetic test returns "OK" response
 */

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

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

// there is a valid "synthetics_api_test" in the system
const SYNTHETICS_API_TEST_PUBLIC_ID = process.env
  .SYNTHETICS_API_TEST_PUBLIC_ID as string;

const params: v1.SyntheticsApiPatchTestRequest = {
  body: {
    data: [
      {
        op: "replace",
        path: "/name",
        value: "New test name",
      },
      {
        op: "remove",
        path: "/config/assertions/0",
      },
    ],
  },
  publicId: SYNTHETICS_API_TEST_PUBLIC_ID,
};

apiInstance
  .patchTest(params)
  .then((data: v1.SyntheticsTestDetails) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

PUT https://api.ap1.datadoghq.com/api/v1/synthetics/tests/{public_id}/statushttps://api.datadoghq.eu/api/v1/synthetics/tests/{public_id}/statushttps://api.ddog-gov.com/api/v1/synthetics/tests/{public_id}/statushttps://api.datadoghq.com/api/v1/synthetics/tests/{public_id}/statushttps://api.us3.datadoghq.com/api/v1/synthetics/tests/{public_id}/statushttps://api.us5.datadoghq.com/api/v1/synthetics/tests/{public_id}/status

概要

Synthetic テストのステータスを変更し、一時停止または開始します。 This endpoint requires the synthetics_write authorization scope.

引数

パスパラメーター

名前

種類

説明

public_id [required]

string

The public ID of the Synthetic test to update.

リクエスト

Body Data (required)

特定の Synthetic テストに設定されるステータス。

Expand All

フィールド

種類

説明

new_status

enum

Define whether you want to start (live) or pause (paused) a Synthetic test. Allowed enum values: live,paused

{
  "new_status": "live"
}

応答

OK - Returns a boolean indicating if the update was successful.

Expand All

フィールド

種類

説明

No response body

{}

JSON format is wrong.

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

- Synthetic Monitoring is not activated for the user - Test is not owned by the user

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                  # Path parameters
export public_id="CHANGE_ME"
# Curl command
curl -X PUT "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/tests/${public_id}/status" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF {} EOF
"""
Pause or start a test returns "OK - Returns a boolean indicating if the update was successful." response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_test_pause_status import SyntheticsTestPauseStatus
from datadog_api_client.v1.model.synthetics_update_test_pause_status_payload import (
    SyntheticsUpdateTestPauseStatusPayload,
)

body = SyntheticsUpdateTestPauseStatusPayload(
    new_status=SyntheticsTestPauseStatus.LIVE,
)

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

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Pause or start a test returns "OK - Returns a boolean indicating if the update was successful." response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new

body = DatadogAPIClient::V1::SyntheticsUpdateTestPauseStatusPayload.new({
  new_status: DatadogAPIClient::V1::SyntheticsTestPauseStatus::LIVE,
})
p api_instance.update_test_pause_status("public_id", body)

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Pause or start a test returns "OK - Returns a boolean indicating if the update was successful." 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/datadogV1"
)

func main() {
	body := datadogV1.SyntheticsUpdateTestPauseStatusPayload{
		NewStatus: datadogV1.SYNTHETICSTESTPAUSESTATUS_LIVE.Ptr(),
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.UpdateTestPauseStatus(ctx, "public_id", body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.UpdateTestPauseStatus`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Pause or start a test returns "OK - Returns a boolean indicating if the update was successful."
// response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsTestPauseStatus;
import com.datadog.api.client.v1.model.SyntheticsUpdateTestPauseStatusPayload;

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

    SyntheticsUpdateTestPauseStatusPayload body =
        new SyntheticsUpdateTestPauseStatusPayload().newStatus(SyntheticsTestPauseStatus.LIVE);

    try {
      Boolean result = apiInstance.updateTestPauseStatus("public_id", body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#updateTestPauseStatus");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Pause or start a test returns "OK - Returns a boolean indicating if the update was successful." response
 */

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

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

const params: v1.SyntheticsApiUpdateTestPauseStatusRequest = {
  body: {
    newStatus: "live",
  },
  publicId: "public_id",
};

apiInstance
  .updateTestPauseStatus(params)
  .then((data: boolean) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v1/synthetics/tests/trigger/cihttps://api.datadoghq.eu/api/v1/synthetics/tests/trigger/cihttps://api.ddog-gov.com/api/v1/synthetics/tests/trigger/cihttps://api.datadoghq.com/api/v1/synthetics/tests/trigger/cihttps://api.us3.datadoghq.com/api/v1/synthetics/tests/trigger/cihttps://api.us5.datadoghq.com/api/v1/synthetics/tests/trigger/ci

概要

継続的なインテグレーションに向けた一連の Synthetic テストをトリガーします。 This endpoint requires the synthetics_write authorization scope.

リクエスト

Body Data (required)

トリガーするテストの詳細。

Expand All

フィールド

種類

説明

tests

[object]

Individual synthetics test.

allowInsecureCertificates

boolean

Disable certificate checks in API tests.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

string

Type of the data sent in a Synthetic API test.

cookies

string

Cookies for the request.

deviceIds

[string]

For browser test, array with the different device IDs used to run the test.

followRedirects

boolean

For API HTTP test, whether or not the test should follow redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

locations

[string]

Array of locations used to run the test.

metadata

object

Metadata for the Synthetic tests run.

ci

object

Description of the CI provider.

pipeline

object

Description of the CI pipeline.

url

string

URL of the pipeline.

provider

object

Description of the CI provider.

name

string

Name of the CI provider.

git

object

Git information.

branch

string

Branch name.

commitSha

string

The commit SHA.

public_id [required]

string

The public ID of the Synthetic test to trigger.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

startUrl

string

Starting URL for the browser test.

variables

object

Variables to replace in the test.

<any-key>

string

A single variable.

{
  "tests": [
    {
      "allowInsecureCertificates": false,
      "basicAuth": {
        "password": "PaSSw0RD!",
        "type": "web",
        "username": "my_username"
      },
      "body": "string",
      "bodyType": "string",
      "cookies": "string",
      "deviceIds": [
        "chrome.laptop_large"
      ],
      "followRedirects": false,
      "headers": {
        "<any-key>": "string"
      },
      "locations": [
        "aws:eu-west-3"
      ],
      "metadata": {
        "ci": {
          "pipeline": {
            "url": "string"
          },
          "provider": {
            "name": "string"
          }
        },
        "git": {
          "branch": "string",
          "commitSha": "string"
        }
      },
      "public_id": "aaa-aaa-aaa",
      "retry": {
        "count": "integer",
        "interval": "number"
      },
      "startUrl": "string",
      "variables": {
        "<any-key>": "string"
      }
    }
  ]
}

応答

OK

Object containing information about the tests triggered.

Expand All

フィールド

種類

説明

batch_id

string

The public ID of the batch triggered.

locations

[object]

List of Synthetic locations.

id

int64

Unique identifier of the location.

name

string

Name of the location.

results

[object]

Information about the tests runs.

device

enum

The device ID. Allowed enum values: laptop_large,tablet,mobile_small,chrome.laptop_large,chrome.tablet,chrome.mobile_small,firefox.laptop_large,firefox.tablet,firefox.mobile_small,edge.laptop_large,edge.tablet,edge.mobile_small

location

int64

The location ID of the test run.

public_id

string

The public ID of the Synthetic test.

result_id

string

ID of the result.

triggered_check_ids

[string]

The public IDs of the Synthetic test triggered.

{
  "batch_id": "string",
  "locations": [
    {
      "id": "integer",
      "name": "string"
    }
  ],
  "results": [
    {
      "device": "chrome.laptop_large",
      "location": "integer",
      "public_id": "string",
      "result_id": "string"
    }
  ],
  "triggered_check_ids": []
}

JSON format is wrong

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                  # Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/tests/trigger/ci" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "tests": [ { "public_id": "aaa-aaa-aaa" } ] } EOF
"""
Trigger tests from CI/CD pipelines returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_basic_auth_web import SyntheticsBasicAuthWeb
from datadog_api_client.v1.model.synthetics_basic_auth_web_type import SyntheticsBasicAuthWebType
from datadog_api_client.v1.model.synthetics_ci_batch_metadata import SyntheticsCIBatchMetadata
from datadog_api_client.v1.model.synthetics_ci_batch_metadata_ci import SyntheticsCIBatchMetadataCI
from datadog_api_client.v1.model.synthetics_ci_batch_metadata_git import SyntheticsCIBatchMetadataGit
from datadog_api_client.v1.model.synthetics_ci_batch_metadata_pipeline import SyntheticsCIBatchMetadataPipeline
from datadog_api_client.v1.model.synthetics_ci_batch_metadata_provider import SyntheticsCIBatchMetadataProvider
from datadog_api_client.v1.model.synthetics_ci_test import SyntheticsCITest
from datadog_api_client.v1.model.synthetics_ci_test_body import SyntheticsCITestBody
from datadog_api_client.v1.model.synthetics_device_id import SyntheticsDeviceID
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry

body = SyntheticsCITestBody(
    tests=[
        SyntheticsCITest(
            basic_auth=SyntheticsBasicAuthWeb(
                password="PaSSw0RD!",
                type=SyntheticsBasicAuthWebType.WEB,
                username="my_username",
            ),
            device_ids=[
                SyntheticsDeviceID.CHROME_LAPTOP_LARGE,
            ],
            locations=[
                "aws:eu-west-3",
            ],
            metadata=SyntheticsCIBatchMetadata(
                ci=SyntheticsCIBatchMetadataCI(
                    pipeline=SyntheticsCIBatchMetadataPipeline(),
                    provider=SyntheticsCIBatchMetadataProvider(),
                ),
                git=SyntheticsCIBatchMetadataGit(),
            ),
            public_id="aaa-aaa-aaa",
            retry=SyntheticsTestOptionsRetry(),
        ),
    ],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.trigger_ci_tests(body=body)

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Trigger tests from CI/CD pipelines returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new

body = DatadogAPIClient::V1::SyntheticsCITestBody.new({
  tests: [
    DatadogAPIClient::V1::SyntheticsCITest.new({
      basic_auth: DatadogAPIClient::V1::SyntheticsBasicAuthWeb.new({
        password: "PaSSw0RD!",
        type: DatadogAPIClient::V1::SyntheticsBasicAuthWebType::WEB,
        username: "my_username",
      }),
      device_ids: [
        DatadogAPIClient::V1::SyntheticsDeviceID::CHROME_LAPTOP_LARGE,
      ],
      locations: [
        "aws:eu-west-3",
      ],
      metadata: DatadogAPIClient::V1::SyntheticsCIBatchMetadata.new({
        ci: DatadogAPIClient::V1::SyntheticsCIBatchMetadataCI.new({
          pipeline: DatadogAPIClient::V1::SyntheticsCIBatchMetadataPipeline.new({}),
          provider: DatadogAPIClient::V1::SyntheticsCIBatchMetadataProvider.new({}),
        }),
        git: DatadogAPIClient::V1::SyntheticsCIBatchMetadataGit.new({}),
      }),
      public_id: "aaa-aaa-aaa",
      _retry: DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({}),
    }),
  ],
})
p api_instance.trigger_ci_tests(body)

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Trigger tests from CI/CD pipelines 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/datadogV1"
)

func main() {
	body := datadogV1.SyntheticsCITestBody{
		Tests: []datadogV1.SyntheticsCITest{
			{
				BasicAuth: &datadogV1.SyntheticsBasicAuth{
					SyntheticsBasicAuthWeb: &datadogV1.SyntheticsBasicAuthWeb{
						Password: "PaSSw0RD!",
						Type:     datadogV1.SYNTHETICSBASICAUTHWEBTYPE_WEB.Ptr(),
						Username: "my_username",
					}},
				DeviceIds: []datadogV1.SyntheticsDeviceID{
					datadogV1.SYNTHETICSDEVICEID_CHROME_LAPTOP_LARGE,
				},
				Locations: []string{
					"aws:eu-west-3",
				},
				Metadata: &datadogV1.SyntheticsCIBatchMetadata{
					Ci: &datadogV1.SyntheticsCIBatchMetadataCI{
						Pipeline: &datadogV1.SyntheticsCIBatchMetadataPipeline{},
						Provider: &datadogV1.SyntheticsCIBatchMetadataProvider{},
					},
					Git: &datadogV1.SyntheticsCIBatchMetadataGit{},
				},
				PublicId: "aaa-aaa-aaa",
				Retry:    &datadogV1.SyntheticsTestOptionsRetry{},
			},
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.TriggerCITests(ctx, body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.TriggerCITests`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Trigger tests from CI/CD pipelines returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsBasicAuth;
import com.datadog.api.client.v1.model.SyntheticsBasicAuthWeb;
import com.datadog.api.client.v1.model.SyntheticsBasicAuthWebType;
import com.datadog.api.client.v1.model.SyntheticsCIBatchMetadata;
import com.datadog.api.client.v1.model.SyntheticsCIBatchMetadataCI;
import com.datadog.api.client.v1.model.SyntheticsCIBatchMetadataGit;
import com.datadog.api.client.v1.model.SyntheticsCIBatchMetadataPipeline;
import com.datadog.api.client.v1.model.SyntheticsCIBatchMetadataProvider;
import com.datadog.api.client.v1.model.SyntheticsCITest;
import com.datadog.api.client.v1.model.SyntheticsCITestBody;
import com.datadog.api.client.v1.model.SyntheticsDeviceID;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsRetry;
import com.datadog.api.client.v1.model.SyntheticsTriggerCITestsResponse;
import java.util.Collections;

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

    SyntheticsCITestBody body =
        new SyntheticsCITestBody()
            .tests(
                Collections.singletonList(
                    new SyntheticsCITest()
                        .basicAuth(
                            new SyntheticsBasicAuth(
                                new SyntheticsBasicAuthWeb()
                                    .password("PaSSw0RD!")
                                    .type(SyntheticsBasicAuthWebType.WEB)
                                    .username("my_username")))
                        .deviceIds(
                            Collections.singletonList(SyntheticsDeviceID.CHROME_LAPTOP_LARGE))
                        .locations(Collections.singletonList("aws:eu-west-3"))
                        .metadata(
                            new SyntheticsCIBatchMetadata()
                                .ci(
                                    new SyntheticsCIBatchMetadataCI()
                                        .pipeline(new SyntheticsCIBatchMetadataPipeline())
                                        .provider(new SyntheticsCIBatchMetadataProvider()))
                                .git(new SyntheticsCIBatchMetadataGit()))
                        .publicId("aaa-aaa-aaa")
                        .retry(new SyntheticsTestOptionsRetry())));

    try {
      SyntheticsTriggerCITestsResponse result = apiInstance.triggerCITests(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#triggerCITests");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Trigger tests from CI/CD pipelines returns "OK" response
 */

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

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

const params: v1.SyntheticsApiTriggerCITestsRequest = {
  body: {
    tests: [
      {
        basicAuth: {
          password: "PaSSw0RD!",
          type: "web",
          username: "my_username",
        },
        deviceIds: ["chrome.laptop_large"],
        locations: ["aws:eu-west-3"],
        metadata: {
          ci: {
            pipeline: {},
            provider: {},
          },
          git: {},
        },
        publicId: "aaa-aaa-aaa",
        retry: {},
      },
    ],
  },
};

apiInstance
  .triggerCITests(params)
  .then((data: v1.SyntheticsTriggerCITestsResponse) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v1/synthetics/tests/triggerhttps://api.datadoghq.eu/api/v1/synthetics/tests/triggerhttps://api.ddog-gov.com/api/v1/synthetics/tests/triggerhttps://api.datadoghq.com/api/v1/synthetics/tests/triggerhttps://api.us3.datadoghq.com/api/v1/synthetics/tests/triggerhttps://api.us5.datadoghq.com/api/v1/synthetics/tests/trigger

概要

Synthetic テストのセットをトリガーします。 This endpoint requires the synthetics_write authorization scope.

リクエスト

Body Data (required)

トリガーするテストの識別子。

Expand All

フィールド

種類

説明

tests [required]

[object]

Individual Synthetic test.

metadata

object

Metadata for the Synthetic tests run.

ci

object

Description of the CI provider.

pipeline

object

Description of the CI pipeline.

url

string

URL of the pipeline.

provider

object

Description of the CI provider.

name

string

Name of the CI provider.

git

object

Git information.

branch

string

Branch name.

commitSha

string

The commit SHA.

public_id [required]

string

The public ID of the Synthetic test to trigger.

{
  "tests": [
    {
      "public_id": "123-abc-456"
    }
  ]
}

応答

OK

Object containing information about the tests triggered.

Expand All

フィールド

種類

説明

batch_id

string

The public ID of the batch triggered.

locations

[object]

List of Synthetic locations.

id

int64

Unique identifier of the location.

name

string

Name of the location.

results

[object]

Information about the tests runs.

device

enum

The device ID. Allowed enum values: laptop_large,tablet,mobile_small,chrome.laptop_large,chrome.tablet,chrome.mobile_small,firefox.laptop_large,firefox.tablet,firefox.mobile_small,edge.laptop_large,edge.tablet,edge.mobile_small

location

int64

The location ID of the test run.

public_id

string

The public ID of the Synthetic test.

result_id

string

ID of the result.

triggered_check_ids

[string]

The public IDs of the Synthetic test triggered.

{
  "batch_id": "string",
  "locations": [
    {
      "id": "integer",
      "name": "string"
    }
  ],
  "results": [
    {
      "device": "chrome.laptop_large",
      "location": "integer",
      "public_id": "string",
      "result_id": "string"
    }
  ],
  "triggered_check_ids": []
}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                          # Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/tests/trigger" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "tests": [ { "public_id": "123-abc-456" } ] } EOF
// Trigger Synthetic tests 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/datadogV1"
)

func main() {
	// there is a valid "synthetics_api_test" in the system
	SyntheticsAPITestPublicID := os.Getenv("SYNTHETICS_API_TEST_PUBLIC_ID")

	body := datadogV1.SyntheticsTriggerBody{
		Tests: []datadogV1.SyntheticsTriggerTest{
			{
				PublicId: SyntheticsAPITestPublicID,
			},
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.TriggerTests(ctx, body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.TriggerTests`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Trigger Synthetic tests returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsTriggerBody;
import com.datadog.api.client.v1.model.SyntheticsTriggerCITestsResponse;
import com.datadog.api.client.v1.model.SyntheticsTriggerTest;
import java.util.Collections;

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

    // there is a valid "synthetics_api_test" in the system
    String SYNTHETICS_API_TEST_PUBLIC_ID = System.getenv("SYNTHETICS_API_TEST_PUBLIC_ID");

    SyntheticsTriggerBody body =
        new SyntheticsTriggerBody()
            .tests(
                Collections.singletonList(
                    new SyntheticsTriggerTest().publicId(SYNTHETICS_API_TEST_PUBLIC_ID)));

    try {
      SyntheticsTriggerCITestsResponse result = apiInstance.triggerTests(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#triggerTests");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Trigger Synthetic tests returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_trigger_body import SyntheticsTriggerBody
from datadog_api_client.v1.model.synthetics_trigger_test import SyntheticsTriggerTest

# there is a valid "synthetics_api_test" in the system
SYNTHETICS_API_TEST_PUBLIC_ID = environ["SYNTHETICS_API_TEST_PUBLIC_ID"]

body = SyntheticsTriggerBody(
    tests=[
        SyntheticsTriggerTest(
            public_id=SYNTHETICS_API_TEST_PUBLIC_ID,
        ),
    ],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.trigger_tests(body=body)

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Trigger Synthetic tests returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new

# there is a valid "synthetics_api_test" in the system
SYNTHETICS_API_TEST_PUBLIC_ID = ENV["SYNTHETICS_API_TEST_PUBLIC_ID"]

body = DatadogAPIClient::V1::SyntheticsTriggerBody.new({
  tests: [
    DatadogAPIClient::V1::SyntheticsTriggerTest.new({
      public_id: SYNTHETICS_API_TEST_PUBLIC_ID,
    }),
  ],
})
p api_instance.trigger_tests(body)

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
/**
 * Trigger Synthetic tests returns "OK" response
 */

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

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

// there is a valid "synthetics_api_test" in the system
const SYNTHETICS_API_TEST_PUBLIC_ID = process.env
  .SYNTHETICS_API_TEST_PUBLIC_ID as string;

const params: v1.SyntheticsApiTriggerTestsRequest = {
  body: {
    tests: [
      {
        publicId: SYNTHETICS_API_TEST_PUBLIC_ID,
      },
    ],
  },
};

apiInstance
  .triggerTests(params)
  .then((data: v1.SyntheticsTriggerCITestsResponse) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v1/synthetics/tests/api/{public_id}https://api.datadoghq.eu/api/v1/synthetics/tests/api/{public_id}https://api.ddog-gov.com/api/v1/synthetics/tests/api/{public_id}https://api.datadoghq.com/api/v1/synthetics/tests/api/{public_id}https://api.us3.datadoghq.com/api/v1/synthetics/tests/api/{public_id}https://api.us5.datadoghq.com/api/v1/synthetics/tests/api/{public_id}

概要

Synthetic API テストに関連する 詳細なコンフィギュレーションを取得します。 This endpoint requires the synthetics_read authorization scope.

引数

パスパラメーター

名前

種類

説明

public_id [required]

string

The public ID of the test to get details from.

応答

OK

Object containing details about a Synthetic API test.

Expand All

フィールド

種類

説明

config [required]

object

Configuration object for a Synthetic API test.

assertions

[ <oneOf>]

Array of assertions used for the test. Required for single API tests.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

configVariables

[object]

Array of variables used for the test.

example

string

Example for the variable.

id

string

ID of the variable for global variables.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Whether the value of this variable will be obfuscated in test results. Only for config variables of type text.

type [required]

enum

Type of the configuration variable. Allowed enum values: global,text

request

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

steps

[object <oneOf>]

When the test subtype is multi, the steps of the test.

Option 1

object

The Test step used in a Synthetic multi-step API test.

allowFailure

boolean

Determines whether or not to continue with test if this step fails.

assertions [required]

[ <oneOf>]

Array of assertions used for the test.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

extractedValues

[object]

Array of values to parse and save as variables from the response.

field

string

When type is http_header, name of the header to use to extract the value.

name

string

Name of the variable to extract.

parser

object

Details of the parser to use for the global variable.

type [required]

enum

Type of parser for a Synthetic global variable from a synthetics test. Allowed enum values: raw,json_path,regex,x_path

value

string

Regex or JSON path used for the parser. Not used with type raw.

secure

boolean

Determines whether or not the extracted value will be obfuscated.

type

enum

Property of the Synthetic Test Response to use for a Synthetic global variable. Allowed enum values: http_body,http_header,local_variable

isCritical

boolean

Determines whether or not to consider the entire test as failed if this step fails. Can be used only if allowFailure is true.

name [required]

string

The name of the step.

request [required]

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

subtype [required]

enum

The subtype of the Synthetic multi-step API test step. Allowed enum values: http,grpc

Option 2

object

The Wait step used in a Synthetic multi-step API test.

name [required]

string

The name of the step.

subtype [required]

enum

The subtype of the Synthetic multi-step API wait step. Allowed enum values: wait

value [required]

int32

The time to wait in seconds. Minimum value: 0. Maximum value: 180.

variablesFromScript

string

Variables defined from JavaScript code.

locations [required]

[string]

Array of locations used to run the test.

message [required]

string

Notification message associated with the test.

monitor_id

int64

The associated monitor ID.

name [required]

string

Name of the test.

options [required]

object

Object describing the extra options for a Synthetic test.

accept_self_signed

boolean

For SSL test, whether or not the test should allow self signed certificates.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in an API test.

checkCertificateRevocation

boolean

For SSL test, whether or not the test should fail on revoked certificate in stapled OCSP.

ci

object

CI/CD options for a Synthetic test.

executionRule

enum

Execution rule for a Synthetic test. Allowed enum values: blocking,non_blocking,skipped

device_ids

[string]

For browser test, array with the different device IDs used to run the test.

disableCors

boolean

Whether or not to disable CORS mechanism.

disableCsp

boolean

Disable Content Security Policy for browser tests.

enableProfiling

boolean

Enable profiling for browser tests.

enableSecurityTesting

boolean

DEPRECATED: Enable security testing for browser tests. Security testing is not available anymore. This field is deprecated and won't be used.

follow_redirects

boolean

For API HTTP test, whether or not the test should follow redirects.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

ignoreServerCertificateError

boolean

Ignore server certificate error for browser tests.

initialNavigationTimeout

int64

Timeout before declaring the initial step as failed (in seconds) for browser tests.

min_failure_duration

int64

Minimum amount of time in failure required to trigger an alert.

min_location_failed

int64

Minimum number of locations in failure required to trigger an alert.

monitor_name

string

The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.

monitor_options

object

Object containing the options for a Synthetic test as a monitor (for example, renotification).

renotify_interval

int64

Time interval before renotifying if the test is still failing (in minutes).

monitor_priority

int32

Integer from 1 (high) to 5 (low) indicating alert severity.

noScreenshot

boolean

Prevents saving screenshots of the steps.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

rumSettings

object

The RUM data collection settings for the Synthetic browser test. Note: There are 3 ways to format RUM settings:

{ isEnabled: false } RUM data is not collected.

{ isEnabled: true } RUM data is collected from the Synthetic test's default application.

{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 } RUM data is collected using the specified application.

applicationId

string

RUM application ID used to collect RUM data for the browser test.

clientTokenId

int64

RUM application API key ID used to collect RUM data for the browser test.

isEnabled [required]

boolean

Determines whether RUM data is collected during test runs.

scheduling

object

Object containing timeframes and timezone used for advanced scheduling.

timeframes

[object]

Array containing objects describing the scheduling pattern to apply to each day.

day

int32

Number representing the day of the week.

from

string

The hour of the day on which scheduling starts.

to

string

The hour of the day on which scheduling ends.

timezone

string

Timezone in which the timeframe is based.

tick_every

int64

The frequency at which to run the Synthetic test (in seconds).

public_id

string

The public ID for the test.

status

enum

Define whether you want to start (live) or pause (paused) a Synthetic test. Allowed enum values: live,paused

subtype

enum

The subtype of the Synthetic API test, http, ssl, tcp, dns, icmp, udp, websocket, grpc or multi. Allowed enum values: http,ssl,tcp,dns,multi,icmp,udp,websocket,grpc

tags

[string]

Array of tags attached to the test.

type [required]

enum

Type of the Synthetic test, api. Allowed enum values: api

default: api

{
  "config": {
    "assertions": [
      []
    ],
    "configVariables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ],
    "request": {
      "allow_insecure": false,
      "basicAuth": {
        "password": "PaSSw0RD!",
        "type": "web",
        "username": "my_username"
      },
      "body": "string",
      "bodyType": "text/plain",
      "callType": "unary",
      "certificate": {
        "cert": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        },
        "key": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        }
      },
      "certificateDomains": [],
      "compressedJsonDescriptor": "string",
      "compressedProtoFile": "string",
      "dnsServer": "string",
      "dnsServerPort": "integer",
      "files": [
        {
          "bucketKey": "string",
          "content": "string",
          "name": "string",
          "originalFileName": "string",
          "size": "integer",
          "type": "string"
        }
      ],
      "follow_redirects": false,
      "headers": {
        "<any-key>": "string"
      },
      "host": "string",
      "httpVersion": "string",
      "message": "string",
      "metadata": {
        "<any-key>": "string"
      },
      "method": "string",
      "noSavingResponseBody": false,
      "numberOfPackets": "integer",
      "persistCookies": false,
      "port": "integer",
      "proxy": {
        "headers": {
          "<any-key>": "string"
        },
        "url": "https://example.com"
      },
      "query": {},
      "servername": "string",
      "service": "Greeter",
      "shouldTrackHops": false,
      "timeout": "number",
      "url": "https://example.com"
    },
    "steps": [],
    "variablesFromScript": "dd.variable.set(\"FOO\", \"foo\")"
  },
  "locations": [
    "aws:eu-west-3"
  ],
  "message": "Notification message",
  "monitor_id": 12345678,
  "name": "Example test name",
  "options": {
    "accept_self_signed": false,
    "allow_insecure": false,
    "checkCertificateRevocation": false,
    "ci": {
      "executionRule": "string"
    },
    "device_ids": [
      "chrome.laptop_large"
    ],
    "disableCors": false,
    "disableCsp": false,
    "enableProfiling": false,
    "enableSecurityTesting": false,
    "follow_redirects": false,
    "httpVersion": "string",
    "ignoreServerCertificateError": false,
    "initialNavigationTimeout": "integer",
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "monitor_name": "string",
    "monitor_options": {
      "renotify_interval": "integer"
    },
    "monitor_priority": "integer",
    "noScreenshot": false,
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ],
    "retry": {
      "count": "integer",
      "interval": "number"
    },
    "rumSettings": {
      "applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "clientTokenId": 12345,
      "isEnabled": true
    },
    "scheduling": {
      "timeframes": [
        {
          "day": 1,
          "from": "07:00",
          "to": "16:00"
        }
      ],
      "timezone": "America/New_York"
    },
    "tick_every": "integer"
  },
  "public_id": "123-abc-456",
  "status": "live",
  "subtype": "http",
  "tags": [
    "env:production"
  ],
  "type": "api"
}

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

- Synthetic Monitoring is not activated for the user - Test is not owned by the user

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

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

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

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.get_api_test(
        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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get an API test returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
p api_instance.get_api_test("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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get an API test 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/datadogV1"
)

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

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.GetAPITest`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get an API test returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsAPITest;

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

    try {
      SyntheticsAPITest result = apiInstance.getAPITest("public_id");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#getAPITest");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Get an API test returns "OK" response
 */

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

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

const params: v1.SyntheticsApiGetAPITestRequest = {
  publicId: "public_id",
};

apiInstance
  .getAPITest(params)
  .then((data: v1.SyntheticsAPITest) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v1/synthetics/tests/browser/{public_id}https://api.datadoghq.eu/api/v1/synthetics/tests/browser/{public_id}https://api.ddog-gov.com/api/v1/synthetics/tests/browser/{public_id}https://api.datadoghq.com/api/v1/synthetics/tests/browser/{public_id}https://api.us3.datadoghq.com/api/v1/synthetics/tests/browser/{public_id}https://api.us5.datadoghq.com/api/v1/synthetics/tests/browser/{public_id}

概要

Synthetic ブラウザテストに関連する詳細なコンフィギュレーション (手順を含む) を取得します。 This endpoint requires the synthetics_read authorization scope.

引数

パスパラメーター

名前

種類

説明

public_id [required]

string

The public ID of the test to get details from.

応答

OK

Object containing details about a Synthetic browser test.

Expand All

フィールド

種類

説明

config [required]

object

Configuration object for a Synthetic browser test.

assertions [required]

[ <oneOf>]

Array of assertions used for the test.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

configVariables

[object]

Array of variables used for the test.

example

string

Example for the variable.

id

string

ID of the variable for global variables.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Whether the value of this variable will be obfuscated in test results. Only for config variables of type text.

type [required]

enum

Type of the configuration variable. Allowed enum values: global,text

request [required]

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

setCookie

string

Cookies to be used for the request, using the Set-Cookie syntax.

variables

[object]

Array of variables used for the test steps.

example

string

Example for the variable.

id

string

ID for the variable. Global variables require an ID.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Determines whether or not the browser test variable is obfuscated. Can only be used with browser variables of type text.

type [required]

enum

Type of browser test variable. Allowed enum values: element,email,global,javascript,text

locations [required]

[string]

Array of locations used to run the test.

message [required]

string

Notification message associated with the test. Message can either be text or an empty string.

monitor_id

int64

The associated monitor ID.

name [required]

string

Name of the test.

options [required]

object

Object describing the extra options for a Synthetic test.

accept_self_signed

boolean

For SSL test, whether or not the test should allow self signed certificates.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in an API test.

checkCertificateRevocation

boolean

For SSL test, whether or not the test should fail on revoked certificate in stapled OCSP.

ci

object

CI/CD options for a Synthetic test.

executionRule

enum

Execution rule for a Synthetic test. Allowed enum values: blocking,non_blocking,skipped

device_ids

[string]

For browser test, array with the different device IDs used to run the test.

disableCors

boolean

Whether or not to disable CORS mechanism.

disableCsp

boolean

Disable Content Security Policy for browser tests.

enableProfiling

boolean

Enable profiling for browser tests.

enableSecurityTesting

boolean

DEPRECATED: Enable security testing for browser tests. Security testing is not available anymore. This field is deprecated and won't be used.

follow_redirects

boolean

For API HTTP test, whether or not the test should follow redirects.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

ignoreServerCertificateError

boolean

Ignore server certificate error for browser tests.

initialNavigationTimeout

int64

Timeout before declaring the initial step as failed (in seconds) for browser tests.

min_failure_duration

int64

Minimum amount of time in failure required to trigger an alert.

min_location_failed

int64

Minimum number of locations in failure required to trigger an alert.

monitor_name

string

The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.

monitor_options

object

Object containing the options for a Synthetic test as a monitor (for example, renotification).

renotify_interval

int64

Time interval before renotifying if the test is still failing (in minutes).

monitor_priority

int32

Integer from 1 (high) to 5 (low) indicating alert severity.

noScreenshot

boolean

Prevents saving screenshots of the steps.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

rumSettings

object

The RUM data collection settings for the Synthetic browser test. Note: There are 3 ways to format RUM settings:

{ isEnabled: false } RUM data is not collected.

{ isEnabled: true } RUM data is collected from the Synthetic test's default application.

{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 } RUM data is collected using the specified application.

applicationId

string

RUM application ID used to collect RUM data for the browser test.

clientTokenId

int64

RUM application API key ID used to collect RUM data for the browser test.

isEnabled [required]

boolean

Determines whether RUM data is collected during test runs.

scheduling

object

Object containing timeframes and timezone used for advanced scheduling.

timeframes

[object]

Array containing objects describing the scheduling pattern to apply to each day.

day

int32

Number representing the day of the week.

from

string

The hour of the day on which scheduling starts.

to

string

The hour of the day on which scheduling ends.

timezone

string

Timezone in which the timeframe is based.

tick_every

int64

The frequency at which to run the Synthetic test (in seconds).

public_id

string

The public ID of the test.

status

enum

Define whether you want to start (live) or pause (paused) a Synthetic test. Allowed enum values: live,paused

steps

[object]

Array of steps for the test.

allowFailure

boolean

A boolean set to allow this step to fail.

isCritical

boolean

A boolean to use in addition to allowFailure to determine if the test should be marked as failed when the step fails.

name

string

The name of the step.

noScreenshot

boolean

A boolean set to not take a screenshot for the step.

params

object

The parameters of the step.

timeout

int64

The time before declaring a step failed.

type

enum

Step type used in your Synthetic test. Allowed enum values: assertCurrentUrl,assertElementAttribute,assertElementContent,assertElementPresent,assertEmail,assertFileDownload,assertFromJavascript,assertPageContains,assertPageLacks,click,extractFromJavascript,extractVariable,goToEmailLink,goToUrl,goToUrlAndMeasureTti,hover,playSubTest,pressKey,refresh,runApiTest,scroll,selectOption,typeText,uploadFiles,wait

tags

[string]

Array of tags attached to the test.

type [required]

enum

Type of the Synthetic test, browser. Allowed enum values: browser

default: browser

{
  "config": {
    "assertions": [
      {
        "operator": "contains",
        "property": "string",
        "target": 123456,
        "timingsScope": "string",
        "type": "statusCode"
      }
    ],
    "configVariables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ],
    "request": {
      "allow_insecure": false,
      "basicAuth": {
        "password": "PaSSw0RD!",
        "type": "web",
        "username": "my_username"
      },
      "body": "string",
      "bodyType": "text/plain",
      "callType": "unary",
      "certificate": {
        "cert": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        },
        "key": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        }
      },
      "certificateDomains": [],
      "compressedJsonDescriptor": "string",
      "compressedProtoFile": "string",
      "dnsServer": "string",
      "dnsServerPort": "integer",
      "files": [
        {
          "bucketKey": "string",
          "content": "string",
          "name": "string",
          "originalFileName": "string",
          "size": "integer",
          "type": "string"
        }
      ],
      "follow_redirects": false,
      "headers": {
        "<any-key>": "string"
      },
      "host": "string",
      "httpVersion": "string",
      "message": "string",
      "metadata": {
        "<any-key>": "string"
      },
      "method": "string",
      "noSavingResponseBody": false,
      "numberOfPackets": "integer",
      "persistCookies": false,
      "port": "integer",
      "proxy": {
        "headers": {
          "<any-key>": "string"
        },
        "url": "https://example.com"
      },
      "query": {},
      "servername": "string",
      "service": "Greeter",
      "shouldTrackHops": false,
      "timeout": "number",
      "url": "https://example.com"
    },
    "setCookie": "string",
    "variables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ]
  },
  "locations": [
    "aws:eu-west-3"
  ],
  "message": "",
  "monitor_id": "integer",
  "name": "Example test name",
  "options": {
    "accept_self_signed": false,
    "allow_insecure": false,
    "checkCertificateRevocation": false,
    "ci": {
      "executionRule": "string"
    },
    "device_ids": [
      "chrome.laptop_large"
    ],
    "disableCors": false,
    "disableCsp": false,
    "enableProfiling": false,
    "enableSecurityTesting": false,
    "follow_redirects": false,
    "httpVersion": "string",
    "ignoreServerCertificateError": false,
    "initialNavigationTimeout": "integer",
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "monitor_name": "string",
    "monitor_options": {
      "renotify_interval": "integer"
    },
    "monitor_priority": "integer",
    "noScreenshot": false,
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ],
    "retry": {
      "count": "integer",
      "interval": "number"
    },
    "rumSettings": {
      "applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "clientTokenId": 12345,
      "isEnabled": true
    },
    "scheduling": {
      "timeframes": [
        {
          "day": 1,
          "from": "07:00",
          "to": "16:00"
        }
      ],
      "timezone": "America/New_York"
    },
    "tick_every": "integer"
  },
  "public_id": "string",
  "status": "live",
  "steps": [
    {
      "allowFailure": false,
      "isCritical": false,
      "name": "string",
      "noScreenshot": false,
      "params": {},
      "timeout": "integer",
      "type": "assertElementContent"
    }
  ],
  "tags": [
    "env:prod"
  ],
  "type": "browser"
}

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

- Synthetic Monitoring is not activated for the user - Test is not owned by the user

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

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

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

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.get_browser_test(
        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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get a browser test returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
p api_instance.get_browser_test("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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get a browser test 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/datadogV1"
)

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

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.GetBrowserTest`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get a browser test returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsBrowserTest;

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

    try {
      SyntheticsBrowserTest result = apiInstance.getBrowserTest("public_id");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#getBrowserTest");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Get a browser test returns "OK" response
 */

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

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

const params: v1.SyntheticsApiGetBrowserTestRequest = {
  publicId: "public_id",
};

apiInstance
  .getBrowserTest(params)
  .then((data: v1.SyntheticsBrowserTest) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v2/synthetics/settings/on_demand_concurrency_caphttps://api.datadoghq.eu/api/v2/synthetics/settings/on_demand_concurrency_caphttps://api.ddog-gov.com/api/v2/synthetics/settings/on_demand_concurrency_caphttps://api.datadoghq.com/api/v2/synthetics/settings/on_demand_concurrency_caphttps://api.us3.datadoghq.com/api/v2/synthetics/settings/on_demand_concurrency_caphttps://api.us5.datadoghq.com/api/v2/synthetics/settings/on_demand_concurrency_cap

概要

Get the on-demand concurrency cap.

応答

OK

On-demand concurrency cap response.

Expand All

フィールド

種類

説明

data

object

On-demand concurrency cap.

attributes

object

On-demand concurrency cap attributes.

on_demand_concurrency_cap

double

Value of the on-demand concurrency cap.

type

enum

On-demand concurrency cap type. Allowed enum values: on_demand_concurrency_cap

{
  "data": {
    "attributes": {
      "on_demand_concurrency_cap": "number"
    },
    "type": "string"
  }
}

Too many requests

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

コード例

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/synthetics/settings/on_demand_concurrency_cap" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get the on-demand concurrency cap 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.get_on_demand_concurrency_cap()

    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.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Get the on-demand concurrency cap returns "OK" response

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

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.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
// Get the on-demand concurrency cap 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.GetOnDemandConcurrencyCap(ctx)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.GetOnDemandConcurrencyCap`:\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.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Get the on-demand concurrency cap 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.OnDemandConcurrencyCapResponse;

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

    try {
      OnDemandConcurrencyCapResponse result = apiInstance.getOnDemandConcurrencyCap();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#getOnDemandConcurrencyCap");
      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.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
/**
 * Get the on-demand concurrency cap returns "OK" response
 */

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

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

apiInstance
  .getOnDemandConcurrencyCap()
  .then((data: v2.OnDemandConcurrencyCapResponse) => {
    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.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v1/synthetics/testshttps://api.datadoghq.eu/api/v1/synthetics/testshttps://api.ddog-gov.com/api/v1/synthetics/testshttps://api.datadoghq.com/api/v1/synthetics/testshttps://api.us3.datadoghq.com/api/v1/synthetics/testshttps://api.us5.datadoghq.com/api/v1/synthetics/tests

概要

すべての Synthetic テストのリストを取得します。 This endpoint requires the synthetics_read authorization scope.

引数

クエリ文字列

名前

種類

説明

page_size

integer

Used for pagination. The number of tests returned in the page.

page_number

integer

Used for pagination. Which page you want to retrieve. Starts at zero.

応答

OK - Returns the list of all Synthetic tests.

Object containing an array of Synthetic tests configuration.

Expand All

フィールド

種類

説明

tests

[object]

Array of Synthetic tests configuration.

config

object

Configuration object for a Synthetic test.

assertions

[ <oneOf>]

Array of assertions used for the test. Required for single API tests.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

configVariables

[object]

Array of variables used for the test.

example

string

Example for the variable.

id

string

ID of the variable for global variables.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Whether the value of this variable will be obfuscated in test results. Only for config variables of type text.

type [required]

enum

Type of the configuration variable. Allowed enum values: global,text

request

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

variables

[object]

Browser tests only - array of variables used for the test steps.

example

string

Example for the variable.

id

string

ID for the variable. Global variables require an ID.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Determines whether or not the browser test variable is obfuscated. Can only be used with browser variables of type text.

type [required]

enum

Type of browser test variable. Allowed enum values: element,email,global,javascript,text

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

locations

[string]

Array of locations used to run the test.

message

string

Notification message associated with the test.

monitor_id

int64

The associated monitor ID.

name

string

Name of the test.

options

object

Object describing the extra options for a Synthetic test.

accept_self_signed

boolean

For SSL test, whether or not the test should allow self signed certificates.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in an API test.

checkCertificateRevocation

boolean

For SSL test, whether or not the test should fail on revoked certificate in stapled OCSP.

ci

object

CI/CD options for a Synthetic test.

executionRule

enum

Execution rule for a Synthetic test. Allowed enum values: blocking,non_blocking,skipped

device_ids

[string]

For browser test, array with the different device IDs used to run the test.

disableCors

boolean

Whether or not to disable CORS mechanism.

disableCsp

boolean

Disable Content Security Policy for browser tests.

enableProfiling

boolean

Enable profiling for browser tests.

enableSecurityTesting

boolean

DEPRECATED: Enable security testing for browser tests. Security testing is not available anymore. This field is deprecated and won't be used.

follow_redirects

boolean

For API HTTP test, whether or not the test should follow redirects.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

ignoreServerCertificateError

boolean

Ignore server certificate error for browser tests.

initialNavigationTimeout

int64

Timeout before declaring the initial step as failed (in seconds) for browser tests.

min_failure_duration

int64

Minimum amount of time in failure required to trigger an alert.

min_location_failed

int64

Minimum number of locations in failure required to trigger an alert.

monitor_name

string

The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.

monitor_options

object

Object containing the options for a Synthetic test as a monitor (for example, renotification).

renotify_interval

int64

Time interval before renotifying if the test is still failing (in minutes).

monitor_priority

int32

Integer from 1 (high) to 5 (low) indicating alert severity.

noScreenshot

boolean

Prevents saving screenshots of the steps.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

rumSettings

object

The RUM data collection settings for the Synthetic browser test. Note: There are 3 ways to format RUM settings:

{ isEnabled: false } RUM data is not collected.

{ isEnabled: true } RUM data is collected from the Synthetic test's default application.

{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 } RUM data is collected using the specified application.

applicationId

string

RUM application ID used to collect RUM data for the browser test.

clientTokenId

int64

RUM application API key ID used to collect RUM data for the browser test.

isEnabled [required]

boolean

Determines whether RUM data is collected during test runs.

scheduling

object

Object containing timeframes and timezone used for advanced scheduling.

timeframes

[object]

Array containing objects describing the scheduling pattern to apply to each day.

day

int32

Number representing the day of the week.

from

string

The hour of the day on which scheduling starts.

to

string

The hour of the day on which scheduling ends.

timezone

string

Timezone in which the timeframe is based.

tick_every

int64

The frequency at which to run the Synthetic test (in seconds).

public_id

string

The test public ID.

status

enum

Define whether you want to start (live) or pause (paused) a Synthetic test. Allowed enum values: live,paused

steps

[object]

For browser test, the steps of the test.

allowFailure

boolean

A boolean set to allow this step to fail.

isCritical

boolean

A boolean to use in addition to allowFailure to determine if the test should be marked as failed when the step fails.

name

string

The name of the step.

noScreenshot

boolean

A boolean set to not take a screenshot for the step.

params

object

The parameters of the step.

timeout

int64

The time before declaring a step failed.

type

enum

Step type used in your Synthetic test. Allowed enum values: assertCurrentUrl,assertElementAttribute,assertElementContent,assertElementPresent,assertEmail,assertFileDownload,assertFromJavascript,assertPageContains,assertPageLacks,click,extractFromJavascript,extractVariable,goToEmailLink,goToUrl,goToUrlAndMeasureTti,hover,playSubTest,pressKey,refresh,runApiTest,scroll,selectOption,typeText,uploadFiles,wait

subtype

enum

The subtype of the Synthetic API test, http, ssl, tcp, dns, icmp, udp, websocket, grpc or multi. Allowed enum values: http,ssl,tcp,dns,multi,icmp,udp,websocket,grpc

tags

[string]

Array of tags attached to the test.

type

enum

Type of the Synthetic test, either api or browser. Allowed enum values: api,browser

{
  "tests": [
    {
      "config": {
        "assertions": [
          {
            "operator": "contains",
            "property": "string",
            "target": 123456,
            "timingsScope": "string",
            "type": "statusCode"
          }
        ],
        "configVariables": [
          {
            "example": "string",
            "id": "string",
            "name": "VARIABLE_NAME",
            "pattern": "string",
            "secure": false,
            "type": "text"
          }
        ],
        "request": {
          "allow_insecure": false,
          "basicAuth": {
            "password": "PaSSw0RD!",
            "type": "web",
            "username": "my_username"
          },
          "body": "string",
          "bodyType": "text/plain",
          "callType": "unary",
          "certificate": {
            "cert": {
              "content": "string",
              "filename": "string",
              "updatedAt": "string"
            },
            "key": {
              "content": "string",
              "filename": "string",
              "updatedAt": "string"
            }
          },
          "certificateDomains": [],
          "compressedJsonDescriptor": "string",
          "compressedProtoFile": "string",
          "dnsServer": "string",
          "dnsServerPort": "integer",
          "files": [
            {
              "bucketKey": "string",
              "content": "string",
              "name": "string",
              "originalFileName": "string",
              "size": "integer",
              "type": "string"
            }
          ],
          "follow_redirects": false,
          "headers": {
            "<any-key>": "string"
          },
          "host": "string",
          "httpVersion": "string",
          "message": "string",
          "metadata": {
            "<any-key>": "string"
          },
          "method": "string",
          "noSavingResponseBody": false,
          "numberOfPackets": "integer",
          "persistCookies": false,
          "port": "integer",
          "proxy": {
            "headers": {
              "<any-key>": "string"
            },
            "url": "https://example.com"
          },
          "query": {},
          "servername": "string",
          "service": "Greeter",
          "shouldTrackHops": false,
          "timeout": "number",
          "url": "https://example.com"
        },
        "variables": [
          {
            "example": "string",
            "id": "string",
            "name": "VARIABLE_NAME",
            "pattern": "string",
            "secure": false,
            "type": "text"
          }
        ]
      },
      "creator": {
        "email": "string",
        "handle": "string",
        "name": "string"
      },
      "locations": [
        "aws:eu-west-3"
      ],
      "message": "string",
      "monitor_id": "integer",
      "name": "string",
      "options": {
        "accept_self_signed": false,
        "allow_insecure": false,
        "checkCertificateRevocation": false,
        "ci": {
          "executionRule": "string"
        },
        "device_ids": [
          "chrome.laptop_large"
        ],
        "disableCors": false,
        "disableCsp": false,
        "enableProfiling": false,
        "enableSecurityTesting": false,
        "follow_redirects": false,
        "httpVersion": "string",
        "ignoreServerCertificateError": false,
        "initialNavigationTimeout": "integer",
        "min_failure_duration": "integer",
        "min_location_failed": "integer",
        "monitor_name": "string",
        "monitor_options": {
          "renotify_interval": "integer"
        },
        "monitor_priority": "integer",
        "noScreenshot": false,
        "restricted_roles": [
          "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
        ],
        "retry": {
          "count": "integer",
          "interval": "number"
        },
        "rumSettings": {
          "applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
          "clientTokenId": 12345,
          "isEnabled": true
        },
        "scheduling": {
          "timeframes": [
            {
              "day": 1,
              "from": "07:00",
              "to": "16:00"
            }
          ],
          "timezone": "America/New_York"
        },
        "tick_every": "integer"
      },
      "public_id": "string",
      "status": "live",
      "steps": [
        {
          "allowFailure": false,
          "isCritical": false,
          "name": "string",
          "noScreenshot": false,
          "params": {},
          "timeout": "integer",
          "type": "assertElementContent"
        }
      ],
      "subtype": "http",
      "tags": [],
      "type": "string"
    }
  ]
}

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Synthetic Monitoring is not activated for the user.

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/tests" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get the list of all Synthetic tests returns "OK - Returns the list of all Synthetic tests." response
"""

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

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.list_tests()

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get the list of all Synthetic tests returns "OK - Returns the list of all Synthetic tests." response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
p api_instance.list_tests()

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

dog.get_all_synthetics_tests()

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get the list of all Synthetic tests returns "OK - Returns the list of all Synthetic tests." 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/datadogV1"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.ListTests(ctx, *datadogV1.NewListTestsOptionalParameters())

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.ListTests`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get the list of all Synthetic tests returns "OK - Returns the list of all Synthetic tests."
// response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsListTestsResponse;

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

    try {
      SyntheticsListTestsResponse result = apiInstance.listTests();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#listTests");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
from datadog import initialize, api

options = {
    'api_key': '<DATADOG_API_KEY>',
    'app_key': '<DATADOG_APPLICATION_KEY>'
}

initialize(**options)

api.Synthetics.get_all_tests()

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python "example.py"
/**
 * Get the list of all Synthetic tests returns "OK - Returns the list of all Synthetic tests." response
 */

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

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

apiInstance
  .listTests()
  .then((data: v1.SyntheticsListTestsResponse) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v2/synthetics/settings/on_demand_concurrency_caphttps://api.datadoghq.eu/api/v2/synthetics/settings/on_demand_concurrency_caphttps://api.ddog-gov.com/api/v2/synthetics/settings/on_demand_concurrency_caphttps://api.datadoghq.com/api/v2/synthetics/settings/on_demand_concurrency_caphttps://api.us3.datadoghq.com/api/v2/synthetics/settings/on_demand_concurrency_caphttps://api.us5.datadoghq.com/api/v2/synthetics/settings/on_demand_concurrency_cap

概要

Save new value for on-demand concurrency cap.

リクエスト

Body Data (required)

.

Expand All

フィールド

種類

説明

on_demand_concurrency_cap

double

Value of the on-demand concurrency cap.

{
  "on_demand_concurrency_cap": 20
}

応答

OK

On-demand concurrency cap response.

Expand All

フィールド

種類

説明

data

object

On-demand concurrency cap.

attributes

object

On-demand concurrency cap attributes.

on_demand_concurrency_cap

double

Value of the on-demand concurrency cap.

type

enum

On-demand concurrency cap type. Allowed enum values: on_demand_concurrency_cap

{
  "data": {
    "attributes": {
      "on_demand_concurrency_cap": "number"
    },
    "type": "string"
  }
}

Too many requests

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

コード例

                          # Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/synthetics/settings/on_demand_concurrency_cap" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "on_demand_concurrency_cap": 20 } EOF
// Save new value for on-demand concurrency cap 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() {
	body := datadogV2.OnDemandConcurrencyCapAttributes{
		OnDemandConcurrencyCap: datadog.PtrFloat64(20),
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewSyntheticsApi(apiClient)
	resp, r, err := api.SetOnDemandConcurrencyCap(ctx, body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.SetOnDemandConcurrencyCap`:\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.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Save new value for on-demand concurrency cap 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.OnDemandConcurrencyCapAttributes;
import com.datadog.api.client.v2.model.OnDemandConcurrencyCapResponse;

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

    OnDemandConcurrencyCapAttributes body =
        new OnDemandConcurrencyCapAttributes().onDemandConcurrencyCap(20.0);

    try {
      OnDemandConcurrencyCapResponse result = apiInstance.setOnDemandConcurrencyCap(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#setOnDemandConcurrencyCap");
      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.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
"""
Save new value for on-demand concurrency cap returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.synthetics_api import SyntheticsApi
from datadog_api_client.v2.model.on_demand_concurrency_cap_attributes import OnDemandConcurrencyCapAttributes

body = OnDemandConcurrencyCapAttributes(
    on_demand_concurrency_cap=20.0,
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.set_on_demand_concurrency_cap(body=body)

    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.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Save new value for on-demand concurrency cap returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::SyntheticsAPI.new

body = DatadogAPIClient::V2::OnDemandConcurrencyCapAttributes.new({
  on_demand_concurrency_cap: 20,
})
p api_instance.set_on_demand_concurrency_cap(body)

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.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
/**
 * Save new value for on-demand concurrency cap returns "OK" response
 */

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

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

const params: v2.SyntheticsApiSetOnDemandConcurrencyCapRequest = {
  body: {
    onDemandConcurrencyCap: 20,
  },
};

apiInstance
  .setOnDemandConcurrencyCap(params)
  .then((data: v2.OnDemandConcurrencyCapResponse) => {
    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.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v1/synthetics/tests/{public_id}/results/{result_id}https://api.datadoghq.eu/api/v1/synthetics/tests/{public_id}/results/{result_id}https://api.ddog-gov.com/api/v1/synthetics/tests/{public_id}/results/{result_id}https://api.datadoghq.com/api/v1/synthetics/tests/{public_id}/results/{result_id}https://api.us3.datadoghq.com/api/v1/synthetics/tests/{public_id}/results/{result_id}https://api.us5.datadoghq.com/api/v1/synthetics/tests/{public_id}/results/{result_id}

概要

特定の Synthetic API テストの完全な結果を取得します。 This endpoint requires the synthetics_read authorization scope.

引数

パスパラメーター

名前

種類

説明

public_id [required]

string

The public ID of the API test to which the target result belongs.

result_id [required]

string

The ID of the result to get.

応答

OK

Object returned describing a API test result.

Expand All

フィールド

種類

説明

check

object

Object describing the API test configuration.

config [required]

object

Configuration object for a Synthetic test.

assertions

[ <oneOf>]

Array of assertions used for the test. Required for single API tests.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

configVariables

[object]

Array of variables used for the test.

example

string

Example for the variable.

id

string

ID of the variable for global variables.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Whether the value of this variable will be obfuscated in test results. Only for config variables of type text.

type [required]

enum

Type of the configuration variable. Allowed enum values: global,text

request

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

variables

[object]

Browser tests only - array of variables used for the test steps.

example

string

Example for the variable.

id

string

ID for the variable. Global variables require an ID.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Determines whether or not the browser test variable is obfuscated. Can only be used with browser variables of type text.

type [required]

enum

Type of browser test variable. Allowed enum values: element,email,global,javascript,text

check_time

double

When the API test was conducted.

check_version

int64

Version of the API test used.

probe_dc

string

Locations for which to query the API test results.

result

object

Object containing results for your Synthetic API test.

cert

object

Object describing the SSL certificate used for a Synthetic test.

cipher

string

Cipher used for the connection.

exponent

double

Exponent associated to the certificate.

extKeyUsage

[string]

Array of extensions and details used for the certificate.

fingerprint

string

MD5 digest of the DER-encoded Certificate information.

fingerprint256

string

SHA-1 digest of the DER-encoded Certificate information.

issuer

object

Object describing the issuer of a SSL certificate.

C

string

Country Name that issued the certificate.

CN

string

Common Name that issued certificate.

L

string

Locality that issued the certificate.

O

string

Organization that issued the certificate.

OU

string

Organizational Unit that issued the certificate.

ST

string

State Or Province Name that issued the certificate.

modulus

string

Modulus associated to the SSL certificate private key.

protocol

string

TLS protocol used for the test.

serialNumber

string

Serial Number assigned by Symantec to the SSL certificate.

subject

object

Object describing the SSL certificate used for the test.

C

string

Country Name associated with the certificate.

CN

string

Common Name that associated with the certificate.

L

string

Locality associated with the certificate.

O

string

Organization associated with the certificate.

OU

string

Organizational Unit associated with the certificate.

ST

string

State Or Province Name associated with the certificate.

altName

string

Subject Alternative Name associated with the certificate.

validFrom

date-time

Date from which the SSL certificate is valid.

validTo

date-time

Date until which the SSL certificate is valid.

eventType

enum

Status of a Synthetic test. Allowed enum values: not_scheduled,scheduled,finished,finished_with_error

failure

object

The API test failure details.

code

enum

Error code that can be returned by a Synthetic test. Allowed enum values: BODY_TOO_LARGE,DENIED,TOO_MANY_REDIRECTS,AUTHENTICATION_ERROR,DECRYPTION,INVALID_CHAR_IN_HEADER,HEADER_TOO_LARGE,HEADERS_INCOMPATIBLE_CONTENT_LENGTH,INVALID_REQUEST,REQUIRES_UPDATE,UNESCAPED_CHARACTERS_IN_REQUEST_PATH,MALFORMED_RESPONSE,INCORRECT_ASSERTION,CONNREFUSED,CONNRESET,DNS,HOSTUNREACH,NETUNREACH,TIMEOUT,SSL,OCSP,INVALID_TEST,TUNNEL,WEBSOCKET,UNKNOWN,INTERNAL_ERROR

message

string

The API test error message.

httpStatusCode

int64

The API test HTTP status code.

requestHeaders

object

Request header object used for the API test.

<any-key>

object

Requested request header.

responseBody

string

Response body returned for the API test.

responseHeaders

object

Response headers returned for the API test.

<any-key>

Returned request header.

responseSize

int64

Global size in byte of the API test response.

timings

object

Object containing all metrics and their values collected for a Synthetic API test. See the Synthetic Monitoring Metrics documentation.

dns

double

The duration in millisecond of the DNS lookup.

download

double

The time in millisecond to download the response.

firstByte

double

The time in millisecond to first byte.

handshake

double

The duration in millisecond of the TLS handshake.

redirect

double

The time in millisecond spent during redirections.

ssl

double

The duration in millisecond of the TLS handshake.

tcp

double

Time in millisecond to establish the TCP connection.

total

double

The overall time in millisecond the request took to be processed.

wait

double

Time spent in millisecond waiting for a response.

result_id

string

ID of the API test result.

status

enum

The status of your Synthetic monitor.

  • O for not triggered
  • 1 for triggered
  • 2 for no data Allowed enum values: 0,1,2
{
  "check": {
    "config": {
      "assertions": [
        {
          "operator": "contains",
          "property": "string",
          "target": 123456,
          "timingsScope": "string",
          "type": "statusCode"
        }
      ],
      "configVariables": [
        {
          "example": "string",
          "id": "string",
          "name": "VARIABLE_NAME",
          "pattern": "string",
          "secure": false,
          "type": "text"
        }
      ],
      "request": {
        "allow_insecure": false,
        "basicAuth": {
          "password": "PaSSw0RD!",
          "type": "web",
          "username": "my_username"
        },
        "body": "string",
        "bodyType": "text/plain",
        "callType": "unary",
        "certificate": {
          "cert": {
            "content": "string",
            "filename": "string",
            "updatedAt": "string"
          },
          "key": {
            "content": "string",
            "filename": "string",
            "updatedAt": "string"
          }
        },
        "certificateDomains": [],
        "compressedJsonDescriptor": "string",
        "compressedProtoFile": "string",
        "dnsServer": "string",
        "dnsServerPort": "integer",
        "files": [
          {
            "bucketKey": "string",
            "content": "string",
            "name": "string",
            "originalFileName": "string",
            "size": "integer",
            "type": "string"
          }
        ],
        "follow_redirects": false,
        "headers": {
          "<any-key>": "string"
        },
        "host": "string",
        "httpVersion": "string",
        "message": "string",
        "metadata": {
          "<any-key>": "string"
        },
        "method": "string",
        "noSavingResponseBody": false,
        "numberOfPackets": "integer",
        "persistCookies": false,
        "port": "integer",
        "proxy": {
          "headers": {
            "<any-key>": "string"
          },
          "url": "https://example.com"
        },
        "query": {},
        "servername": "string",
        "service": "Greeter",
        "shouldTrackHops": false,
        "timeout": "number",
        "url": "https://example.com"
      },
      "variables": [
        {
          "example": "string",
          "id": "string",
          "name": "VARIABLE_NAME",
          "pattern": "string",
          "secure": false,
          "type": "text"
        }
      ]
    }
  },
  "check_time": "number",
  "check_version": "integer",
  "probe_dc": "string",
  "result": {
    "cert": {
      "cipher": "string",
      "exponent": "number",
      "extKeyUsage": [],
      "fingerprint": "string",
      "fingerprint256": "string",
      "issuer": {
        "C": "string",
        "CN": "string",
        "L": "string",
        "O": "string",
        "OU": "string",
        "ST": "string"
      },
      "modulus": "string",
      "protocol": "string",
      "serialNumber": "string",
      "subject": {
        "C": "string",
        "CN": "string",
        "L": "string",
        "O": "string",
        "OU": "string",
        "ST": "string",
        "altName": "string"
      },
      "validFrom": "2019-09-19T10:00:00.000Z",
      "validTo": "2019-09-19T10:00:00.000Z"
    },
    "eventType": "string",
    "failure": {
      "code": "string",
      "message": "Error during DNS resolution (ENOTFOUND)."
    },
    "httpStatusCode": "integer",
    "requestHeaders": {
      "<any-key>": {}
    },
    "responseBody": "string",
    "responseHeaders": {
      "<any-key>": "undefined"
    },
    "responseSize": "integer",
    "timings": {
      "dns": "number",
      "download": "number",
      "firstByte": "number",
      "handshake": "number",
      "redirect": "number",
      "ssl": "number",
      "tcp": "number",
      "total": "number",
      "wait": "number"
    }
  },
  "result_id": "string",
  "status": "integer"
}

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

- Synthetic Monitoring is not activated for the user - Test or result is not owned by the user

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

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

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

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.get_api_test_result(
        public_id="hwb-332-3xe",
        result_id="3420446318379485707",
    )

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get an API test result returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
p api_instance.get_api_test_result("hwb-332-3xe", "3420446318379485707")

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

test_id = '<SYNTHETICS_TEST_PUBLIC_ID>'
result_id = '<TEST_RESULT_ID>'


dog = Dogapi::Client.new(api_key, app_key)

dog.get_synthetics_result('test_id'  => test_id , 'result_id'  => result_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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get an API test result 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/datadogV1"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.GetAPITestResult(ctx, "hwb-332-3xe", "3420446318379485707")

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.GetAPITestResult`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get an API test result returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsAPITestResultFull;

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

    try {
      SyntheticsAPITestResultFull result =
          apiInstance.getAPITestResult("hwb-332-3xe", "3420446318379485707");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#getAPITestResult");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
from datadog import initialize, api

options = {
    'api_key': '<DATADOG_API_KEY>',
    'app_key': '<DATADOG_APPLICATION_KEY>'
}

test_id = '<SYNTHETICS_TEST_PUBLIC_ID>'
result_id = '<TEST_RESULT_ID>'

initialize(**options)

api.Synthetics.get_result(id=test_id, result_id=result_id)

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python "example.py"
/**
 * Get an API test result returns "OK" response
 */

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

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

const params: v1.SyntheticsApiGetAPITestResultRequest = {
  publicId: "hwb-332-3xe",
  resultId: "3420446318379485707",
};

apiInstance
  .getAPITestResult(params)
  .then((data: v1.SyntheticsAPITestResultFull) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v1/synthetics/tests/browser/{public_id}/results/{result_id}https://api.datadoghq.eu/api/v1/synthetics/tests/browser/{public_id}/results/{result_id}https://api.ddog-gov.com/api/v1/synthetics/tests/browser/{public_id}/results/{result_id}https://api.datadoghq.com/api/v1/synthetics/tests/browser/{public_id}/results/{result_id}https://api.us3.datadoghq.com/api/v1/synthetics/tests/browser/{public_id}/results/{result_id}https://api.us5.datadoghq.com/api/v1/synthetics/tests/browser/{public_id}/results/{result_id}

概要

特定の Synthetic ブラウザテストの完全な結果を取得します。 This endpoint requires the synthetics_read authorization scope.

引数

パスパラメーター

名前

種類

説明

public_id [required]

string

The public ID of the browser test to which the target result belongs.

result_id [required]

string

The ID of the result to get.

応答

OK

Object returned describing a browser test result.

Expand All

フィールド

種類

説明

check

object

Object describing the browser test configuration.

config [required]

object

Configuration object for a Synthetic test.

assertions

[ <oneOf>]

Array of assertions used for the test. Required for single API tests.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

configVariables

[object]

Array of variables used for the test.

example

string

Example for the variable.

id

string

ID of the variable for global variables.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Whether the value of this variable will be obfuscated in test results. Only for config variables of type text.

type [required]

enum

Type of the configuration variable. Allowed enum values: global,text

request

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

variables

[object]

Browser tests only - array of variables used for the test steps.

example

string

Example for the variable.

id

string

ID for the variable. Global variables require an ID.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Determines whether or not the browser test variable is obfuscated. Can only be used with browser variables of type text.

type [required]

enum

Type of browser test variable. Allowed enum values: element,email,global,javascript,text

check_time

double

When the browser test was conducted.

check_version

int64

Version of the browser test used.

probe_dc

string

Location from which the browser test was performed.

result

object

Object containing results for your Synthetic browser test.

browserType

string

Type of browser device used for the browser test.

browserVersion

string

Browser version used for the browser test.

device

object

Object describing the device used to perform the Synthetic test.

height [required]

int64

Screen height of the device.

id [required]

enum

The device ID. Allowed enum values: laptop_large,tablet,mobile_small,chrome.laptop_large,chrome.tablet,chrome.mobile_small,firefox.laptop_large,firefox.tablet,firefox.mobile_small,edge.laptop_large,edge.tablet,edge.mobile_small

isMobile

boolean

Whether or not the device is a mobile.

name [required]

string

The device name.

width [required]

int64

Screen width of the device.

duration

double

Global duration in second of the browser test.

error

string

Error returned for the browser test.

failure

object

The browser test failure details.

code

enum

Error code that can be returned by a Synthetic test. Allowed enum values: API_REQUEST_FAILURE,ASSERTION_FAILURE,DOWNLOAD_FILE_TOO_LARGE,ELEMENT_NOT_INTERACTABLE,EMAIL_VARIABLE_NOT_DEFINED,EVALUATE_JAVASCRIPT,EVALUATE_JAVASCRIPT_CONTEXT,EXTRACT_VARIABLE,FORBIDDEN_URL,FRAME_DETACHED,INCONSISTENCIES,INTERNAL_ERROR,INVALID_TYPE_TEXT_DELAY,INVALID_URL,INVALID_VARIABLE_PATTERN,INVISIBLE_ELEMENT,LOCATE_ELEMENT,NAVIGATE_TO_LINK,OPEN_URL,PRESS_KEY,SERVER_CERTIFICATE,SELECT_OPTION,STEP_TIMEOUT,SUB_TEST_NOT_PASSED,TEST_TIMEOUT,TOO_MANY_HTTP_REQUESTS,UNAVAILABLE_BROWSER,UNKNOWN,UNSUPPORTED_AUTH_SCHEMA,UPLOAD_FILES_ELEMENT_TYPE,UPLOAD_FILES_DIALOG,UPLOAD_FILES_DYNAMIC_ELEMENT,UPLOAD_FILES_NAME

message

string

The browser test error message.

passed

boolean

Whether or not the browser test was conducted.

receivedEmailCount

int64

The amount of email received during the browser test.

startUrl

string

Starting URL for the browser test.

stepDetails

[object]

Array containing the different browser test steps.

browserErrors

[object]

Array of errors collected for a browser test.

description [required]

string

Description of the error.

name [required]

string

Name of the error.

status

int64

Status Code of the error.

type [required]

enum

Error type returned by a browser test. Allowed enum values: network,js

checkType

enum

Type of assertion to apply in an API test. Allowed enum values: equals,notEquals,contains,notContains,startsWith,notStartsWith,greater,lower,greaterEquals,lowerEquals,matchRegex,between,isEmpty,notIsEmpty

description

string

Description of the test.

duration

double

Total duration in millisecond of the test.

error

string

Error returned by the test.

playingTab

enum

Navigate between different tabs for your browser test. Allowed enum values: -1,0,1,2,3

screenshotBucketKey

boolean

Whether or not screenshots where collected by the test.

skipped

boolean

Whether or not to skip this step.

snapshotBucketKey

boolean

Whether or not snapshots where collected by the test.

stepId

int64

The step ID.

subTestStepDetails

[object]

If this step includes a sub-test. Subtests documentation.

timeToInteractive

double

Time before starting the step.

type

enum

Step type used in your Synthetic test. Allowed enum values: assertCurrentUrl,assertElementAttribute,assertElementContent,assertElementPresent,assertEmail,assertFileDownload,assertFromJavascript,assertPageContains,assertPageLacks,click,extractFromJavascript,extractVariable,goToEmailLink,goToUrl,goToUrlAndMeasureTti,hover,playSubTest,pressKey,refresh,runApiTest,scroll,selectOption,typeText,uploadFiles,wait

url

string

URL to perform the step against.

value

Value for the step.

vitalsMetrics

[object]

Array of Core Web Vitals metrics for the step.

cls

double

Cumulative Layout Shift.

lcp

double

Largest Contentful Paint in milliseconds.

url

string

URL attached to the metrics.

warnings

[object]

Warning collected that didn't failed the step.

message [required]

string

Message for the warning.

type [required]

enum

User locator used. Allowed enum values: user_locator

thumbnailsBucketKey

boolean

Whether or not a thumbnail is associated with the browser test.

timeToInteractive

double

Time in second to wait before the browser test starts after reaching the start URL.

result_id

string

ID of the browser test result.

status

enum

The status of your Synthetic monitor.

  • O for not triggered
  • 1 for triggered
  • 2 for no data Allowed enum values: 0,1,2
{
  "check": {
    "config": {
      "assertions": [
        {
          "operator": "contains",
          "property": "string",
          "target": 123456,
          "timingsScope": "string",
          "type": "statusCode"
        }
      ],
      "configVariables": [
        {
          "example": "string",
          "id": "string",
          "name": "VARIABLE_NAME",
          "pattern": "string",
          "secure": false,
          "type": "text"
        }
      ],
      "request": {
        "allow_insecure": false,
        "basicAuth": {
          "password": "PaSSw0RD!",
          "type": "web",
          "username": "my_username"
        },
        "body": "string",
        "bodyType": "text/plain",
        "callType": "unary",
        "certificate": {
          "cert": {
            "content": "string",
            "filename": "string",
            "updatedAt": "string"
          },
          "key": {
            "content": "string",
            "filename": "string",
            "updatedAt": "string"
          }
        },
        "certificateDomains": [],
        "compressedJsonDescriptor": "string",
        "compressedProtoFile": "string",
        "dnsServer": "string",
        "dnsServerPort": "integer",
        "files": [
          {
            "bucketKey": "string",
            "content": "string",
            "name": "string",
            "originalFileName": "string",
            "size": "integer",
            "type": "string"
          }
        ],
        "follow_redirects": false,
        "headers": {
          "<any-key>": "string"
        },
        "host": "string",
        "httpVersion": "string",
        "message": "string",
        "metadata": {
          "<any-key>": "string"
        },
        "method": "string",
        "noSavingResponseBody": false,
        "numberOfPackets": "integer",
        "persistCookies": false,
        "port": "integer",
        "proxy": {
          "headers": {
            "<any-key>": "string"
          },
          "url": "https://example.com"
        },
        "query": {},
        "servername": "string",
        "service": "Greeter",
        "shouldTrackHops": false,
        "timeout": "number",
        "url": "https://example.com"
      },
      "variables": [
        {
          "example": "string",
          "id": "string",
          "name": "VARIABLE_NAME",
          "pattern": "string",
          "secure": false,
          "type": "text"
        }
      ]
    }
  },
  "check_time": "number",
  "check_version": "integer",
  "probe_dc": "string",
  "result": {
    "browserType": "string",
    "browserVersion": "string",
    "device": {
      "height": 0,
      "id": "chrome.laptop_large",
      "isMobile": false,
      "name": "",
      "width": 0
    },
    "duration": "number",
    "error": "string",
    "failure": {
      "code": "string",
      "message": "Error during DNS resolution (ENOTFOUND)."
    },
    "passed": false,
    "receivedEmailCount": "integer",
    "startUrl": "string",
    "stepDetails": [
      {
        "browserErrors": [
          {
            "description": "Example error message",
            "name": "Failed test",
            "status": 500,
            "type": "network"
          }
        ],
        "checkType": "string",
        "description": "string",
        "duration": "number",
        "error": "string",
        "playingTab": "integer",
        "screenshotBucketKey": false,
        "skipped": false,
        "snapshotBucketKey": false,
        "stepId": "integer",
        "subTestStepDetails": [],
        "timeToInteractive": "number",
        "type": "assertElementContent",
        "url": "string",
        "value": "undefined",
        "vitalsMetrics": [
          {
            "cls": "number",
            "lcp": "number",
            "url": "string"
          }
        ],
        "warnings": [
          {
            "message": "",
            "type": "user_locator"
          }
        ]
      }
    ],
    "thumbnailsBucketKey": false,
    "timeToInteractive": "number"
  },
  "result_id": "string",
  "status": "integer"
}

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

- Synthetic Monitoring is not activated for the user - Test or result is not owned by the user

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

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

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

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.get_browser_test_result(
        public_id="2yy-sem-mjh",
        result_id="5671719892074090418",
    )

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get a browser test result returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
p api_instance.get_browser_test_result("2yy-sem-mjh", "5671719892074090418")

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get a browser test result 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/datadogV1"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.GetBrowserTestResult(ctx, "2yy-sem-mjh", "5671719892074090418")

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.GetBrowserTestResult`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get a browser test result returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsBrowserTestResultFull;

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

    try {
      SyntheticsBrowserTestResultFull result =
          apiInstance.getBrowserTestResult("2yy-sem-mjh", "5671719892074090418");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#getBrowserTestResult");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Get a browser test result returns "OK" response
 */

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

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

const params: v1.SyntheticsApiGetBrowserTestResultRequest = {
  publicId: "2yy-sem-mjh",
  resultId: "5671719892074090418",
};

apiInstance
  .getBrowserTestResult(params)
  .then((data: v1.SyntheticsBrowserTestResultFull) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

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

概要

特定の Synthetic API テストの最新結果の要約 150 件を取得します。 This endpoint requires the synthetics_read authorization scope.

引数

パスパラメーター

名前

種類

説明

public_id [required]

string

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

クエリ文字列

名前

種類

説明

from_ts

integer

Timestamp in milliseconds from which to start querying results.

to_ts

integer

Timestamp in milliseconds up to which to query results.

probe_dc

array

Locations for which to query results.

応答

OK

Object with the latest Synthetic API test run.

Expand All

フィールド

種類

説明

last_timestamp_fetched

int64

Timestamp of the latest API test run.

results

[object]

Result of the latest API test run.

check_time

double

Last time the API test was performed.

probe_dc

string

Location from which the API test was performed.

result

object

Result of the last API test run.

passed

boolean

Describes if the test run has passed or failed.

timings

object

Object containing all metrics and their values collected for a Synthetic API test. See the Synthetic Monitoring Metrics documentation.

dns

double

The duration in millisecond of the DNS lookup.

download

double

The time in millisecond to download the response.

firstByte

double

The time in millisecond to first byte.

handshake

double

The duration in millisecond of the TLS handshake.

redirect

double

The time in millisecond spent during redirections.

ssl

double

The duration in millisecond of the TLS handshake.

tcp

double

Time in millisecond to establish the TCP connection.

total

double

The overall time in millisecond the request took to be processed.

wait

double

Time spent in millisecond waiting for a response.

result_id

string

ID of the API test result.

status

enum

The status of your Synthetic monitor.

  • O for not triggered
  • 1 for triggered
  • 2 for no data Allowed enum values: 0,1,2
{
  "last_timestamp_fetched": "integer",
  "results": [
    {
      "check_time": "number",
      "probe_dc": "string",
      "result": {
        "passed": false,
        "timings": {
          "dns": "number",
          "download": "number",
          "firstByte": "number",
          "handshake": "number",
          "redirect": "number",
          "ssl": "number",
          "tcp": "number",
          "total": "number",
          "wait": "number"
        }
      },
      "result_id": "string",
      "status": "integer"
    }
  ]
}

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

- Synthetic is not activated for the user - Test is not owned by the user

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

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

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

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.get_api_test_latest_results(
        public_id="hwb-332-3xe",
    )

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get an API test's latest results summaries returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
p api_instance.get_api_test_latest_results("hwb-332-3xe")

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

test_id = '<SYNTHETICS_TEST_PUBLIC_ID>'

dog = Dogapi::Client.new(api_key, app_key)

dog.get_synthetics_results('test_id'  => test_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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get an API test's latest results summaries 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/datadogV1"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.GetAPITestLatestResults(ctx, "hwb-332-3xe", *datadogV1.NewGetAPITestLatestResultsOptionalParameters())

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.GetAPITestLatestResults`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get an API test's latest results summaries returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsGetAPITestLatestResultsResponse;

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

    try {
      SyntheticsGetAPITestLatestResultsResponse result =
          apiInstance.getAPITestLatestResults("hwb-332-3xe");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#getAPITestLatestResults");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
from datadog import initialize, api

options = {
    'api_key': '<DATADOG_API_KEY>',
    'app_key': '<DATADOG_APPLICATION_KEY>'
}

test_id = '<SYNTHETICS_TEST_PUBLIC_ID>'

initialize(**options)

api.Synthetics.get_results(id=test_id)

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python "example.py"
/**
 * Get an API test's latest results summaries returns "OK" response
 */

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

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

const params: v1.SyntheticsApiGetAPITestLatestResultsRequest = {
  publicId: "hwb-332-3xe",
};

apiInstance
  .getAPITestLatestResults(params)
  .then((data: v1.SyntheticsGetAPITestLatestResultsResponse) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

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

概要

特定の Synthetic ブラウザテストの最新結果の要約 150 件を取得します。 This endpoint requires the synthetics_read authorization scope.

引数

パスパラメーター

名前

種類

説明

public_id [required]

string

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

クエリ文字列

名前

種類

説明

from_ts

integer

Timestamp in milliseconds from which to start querying results.

to_ts

integer

Timestamp in milliseconds up to which to query results.

probe_dc

array

Locations for which to query results.

応答

OK

Object with the latest Synthetic browser test run.

Expand All

フィールド

種類

説明

last_timestamp_fetched

int64

Timestamp of the latest browser test run.

results

[object]

Result of the latest browser test run.

check_time

double

Last time the browser test was performed.

probe_dc

string

Location from which the Browser test was performed.

result

object

Object with the result of the last browser test run.

device

object

Object describing the device used to perform the Synthetic test.

height [required]

int64

Screen height of the device.

id [required]

enum

The device ID. Allowed enum values: laptop_large,tablet,mobile_small,chrome.laptop_large,chrome.tablet,chrome.mobile_small,firefox.laptop_large,firefox.tablet,firefox.mobile_small,edge.laptop_large,edge.tablet,edge.mobile_small

isMobile

boolean

Whether or not the device is a mobile.

name [required]

string

The device name.

width [required]

int64

Screen width of the device.

duration

double

Length in milliseconds of the browser test run.

errorCount

int64

Amount of errors collected for a single browser test run.

stepCountCompleted

int64

Amount of browser test steps completed before failing.

stepCountTotal

int64

Total amount of browser test steps.

result_id

string

ID of the browser test result.

status

enum

The status of your Synthetic monitor.

  • O for not triggered
  • 1 for triggered
  • 2 for no data Allowed enum values: 0,1,2
{
  "last_timestamp_fetched": "integer",
  "results": [
    {
      "check_time": "number",
      "probe_dc": "string",
      "result": {
        "device": {
          "height": 0,
          "id": "chrome.laptop_large",
          "isMobile": false,
          "name": "",
          "width": 0
        },
        "duration": "number",
        "errorCount": "integer",
        "stepCountCompleted": "integer",
        "stepCountTotal": "integer"
      },
      "result_id": "string",
      "status": "integer"
    }
  ]
}

forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

- Synthetic Monitoring is not activated for the user - Test is not owned by the user

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

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

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

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.get_browser_test_latest_results(
        public_id="2yy-sem-mjh",
    )

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get a browser test's latest results summaries returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
p api_instance.get_browser_test_latest_results("2yy-sem-mjh")

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get a browser test's latest results summaries 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/datadogV1"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.GetBrowserTestLatestResults(ctx, "2yy-sem-mjh", *datadogV1.NewGetBrowserTestLatestResultsOptionalParameters())

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.GetBrowserTestLatestResults`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get a browser test's latest results summaries returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsGetBrowserTestLatestResultsResponse;

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

    try {
      SyntheticsGetBrowserTestLatestResultsResponse result =
          apiInstance.getBrowserTestLatestResults("2yy-sem-mjh");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#getBrowserTestLatestResults");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Get a browser test's latest results summaries returns "OK" response
 */

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

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

const params: v1.SyntheticsApiGetBrowserTestLatestResultsRequest = {
  publicId: "2yy-sem-mjh",
};

apiInstance
  .getBrowserTestLatestResults(params)
  .then((data: v1.SyntheticsGetBrowserTestLatestResultsResponse) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v1/synthetics/ci/batch/{batch_id}https://api.datadoghq.eu/api/v1/synthetics/ci/batch/{batch_id}https://api.ddog-gov.com/api/v1/synthetics/ci/batch/{batch_id}https://api.datadoghq.com/api/v1/synthetics/ci/batch/{batch_id}https://api.us3.datadoghq.com/api/v1/synthetics/ci/batch/{batch_id}https://api.us5.datadoghq.com/api/v1/synthetics/ci/batch/{batch_id}

概要

バッチの更新情報を取得します。 This endpoint requires the synthetics_read authorization scope.

引数

パスパラメーター

名前

種類

説明

batch_id [required]

string

The ID of the batch.

応答

OK

Details about a batch response.

Expand All

フィールド

種類

説明

data

object

Wrapper object that contains the details of a batch.

metadata

object

Metadata for the Synthetic tests run.

ci

object

Description of the CI provider.

pipeline

object

Description of the CI pipeline.

url

string

URL of the pipeline.

provider

object

Description of the CI provider.

name

string

Name of the CI provider.

git

object

Git information.

branch

string

Branch name.

commitSha

string

The commit SHA.

results

[object]

List of results for the batch.

device

enum

The device ID. Allowed enum values: laptop_large,tablet,mobile_small,chrome.laptop_large,chrome.tablet,chrome.mobile_small,firefox.laptop_large,firefox.tablet,firefox.mobile_small,edge.laptop_large,edge.tablet,edge.mobile_small

duration

double

Total duration in millisecond of the test.

execution_rule

enum

Execution rule for a Synthetic test. Allowed enum values: blocking,non_blocking,skipped

location

string

Name of the location.

result_id

string

The ID of the result to get.

retries

double

Number of times this result has been retried.

status

enum

Determines whether or not the batch has passed, failed, or is in progress. Allowed enum values: passed,skipped,failed

test_name

string

Name of the test.

test_public_id

string

The public ID of the Synthetic test.

test_type

enum

Type of the Synthetic test, either api or browser. Allowed enum values: api,browser

status

enum

Determines whether or not the batch has passed, failed, or is in progress. Allowed enum values: passed,skipped,failed

{
  "data": {
    "metadata": {
      "ci": {
        "pipeline": {
          "url": "string"
        },
        "provider": {
          "name": "string"
        }
      },
      "git": {
        "branch": "string",
        "commitSha": "string"
      }
    },
    "results": [
      {
        "device": "chrome.laptop_large",
        "duration": "number",
        "execution_rule": "string",
        "location": "string",
        "result_id": "string",
        "retries": "number",
        "status": "string",
        "test_name": "string",
        "test_public_id": "string",
        "test_type": "string"
      }
    ],
    "status": "string"
  }
}

Batch does not exist.

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                  # Path parameters
export batch_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/ci/batch/${batch_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get details of batch returns "OK" response
"""

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

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.get_synthetics_ci_batch(
        batch_id="batch_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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get details of batch returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
p api_instance.get_synthetics_ci_batch("batch_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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get details of batch 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/datadogV1"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.GetSyntheticsCIBatch(ctx, "batch_id")

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.GetSyntheticsCIBatch`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get details of batch returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsBatchDetails;

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

    try {
      SyntheticsBatchDetails result = apiInstance.getSyntheticsCIBatch("batch_id");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#getSyntheticsCIBatch");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Get details of batch returns "OK" response
 */

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

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

const params: v1.SyntheticsApiGetSyntheticsCIBatchRequest = {
  batchId: "batch_id",
};

apiInstance
  .getSyntheticsCIBatch(params)
  .then((data: v1.SyntheticsBatchDetails) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v1/synthetics/tests/deletehttps://api.datadoghq.eu/api/v1/synthetics/tests/deletehttps://api.ddog-gov.com/api/v1/synthetics/tests/deletehttps://api.datadoghq.com/api/v1/synthetics/tests/deletehttps://api.us3.datadoghq.com/api/v1/synthetics/tests/deletehttps://api.us5.datadoghq.com/api/v1/synthetics/tests/delete

概要

複数の Synthetic テストを ID で削除します。 This endpoint requires the synthetics_write authorization scope.

リクエスト

Body Data (required)

削除する Synthetic テストのパブリック ID リスト。

Expand All

フィールド

種類

説明

force_delete_dependencies

boolean

Delete the Synthetic test even if it's referenced by other resources (for example, SLOs and composite monitors).

public_ids

[string]

An array of Synthetic test IDs you want to delete.

{
  "force_delete_dependencies": false,
  "public_ids": [
    []
  ]
}

応答

OK.

Response object for deleting Synthetic tests.

Expand All

フィールド

種類

説明

deleted_tests

[object]

Array of objects containing a deleted Synthetic test ID with the associated deletion timestamp.

deleted_at

date-time

Deletion timestamp of the Synthetic test ID.

public_id

string

The Synthetic test ID deleted.

{
  "deleted_tests": [
    {
      "deleted_at": "2019-09-19T10:00:00.000Z",
      "public_id": "string"
    }
  ]
}

- JSON format is wrong - Test cannot be deleted as it's used elsewhere (as a sub-test or in an uptime widget) - Some IDs are not owned by the user

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

- Tests to be deleted can't be found - Synthetic is not activated for the user

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                  # Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/tests/delete" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF {} EOF
"""
Delete tests returns "OK." response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_delete_tests_payload import SyntheticsDeleteTestsPayload

# there is a valid "synthetics_api_test" in the system
SYNTHETICS_API_TEST_PUBLIC_ID = environ["SYNTHETICS_API_TEST_PUBLIC_ID"]

body = SyntheticsDeleteTestsPayload(
    public_ids=[
        SYNTHETICS_API_TEST_PUBLIC_ID,
    ],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.delete_tests(body=body)

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Delete tests returns "OK." response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new

# there is a valid "synthetics_api_test" in the system
SYNTHETICS_API_TEST_PUBLIC_ID = ENV["SYNTHETICS_API_TEST_PUBLIC_ID"]

body = DatadogAPIClient::V1::SyntheticsDeleteTestsPayload.new({
  public_ids: [
    SYNTHETICS_API_TEST_PUBLIC_ID,
  ],
})
p api_instance.delete_tests(body)

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

test_ids = ['<SYNTHETICS_TEST_PUBLIC_ID_1>','<SYNTHETICS_TEST_PUBLIC_ID_2>']

dog.delete_synthetics_tests('test_ids' => test_ids)

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Delete tests 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/datadogV1"
)

func main() {
	// there is a valid "synthetics_api_test" in the system
	SyntheticsAPITestPublicID := os.Getenv("SYNTHETICS_API_TEST_PUBLIC_ID")

	body := datadogV1.SyntheticsDeleteTestsPayload{
		PublicIds: []string{
			SyntheticsAPITestPublicID,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.DeleteTests(ctx, body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.DeleteTests`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Delete tests returns "OK." response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsDeleteTestsPayload;
import com.datadog.api.client.v1.model.SyntheticsDeleteTestsResponse;
import java.util.Collections;

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

    // there is a valid "synthetics_api_test" in the system
    String SYNTHETICS_API_TEST_PUBLIC_ID = System.getenv("SYNTHETICS_API_TEST_PUBLIC_ID");

    SyntheticsDeleteTestsPayload body =
        new SyntheticsDeleteTestsPayload()
            .publicIds(Collections.singletonList(SYNTHETICS_API_TEST_PUBLIC_ID));

    try {
      SyntheticsDeleteTestsResponse result = apiInstance.deleteTests(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#deleteTests");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
from datadog import initialize, api

options = {
    'api_key': '<DATADOG_API_KEY>',
    'app_key': '<DATADOG_APPLICATION_KEY>'
}

test_ids = ['<SYNTHETICS_TEST_PUBLIC_ID_1>','<SYNTHETICS_TEST_PUBLIC_ID_2>']

initialize(**options)

api.Synthetics.delete_test(public_ids=test_ids)

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python "example.py"
/**
 * Delete tests returns "OK." response
 */

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

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

// there is a valid "synthetics_api_test" in the system
const SYNTHETICS_API_TEST_PUBLIC_ID = process.env
  .SYNTHETICS_API_TEST_PUBLIC_ID as string;

const params: v1.SyntheticsApiDeleteTestsRequest = {
  body: {
    publicIds: [SYNTHETICS_API_TEST_PUBLIC_ID],
  },
};

apiInstance
  .deleteTests(params)
  .then((data: v1.SyntheticsDeleteTestsResponse) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v1/synthetics/variableshttps://api.datadoghq.eu/api/v1/synthetics/variableshttps://api.ddog-gov.com/api/v1/synthetics/variableshttps://api.datadoghq.com/api/v1/synthetics/variableshttps://api.us3.datadoghq.com/api/v1/synthetics/variableshttps://api.us5.datadoghq.com/api/v1/synthetics/variables

概要

すべての Synthetic グローバル変数のリストを削除します。 This endpoint requires the synthetics_global_variable_read authorization scope.

応答

OK

Object containing an array of Synthetic global variables.

Expand All

フィールド

種類

説明

variables

[object]

Array of Synthetic global variables.

attributes

object

Attributes of the global variable.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

description [required]

string

Description of the global variable.

id

string

Unique identifier of the global variable.

name [required]

string

Name of the global variable. Unique across Synthetic global variables.

parse_test_options

object

Parser options to use for retrieving a Synthetic global variable from a Synthetic test. Used in conjunction with parse_test_public_id.

field

string

When type is http_header, name of the header to use to extract the value.

localVariableName

string

When type is local_variable, name of the local variable to use to extract the value.

parser

object

Details of the parser to use for the global variable.

type [required]

enum

Type of parser for a Synthetic global variable from a synthetics test. Allowed enum values: raw,json_path,regex,x_path

value

string

Regex or JSON path used for the parser. Not used with type raw.

type [required]

enum

Property of the Synthetic Test Response to use for a Synthetic global variable. Allowed enum values: http_body,http_header,local_variable

parse_test_public_id

string

A Synthetic test ID to use as a test to generate the variable value.

tags [required]

[string]

Tags of the global variable.

value [required]

object

Value of the global variable.

options

object

Options for the Global Variable for MFA.

totp_parameters

object

Parameters for the TOTP/MFA variable

digits

int32

Number of digits for the OTP code.

refresh_interval

int32

Interval for which to refresh the token (in seconds).

secure

boolean

Determines if the value of the variable is hidden.

value

string

Value of the global variable. When reading a global variable, the value will not be present if the variable is hidden with the secure property.

{
  "variables": [
    {
      "attributes": {
        "restricted_roles": [
          "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
        ]
      },
      "description": "Example description",
      "id": "string",
      "name": "MY_VARIABLE",
      "parse_test_options": {
        "field": "content-type",
        "localVariableName": "LOCAL_VARIABLE",
        "parser": {
          "type": "raw",
          "value": "string"
        },
        "type": "http_body"
      },
      "parse_test_public_id": "abc-def-123",
      "tags": [
        "team:front",
        "test:workflow-1"
      ],
      "value": {
        "options": {
          "totp_parameters": {
            "digits": 6,
            "refresh_interval": 30
          }
        },
        "secure": false,
        "value": "example-value"
      }
    }
  ]
}

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/variables" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get all global variables returns "OK" response
"""

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

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.list_global_variables()

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get all global variables returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
p api_instance.list_global_variables()

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get all global variables 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/datadogV1"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.ListGlobalVariables(ctx)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.ListGlobalVariables`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get all global variables returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsListGlobalVariablesResponse;

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

    try {
      SyntheticsListGlobalVariablesResponse result = apiInstance.listGlobalVariables();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#listGlobalVariables");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Get all global variables returns "OK" response
 */

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

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

apiInstance
  .listGlobalVariables()
  .then((data: v1.SyntheticsListGlobalVariablesResponse) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v1/synthetics/variableshttps://api.datadoghq.eu/api/v1/synthetics/variableshttps://api.ddog-gov.com/api/v1/synthetics/variableshttps://api.datadoghq.com/api/v1/synthetics/variableshttps://api.us3.datadoghq.com/api/v1/synthetics/variableshttps://api.us5.datadoghq.com/api/v1/synthetics/variables

概要

Synthetic グローバル変数を作成します。 This endpoint requires the synthetics_global_variable_write authorization scope.

リクエスト

Body Data (required)

作成するグローバル変数の詳細。

Expand All

フィールド

種類

説明

attributes

object

Attributes of the global variable.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

description [required]

string

Description of the global variable.

id

string

Unique identifier of the global variable.

name [required]

string

Name of the global variable. Unique across Synthetic global variables.

parse_test_options

object

Parser options to use for retrieving a Synthetic global variable from a Synthetic test. Used in conjunction with parse_test_public_id.

field

string

When type is http_header, name of the header to use to extract the value.

localVariableName

string

When type is local_variable, name of the local variable to use to extract the value.

parser

object

Details of the parser to use for the global variable.

type [required]

enum

Type of parser for a Synthetic global variable from a synthetics test. Allowed enum values: raw,json_path,regex,x_path

value

string

Regex or JSON path used for the parser. Not used with type raw.

type [required]

enum

Property of the Synthetic Test Response to use for a Synthetic global variable. Allowed enum values: http_body,http_header,local_variable

parse_test_public_id

string

A Synthetic test ID to use as a test to generate the variable value.

tags [required]

[string]

Tags of the global variable.

value [required]

object

Value of the global variable.

options

object

Options for the Global Variable for MFA.

totp_parameters

object

Parameters for the TOTP/MFA variable

digits

int32

Number of digits for the OTP code.

refresh_interval

int32

Interval for which to refresh the token (in seconds).

secure

boolean

Determines if the value of the variable is hidden.

value

string

Value of the global variable. When reading a global variable, the value will not be present if the variable is hidden with the secure property.

{
  "description": "",
  "name": "GLOBAL_VARIABLE_PAYLOAD_EXAMPLESYNTHETIC",
  "tags": [],
  "value": {
    "secure": false,
    "value": "",
    "options": {
      "totp_parameters": {
        "digits": 6,
        "refresh_interval": 30
      }
    }
  },
  "parse_test_public_id": "123-abc-456",
  "parse_test_options": {
    "type": "local_variable",
    "localVariableName": "EXTRACTED_VALUE"
  }
}

応答

OK

Synthetic global variable.

Expand All

フィールド

種類

説明

attributes

object

Attributes of the global variable.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

description [required]

string

Description of the global variable.

id

string

Unique identifier of the global variable.

name [required]

string

Name of the global variable. Unique across Synthetic global variables.

parse_test_options

object

Parser options to use for retrieving a Synthetic global variable from a Synthetic test. Used in conjunction with parse_test_public_id.

field

string

When type is http_header, name of the header to use to extract the value.

localVariableName

string

When type is local_variable, name of the local variable to use to extract the value.

parser

object

Details of the parser to use for the global variable.

type [required]

enum

Type of parser for a Synthetic global variable from a synthetics test. Allowed enum values: raw,json_path,regex,x_path

value

string

Regex or JSON path used for the parser. Not used with type raw.

type [required]

enum

Property of the Synthetic Test Response to use for a Synthetic global variable. Allowed enum values: http_body,http_header,local_variable

parse_test_public_id

string

A Synthetic test ID to use as a test to generate the variable value.

tags [required]

[string]

Tags of the global variable.

value [required]

object

Value of the global variable.

options

object

Options for the Global Variable for MFA.

totp_parameters

object

Parameters for the TOTP/MFA variable

digits

int32

Number of digits for the OTP code.

refresh_interval

int32

Interval for which to refresh the token (in seconds).

secure

boolean

Determines if the value of the variable is hidden.

value

string

Value of the global variable. When reading a global variable, the value will not be present if the variable is hidden with the secure property.

{
  "attributes": {
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ]
  },
  "description": "Example description",
  "id": "string",
  "name": "MY_VARIABLE",
  "parse_test_options": {
    "field": "content-type",
    "localVariableName": "LOCAL_VARIABLE",
    "parser": {
      "type": "raw",
      "value": "string"
    },
    "type": "http_body"
  },
  "parse_test_public_id": "abc-def-123",
  "tags": [
    "team:front",
    "test:workflow-1"
  ],
  "value": {
    "options": {
      "totp_parameters": {
        "digits": 6,
        "refresh_interval": 30
      }
    },
    "secure": false,
    "value": "example-value"
  }
}

Invalid request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Conflict

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                          # Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/variables" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "description": "", "name": "GLOBAL_VARIABLE_PAYLOAD_EXAMPLESYNTHETIC", "tags": [], "value": { "secure": false, "value": "", "options": { "totp_parameters": { "digits": 6, "refresh_interval": 30 } } }, "parse_test_public_id": "123-abc-456", "parse_test_options": { "type": "local_variable", "localVariableName": "EXTRACTED_VALUE" } } EOF
// Create a global variable from test 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/datadogV1"
)

func main() {
	// there is a valid "synthetics_api_test_multi_step" in the system
	SyntheticsAPITestMultiStepPublicID := os.Getenv("SYNTHETICS_API_TEST_MULTI_STEP_PUBLIC_ID")

	body := datadogV1.SyntheticsGlobalVariable{
		Description: "",
		Name:        "GLOBAL_VARIABLE_PAYLOAD_EXAMPLESYNTHETIC",
		Tags:        []string{},
		Value: datadogV1.SyntheticsGlobalVariableValue{
			Secure: datadog.PtrBool(false),
			Value:  datadog.PtrString(""),
			Options: &datadogV1.SyntheticsGlobalVariableOptions{
				TotpParameters: &datadogV1.SyntheticsGlobalVariableTOTPParameters{
					Digits:          datadog.PtrInt32(6),
					RefreshInterval: datadog.PtrInt32(30),
				},
			},
		},
		ParseTestPublicId: datadog.PtrString(SyntheticsAPITestMultiStepPublicID),
		ParseTestOptions: &datadogV1.SyntheticsGlobalVariableParseTestOptions{
			Type:              datadogV1.SYNTHETICSGLOBALVARIABLEPARSETESTOPTIONSTYPE_LOCAL_VARIABLE,
			LocalVariableName: datadog.PtrString("EXTRACTED_VALUE"),
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.CreateGlobalVariable(ctx, body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.CreateGlobalVariable`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Create a global variable from test returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsGlobalVariable;
import com.datadog.api.client.v1.model.SyntheticsGlobalVariableOptions;
import com.datadog.api.client.v1.model.SyntheticsGlobalVariableParseTestOptions;
import com.datadog.api.client.v1.model.SyntheticsGlobalVariableParseTestOptionsType;
import com.datadog.api.client.v1.model.SyntheticsGlobalVariableTOTPParameters;
import com.datadog.api.client.v1.model.SyntheticsGlobalVariableValue;

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

    // there is a valid "synthetics_api_test_multi_step" in the system
    String SYNTHETICS_API_TEST_MULTI_STEP_PUBLIC_ID =
        System.getenv("SYNTHETICS_API_TEST_MULTI_STEP_PUBLIC_ID");

    SyntheticsGlobalVariable body =
        new SyntheticsGlobalVariable()
            .description("")
            .name("GLOBAL_VARIABLE_PAYLOAD_EXAMPLESYNTHETIC")
            .value(
                new SyntheticsGlobalVariableValue()
                    .secure(false)
                    .value("")
                    .options(
                        new SyntheticsGlobalVariableOptions()
                            .totpParameters(
                                new SyntheticsGlobalVariableTOTPParameters()
                                    .digits(6)
                                    .refreshInterval(30))))
            .parseTestPublicId(SYNTHETICS_API_TEST_MULTI_STEP_PUBLIC_ID)
            .parseTestOptions(
                new SyntheticsGlobalVariableParseTestOptions()
                    .type(SyntheticsGlobalVariableParseTestOptionsType.LOCAL_VARIABLE)
                    .localVariableName("EXTRACTED_VALUE"));

    try {
      SyntheticsGlobalVariable result = apiInstance.createGlobalVariable(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#createGlobalVariable");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Create a global variable from test returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_global_variable import SyntheticsGlobalVariable
from datadog_api_client.v1.model.synthetics_global_variable_options import SyntheticsGlobalVariableOptions
from datadog_api_client.v1.model.synthetics_global_variable_parse_test_options import (
    SyntheticsGlobalVariableParseTestOptions,
)
from datadog_api_client.v1.model.synthetics_global_variable_parse_test_options_type import (
    SyntheticsGlobalVariableParseTestOptionsType,
)
from datadog_api_client.v1.model.synthetics_global_variable_totp_parameters import (
    SyntheticsGlobalVariableTOTPParameters,
)
from datadog_api_client.v1.model.synthetics_global_variable_value import SyntheticsGlobalVariableValue

# there is a valid "synthetics_api_test_multi_step" in the system
SYNTHETICS_API_TEST_MULTI_STEP_PUBLIC_ID = environ["SYNTHETICS_API_TEST_MULTI_STEP_PUBLIC_ID"]

body = SyntheticsGlobalVariable(
    description="",
    name="GLOBAL_VARIABLE_PAYLOAD_EXAMPLESYNTHETIC",
    tags=[],
    value=SyntheticsGlobalVariableValue(
        secure=False,
        value="",
        options=SyntheticsGlobalVariableOptions(
            totp_parameters=SyntheticsGlobalVariableTOTPParameters(
                digits=6,
                refresh_interval=30,
            ),
        ),
    ),
    parse_test_public_id=SYNTHETICS_API_TEST_MULTI_STEP_PUBLIC_ID,
    parse_test_options=SyntheticsGlobalVariableParseTestOptions(
        type=SyntheticsGlobalVariableParseTestOptionsType.LOCAL_VARIABLE,
        local_variable_name="EXTRACTED_VALUE",
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.create_global_variable(body=body)

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Create a global variable from test returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new

# there is a valid "synthetics_api_test_multi_step" in the system
SYNTHETICS_API_TEST_MULTI_STEP_PUBLIC_ID = ENV["SYNTHETICS_API_TEST_MULTI_STEP_PUBLIC_ID"]

body = DatadogAPIClient::V1::SyntheticsGlobalVariable.new({
  description: "",
  name: "GLOBAL_VARIABLE_PAYLOAD_EXAMPLESYNTHETIC",
  tags: [],
  value: DatadogAPIClient::V1::SyntheticsGlobalVariableValue.new({
    secure: false,
    value: "",
    options: DatadogAPIClient::V1::SyntheticsGlobalVariableOptions.new({
      totp_parameters: DatadogAPIClient::V1::SyntheticsGlobalVariableTOTPParameters.new({
        digits: 6,
        refresh_interval: 30,
      }),
    }),
  }),
  parse_test_public_id: SYNTHETICS_API_TEST_MULTI_STEP_PUBLIC_ID,
  parse_test_options: DatadogAPIClient::V1::SyntheticsGlobalVariableParseTestOptions.new({
    type: DatadogAPIClient::V1::SyntheticsGlobalVariableParseTestOptionsType::LOCAL_VARIABLE,
    local_variable_name: "EXTRACTED_VALUE",
  }),
})
p api_instance.create_global_variable(body)

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
/**
 * Create a global variable from test returns "OK" response
 */

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

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

// there is a valid "synthetics_api_test_multi_step" in the system
const SYNTHETICS_API_TEST_MULTI_STEP_PUBLIC_ID = process.env
  .SYNTHETICS_API_TEST_MULTI_STEP_PUBLIC_ID as string;

const params: v1.SyntheticsApiCreateGlobalVariableRequest = {
  body: {
    description: "",
    name: "GLOBAL_VARIABLE_PAYLOAD_EXAMPLESYNTHETIC",
    tags: [],
    value: {
      secure: false,
      value: "",
      options: {
        totpParameters: {
          digits: 6,
          refreshInterval: 30,
        },
      },
    },
    parseTestPublicId: SYNTHETICS_API_TEST_MULTI_STEP_PUBLIC_ID,
    parseTestOptions: {
      type: "local_variable",
      localVariableName: "EXTRACTED_VALUE",
    },
  },
};

apiInstance
  .createGlobalVariable(params)
  .then((data: v1.SyntheticsGlobalVariable) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v1/synthetics/variables/{variable_id}https://api.datadoghq.eu/api/v1/synthetics/variables/{variable_id}https://api.ddog-gov.com/api/v1/synthetics/variables/{variable_id}https://api.datadoghq.com/api/v1/synthetics/variables/{variable_id}https://api.us3.datadoghq.com/api/v1/synthetics/variables/{variable_id}https://api.us5.datadoghq.com/api/v1/synthetics/variables/{variable_id}

概要

グローバル変数の詳細なコンフィギュレーションを取得します。 This endpoint requires the synthetics_global_variable_read authorization scope.

引数

パスパラメーター

名前

種類

説明

variable_id [required]

string

The ID of the global variable.

応答

OK

Synthetic global variable.

Expand All

フィールド

種類

説明

attributes

object

Attributes of the global variable.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

description [required]

string

Description of the global variable.

id

string

Unique identifier of the global variable.

name [required]

string

Name of the global variable. Unique across Synthetic global variables.

parse_test_options

object

Parser options to use for retrieving a Synthetic global variable from a Synthetic test. Used in conjunction with parse_test_public_id.

field

string

When type is http_header, name of the header to use to extract the value.

localVariableName

string

When type is local_variable, name of the local variable to use to extract the value.

parser

object

Details of the parser to use for the global variable.

type [required]

enum

Type of parser for a Synthetic global variable from a synthetics test. Allowed enum values: raw,json_path,regex,x_path

value

string

Regex or JSON path used for the parser. Not used with type raw.

type [required]

enum

Property of the Synthetic Test Response to use for a Synthetic global variable. Allowed enum values: http_body,http_header,local_variable

parse_test_public_id

string

A Synthetic test ID to use as a test to generate the variable value.

tags [required]

[string]

Tags of the global variable.

value [required]

object

Value of the global variable.

options

object

Options for the Global Variable for MFA.

totp_parameters

object

Parameters for the TOTP/MFA variable

digits

int32

Number of digits for the OTP code.

refresh_interval

int32

Interval for which to refresh the token (in seconds).

secure

boolean

Determines if the value of the variable is hidden.

value

string

Value of the global variable. When reading a global variable, the value will not be present if the variable is hidden with the secure property.

{
  "attributes": {
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ]
  },
  "description": "Example description",
  "id": "string",
  "name": "MY_VARIABLE",
  "parse_test_options": {
    "field": "content-type",
    "localVariableName": "LOCAL_VARIABLE",
    "parser": {
      "type": "raw",
      "value": "string"
    },
    "type": "http_body"
  },
  "parse_test_public_id": "abc-def-123",
  "tags": [
    "team:front",
    "test:workflow-1"
  ],
  "value": {
    "options": {
      "totp_parameters": {
        "digits": 6,
        "refresh_interval": 30
      }
    },
    "secure": false,
    "value": "example-value"
  }
}

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Not found

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                  # Path parameters
export variable_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/variables/${variable_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get a global variable returns "OK" response
"""

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

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.get_global_variable(
        variable_id="variable_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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get a global variable returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
p api_instance.get_global_variable("variable_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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get a global variable 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/datadogV1"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.GetGlobalVariable(ctx, "variable_id")

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.GetGlobalVariable`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get a global variable returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsGlobalVariable;

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

    try {
      SyntheticsGlobalVariable result = apiInstance.getGlobalVariable("variable_id");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#getGlobalVariable");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Get a global variable returns "OK" response
 */

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

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

const params: v1.SyntheticsApiGetGlobalVariableRequest = {
  variableId: "variable_id",
};

apiInstance
  .getGlobalVariable(params)
  .then((data: v1.SyntheticsGlobalVariable) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

PUT https://api.ap1.datadoghq.com/api/v1/synthetics/variables/{variable_id}https://api.datadoghq.eu/api/v1/synthetics/variables/{variable_id}https://api.ddog-gov.com/api/v1/synthetics/variables/{variable_id}https://api.datadoghq.com/api/v1/synthetics/variables/{variable_id}https://api.us3.datadoghq.com/api/v1/synthetics/variables/{variable_id}https://api.us5.datadoghq.com/api/v1/synthetics/variables/{variable_id}

概要

Synthetic グローバル変数を編集します。 This endpoint requires the synthetics_global_variable_write authorization scope.

引数

パスパラメーター

名前

種類

説明

variable_id [required]

string

The ID of the global variable.

リクエスト

Body Data (required)

更新するグローバル変数の詳細。

Expand All

フィールド

種類

説明

attributes

object

Attributes of the global variable.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

description [required]

string

Description of the global variable.

id

string

Unique identifier of the global variable.

name [required]

string

Name of the global variable. Unique across Synthetic global variables.

parse_test_options

object

Parser options to use for retrieving a Synthetic global variable from a Synthetic test. Used in conjunction with parse_test_public_id.

field

string

When type is http_header, name of the header to use to extract the value.

localVariableName

string

When type is local_variable, name of the local variable to use to extract the value.

parser

object

Details of the parser to use for the global variable.

type [required]

enum

Type of parser for a Synthetic global variable from a synthetics test. Allowed enum values: raw,json_path,regex,x_path

value

string

Regex or JSON path used for the parser. Not used with type raw.

type [required]

enum

Property of the Synthetic Test Response to use for a Synthetic global variable. Allowed enum values: http_body,http_header,local_variable

parse_test_public_id

string

A Synthetic test ID to use as a test to generate the variable value.

tags [required]

[string]

Tags of the global variable.

value [required]

object

Value of the global variable.

options

object

Options for the Global Variable for MFA.

totp_parameters

object

Parameters for the TOTP/MFA variable

digits

int32

Number of digits for the OTP code.

refresh_interval

int32

Interval for which to refresh the token (in seconds).

secure

boolean

Determines if the value of the variable is hidden.

value

string

Value of the global variable. When reading a global variable, the value will not be present if the variable is hidden with the secure property.

{
  "attributes": {
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ]
  },
  "description": "Example description",
  "name": "MY_VARIABLE",
  "parse_test_options": {
    "field": "content-type",
    "localVariableName": "LOCAL_VARIABLE",
    "parser": {
      "type": "raw",
      "value": "string"
    },
    "type": "http_body"
  },
  "parse_test_public_id": "abc-def-123",
  "tags": [
    "team:front",
    "test:workflow-1"
  ],
  "value": {
    "options": {
      "totp_parameters": {
        "digits": 6,
        "refresh_interval": 30
      }
    },
    "secure": false,
    "value": "example-value"
  }
}

応答

OK

Synthetic global variable.

Expand All

フィールド

種類

説明

attributes

object

Attributes of the global variable.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

description [required]

string

Description of the global variable.

id

string

Unique identifier of the global variable.

name [required]

string

Name of the global variable. Unique across Synthetic global variables.

parse_test_options

object

Parser options to use for retrieving a Synthetic global variable from a Synthetic test. Used in conjunction with parse_test_public_id.

field

string

When type is http_header, name of the header to use to extract the value.

localVariableName

string

When type is local_variable, name of the local variable to use to extract the value.

parser

object

Details of the parser to use for the global variable.

type [required]

enum

Type of parser for a Synthetic global variable from a synthetics test. Allowed enum values: raw,json_path,regex,x_path

value

string

Regex or JSON path used for the parser. Not used with type raw.

type [required]

enum

Property of the Synthetic Test Response to use for a Synthetic global variable. Allowed enum values: http_body,http_header,local_variable

parse_test_public_id

string

A Synthetic test ID to use as a test to generate the variable value.

tags [required]

[string]

Tags of the global variable.

value [required]

object

Value of the global variable.

options

object

Options for the Global Variable for MFA.

totp_parameters

object

Parameters for the TOTP/MFA variable

digits

int32

Number of digits for the OTP code.

refresh_interval

int32

Interval for which to refresh the token (in seconds).

secure

boolean

Determines if the value of the variable is hidden.

value

string

Value of the global variable. When reading a global variable, the value will not be present if the variable is hidden with the secure property.

{
  "attributes": {
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ]
  },
  "description": "Example description",
  "id": "string",
  "name": "MY_VARIABLE",
  "parse_test_options": {
    "field": "content-type",
    "localVariableName": "LOCAL_VARIABLE",
    "parser": {
      "type": "raw",
      "value": "string"
    },
    "type": "http_body"
  },
  "parse_test_public_id": "abc-def-123",
  "tags": [
    "team:front",
    "test:workflow-1"
  ],
  "value": {
    "options": {
      "totp_parameters": {
        "digits": 6,
        "refresh_interval": 30
      }
    },
    "secure": false,
    "value": "example-value"
  }
}

Invalid request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                  # Path parameters
export variable_id="CHANGE_ME"
# Curl command
curl -X PUT "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/variables/${variable_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "description": "Example description", "name": "MY_VARIABLE", "parse_test_options": { "parser": { "type": "raw" }, "type": "http_body" }, "tags": [ "team:front", "test:workflow-1" ], "value": {} } EOF
"""
Edit a global variable returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_global_variable import SyntheticsGlobalVariable
from datadog_api_client.v1.model.synthetics_global_variable_attributes import SyntheticsGlobalVariableAttributes
from datadog_api_client.v1.model.synthetics_global_variable_parse_test_options import (
    SyntheticsGlobalVariableParseTestOptions,
)
from datadog_api_client.v1.model.synthetics_global_variable_parse_test_options_type import (
    SyntheticsGlobalVariableParseTestOptionsType,
)
from datadog_api_client.v1.model.synthetics_global_variable_parser_type import SyntheticsGlobalVariableParserType
from datadog_api_client.v1.model.synthetics_global_variable_value import SyntheticsGlobalVariableValue
from datadog_api_client.v1.model.synthetics_restricted_roles import SyntheticsRestrictedRoles
from datadog_api_client.v1.model.synthetics_variable_parser import SyntheticsVariableParser

body = SyntheticsGlobalVariable(
    attributes=SyntheticsGlobalVariableAttributes(
        restricted_roles=SyntheticsRestrictedRoles(
            [
                "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
            ]
        ),
    ),
    description="Example description",
    name="MY_VARIABLE",
    parse_test_options=SyntheticsGlobalVariableParseTestOptions(
        field="content-type",
        local_variable_name="LOCAL_VARIABLE",
        parser=SyntheticsVariableParser(
            type=SyntheticsGlobalVariableParserType.REGEX,
            value=".*",
        ),
        type=SyntheticsGlobalVariableParseTestOptionsType.HTTP_BODY,
    ),
    parse_test_public_id="abc-def-123",
    tags=[
        "team:front",
        "test:workflow-1",
    ],
    value=SyntheticsGlobalVariableValue(
        secure=True,
        value="value",
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.edit_global_variable(variable_id="variable_id", body=body)

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Edit a global variable returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new

body = DatadogAPIClient::V1::SyntheticsGlobalVariable.new({
  attributes: DatadogAPIClient::V1::SyntheticsGlobalVariableAttributes.new({
    restricted_roles: [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    ],
  }),
  description: "Example description",
  name: "MY_VARIABLE",
  parse_test_options: DatadogAPIClient::V1::SyntheticsGlobalVariableParseTestOptions.new({
    field: "content-type",
    local_variable_name: "LOCAL_VARIABLE",
    parser: DatadogAPIClient::V1::SyntheticsVariableParser.new({
      type: DatadogAPIClient::V1::SyntheticsGlobalVariableParserType::REGEX,
      value: ".*",
    }),
    type: DatadogAPIClient::V1::SyntheticsGlobalVariableParseTestOptionsType::HTTP_BODY,
  }),
  parse_test_public_id: "abc-def-123",
  tags: [
    "team:front",
    "test:workflow-1",
  ],
  value: DatadogAPIClient::V1::SyntheticsGlobalVariableValue.new({
    secure: true,
    value: "value",
  }),
})
p api_instance.edit_global_variable("variable_id", body)

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Edit a global variable 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/datadogV1"
)

func main() {
	body := datadogV1.SyntheticsGlobalVariable{
		Attributes: &datadogV1.SyntheticsGlobalVariableAttributes{
			RestrictedRoles: []string{
				"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
			},
		},
		Description: "Example description",
		Name:        "MY_VARIABLE",
		ParseTestOptions: &datadogV1.SyntheticsGlobalVariableParseTestOptions{
			Field:             datadog.PtrString("content-type"),
			LocalVariableName: datadog.PtrString("LOCAL_VARIABLE"),
			Parser: &datadogV1.SyntheticsVariableParser{
				Type:  datadogV1.SYNTHETICSGLOBALVARIABLEPARSERTYPE_REGEX,
				Value: datadog.PtrString(".*"),
			},
			Type: datadogV1.SYNTHETICSGLOBALVARIABLEPARSETESTOPTIONSTYPE_HTTP_BODY,
		},
		ParseTestPublicId: datadog.PtrString("abc-def-123"),
		Tags: []string{
			"team:front",
			"test:workflow-1",
		},
		Value: datadogV1.SyntheticsGlobalVariableValue{
			Secure: datadog.PtrBool(true),
			Value:  datadog.PtrString("value"),
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.EditGlobalVariable(ctx, "variable_id", body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.EditGlobalVariable`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Edit a global variable returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsGlobalVariable;
import com.datadog.api.client.v1.model.SyntheticsGlobalVariableAttributes;
import com.datadog.api.client.v1.model.SyntheticsGlobalVariableParseTestOptions;
import com.datadog.api.client.v1.model.SyntheticsGlobalVariableParseTestOptionsType;
import com.datadog.api.client.v1.model.SyntheticsGlobalVariableParserType;
import com.datadog.api.client.v1.model.SyntheticsGlobalVariableValue;
import com.datadog.api.client.v1.model.SyntheticsVariableParser;
import java.util.Arrays;
import java.util.Collections;

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

    SyntheticsGlobalVariable body =
        new SyntheticsGlobalVariable()
            .attributes(
                new SyntheticsGlobalVariableAttributes()
                    .restrictedRoles(
                        Collections.singletonList("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")))
            .description("Example description")
            .name("MY_VARIABLE")
            .parseTestOptions(
                new SyntheticsGlobalVariableParseTestOptions()
                    .field("content-type")
                    .localVariableName("LOCAL_VARIABLE")
                    .parser(
                        new SyntheticsVariableParser()
                            .type(SyntheticsGlobalVariableParserType.REGEX)
                            .value(".*"))
                    .type(SyntheticsGlobalVariableParseTestOptionsType.HTTP_BODY))
            .parseTestPublicId("abc-def-123")
            .tags(Arrays.asList("team:front", "test:workflow-1"))
            .value(new SyntheticsGlobalVariableValue().secure(true).value("value"));

    try {
      SyntheticsGlobalVariable result = apiInstance.editGlobalVariable("variable_id", body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#editGlobalVariable");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Edit a global variable returns "OK" response
 */

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

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

const params: v1.SyntheticsApiEditGlobalVariableRequest = {
  body: {
    attributes: {
      restrictedRoles: ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"],
    },
    description: "Example description",
    name: "MY_VARIABLE",
    parseTestOptions: {
      field: "content-type",
      localVariableName: "LOCAL_VARIABLE",
      parser: {
        type: "regex",
        value: ".*",
      },
      type: "http_body",
    },
    parseTestPublicId: "abc-def-123",
    tags: ["team:front", "test:workflow-1"],
    value: {
      secure: true,
      value: "value",
    },
  },
  variableId: "variable_id",
};

apiInstance
  .editGlobalVariable(params)
  .then((data: v1.SyntheticsGlobalVariable) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

DELETE https://api.ap1.datadoghq.com/api/v1/synthetics/variables/{variable_id}https://api.datadoghq.eu/api/v1/synthetics/variables/{variable_id}https://api.ddog-gov.com/api/v1/synthetics/variables/{variable_id}https://api.datadoghq.com/api/v1/synthetics/variables/{variable_id}https://api.us3.datadoghq.com/api/v1/synthetics/variables/{variable_id}https://api.us5.datadoghq.com/api/v1/synthetics/variables/{variable_id}

概要

Synthetic グローバル変数を削除します。 This endpoint requires the synthetics_global_variable_write authorization scope.

引数

パスパラメーター

名前

種類

説明

variable_id [required]

string

The ID of the global variable.

応答

OK

JSON format is wrong

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Not found

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                  # Path parameters
export variable_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/variables/${variable_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Delete a global variable returns "OK" response
"""

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

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    api_instance.delete_global_variable(
        variable_id="variable_id",
    )

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Delete a global variable returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
p api_instance.delete_global_variable("variable_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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Delete a global variable returns "OK" response

package main

import (
	"context"
	"fmt"
	"os"

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

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	r, err := api.DeleteGlobalVariable(ctx, "variable_id")

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

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Delete a global variable returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;

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

    try {
      apiInstance.deleteGlobalVariable("variable_id");
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#deleteGlobalVariable");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Delete a global variable returns "OK" response
 */

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

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

const params: v1.SyntheticsApiDeleteGlobalVariableRequest = {
  variableId: "variable_id",
};

apiInstance
  .deleteGlobalVariable(params)
  .then((data: any) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v1/synthetics/private-locationshttps://api.datadoghq.eu/api/v1/synthetics/private-locationshttps://api.ddog-gov.com/api/v1/synthetics/private-locationshttps://api.datadoghq.com/api/v1/synthetics/private-locationshttps://api.us3.datadoghq.com/api/v1/synthetics/private-locationshttps://api.us5.datadoghq.com/api/v1/synthetics/private-locations

概要

新しい Synthetic プライベートロケーションを作成します。 This endpoint requires the synthetics_private_location_write authorization scope.

リクエスト

Body Data (required)

作成するプライベートロケーションの詳細。

Expand All

フィールド

種類

説明

description [required]

string

Description of the private location.

id

string

Unique identifier of the private location.

metadata

object

Object containing metadata about the private location.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

name [required]

string

Name of the private location.

secrets

object

Secrets for the private location. Only present in the response when creating the private location.

authentication

object

Authentication part of the secrets.

id

string

Access key for the private location.

key

string

Secret access key for the private location.

config_decryption

object

Private key for the private location.

key

string

Private key for the private location.

tags [required]

[string]

Array of tags attached to the private location.

{
  "description": "Test Example-Synthetic description",
  "metadata": {
    "restricted_roles": [
      "string"
    ]
  },
  "name": "Example-Synthetic",
  "tags": [
    "test:examplesynthetic"
  ]
}

応答

OK

Object that contains the new private location, the public key for result encryption, and the configuration skeleton.

Expand All

フィールド

種類

説明

config

object

Configuration skeleton for the private location. See installation instructions of the private location on how to use this configuration.

private_location

object

Object containing information about the private location to create.

description [required]

string

Description of the private location.

id

string

Unique identifier of the private location.

metadata

object

Object containing metadata about the private location.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

name [required]

string

Name of the private location.

secrets

object

Secrets for the private location. Only present in the response when creating the private location.

authentication

object

Authentication part of the secrets.

id

string

Access key for the private location.

key

string

Secret access key for the private location.

config_decryption

object

Private key for the private location.

key

string

Private key for the private location.

tags [required]

[string]

Array of tags attached to the private location.

result_encryption

object

Public key for the result encryption.

id

string

Fingerprint for the encryption key.

key

string

Public key for result encryption.

{
  "config": {},
  "private_location": {
    "description": "Description of private location",
    "id": "string",
    "metadata": {
      "restricted_roles": [
        "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      ]
    },
    "name": "New private location",
    "secrets": {
      "authentication": {
        "id": "string",
        "key": "string"
      },
      "config_decryption": {
        "key": "string"
      }
    },
    "tags": [
      "team:front"
    ]
  },
  "result_encryption": {
    "id": "string",
    "key": "string"
  }
}

Quota reached for private locations

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Private locations are not activated for the user

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                          # Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/private-locations" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "description": "Test Example-Synthetic description", "metadata": { "restricted_roles": [ "string" ] }, "name": "Example-Synthetic", "tags": [ "test:examplesynthetic" ] } EOF
// Create a private location 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/datadogV1"
)

func main() {
	// there is a valid "role" in the system
	RoleDataID := os.Getenv("ROLE_DATA_ID")

	body := datadogV1.SyntheticsPrivateLocation{
		Description: "Test Example-Synthetic description",
		Metadata: &datadogV1.SyntheticsPrivateLocationMetadata{
			RestrictedRoles: []string{
				RoleDataID,
			},
		},
		Name: "Example-Synthetic",
		Tags: []string{
			"test:examplesynthetic",
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.CreatePrivateLocation(ctx, body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.CreatePrivateLocation`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Create a private location returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsPrivateLocation;
import com.datadog.api.client.v1.model.SyntheticsPrivateLocationCreationResponse;
import com.datadog.api.client.v1.model.SyntheticsPrivateLocationMetadata;
import java.util.Collections;

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

    // there is a valid "role" in the system
    String ROLE_DATA_ID = System.getenv("ROLE_DATA_ID");

    SyntheticsPrivateLocation body =
        new SyntheticsPrivateLocation()
            .description("Test Example-Synthetic description")
            .metadata(
                new SyntheticsPrivateLocationMetadata()
                    .restrictedRoles(Collections.singletonList(ROLE_DATA_ID)))
            .name("Example-Synthetic")
            .tags(Collections.singletonList("test:examplesynthetic"));

    try {
      SyntheticsPrivateLocationCreationResponse result = apiInstance.createPrivateLocation(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#createPrivateLocation");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Create a private location returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_private_location import SyntheticsPrivateLocation
from datadog_api_client.v1.model.synthetics_private_location_metadata import SyntheticsPrivateLocationMetadata
from datadog_api_client.v1.model.synthetics_restricted_roles import SyntheticsRestrictedRoles

# there is a valid "role" in the system
ROLE_DATA_ID = environ["ROLE_DATA_ID"]

body = SyntheticsPrivateLocation(
    description="Test Example-Synthetic description",
    metadata=SyntheticsPrivateLocationMetadata(
        restricted_roles=SyntheticsRestrictedRoles(
            [
                ROLE_DATA_ID,
            ]
        ),
    ),
    name="Example-Synthetic",
    tags=[
        "test:examplesynthetic",
    ],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.create_private_location(body=body)

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Create a private location returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new

# there is a valid "role" in the system
ROLE_DATA_ID = ENV["ROLE_DATA_ID"]

body = DatadogAPIClient::V1::SyntheticsPrivateLocation.new({
  description: "Test Example-Synthetic description",
  metadata: DatadogAPIClient::V1::SyntheticsPrivateLocationMetadata.new({
    restricted_roles: [
      ROLE_DATA_ID,
    ],
  }),
  name: "Example-Synthetic",
  tags: [
    "test:examplesynthetic",
  ],
})
p api_instance.create_private_location(body)

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
/**
 * Create a private location returns "OK" response
 */

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

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

// there is a valid "role" in the system
const ROLE_DATA_ID = process.env.ROLE_DATA_ID as string;

const params: v1.SyntheticsApiCreatePrivateLocationRequest = {
  body: {
    description: "Test Example-Synthetic description",
    metadata: {
      restrictedRoles: [ROLE_DATA_ID],
    },
    name: "Example-Synthetic",
    tags: ["test:examplesynthetic"],
  },
};

apiInstance
  .createPrivateLocation(params)
  .then((data: v1.SyntheticsPrivateLocationCreationResponse) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v1/synthetics/private-locations/{location_id}https://api.datadoghq.eu/api/v1/synthetics/private-locations/{location_id}https://api.ddog-gov.com/api/v1/synthetics/private-locations/{location_id}https://api.datadoghq.com/api/v1/synthetics/private-locations/{location_id}https://api.us3.datadoghq.com/api/v1/synthetics/private-locations/{location_id}https://api.us5.datadoghq.com/api/v1/synthetics/private-locations/{location_id}

概要

Synthetic プライベートロケーションを取得します。 This endpoint requires the synthetics_private_location_read authorization scope.

引数

パスパラメーター

名前

種類

説明

location_id [required]

string

The ID of the private location.

応答

OK

Object containing information about the private location to create.

Expand All

フィールド

種類

説明

description [required]

string

Description of the private location.

id

string

Unique identifier of the private location.

metadata

object

Object containing metadata about the private location.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

name [required]

string

Name of the private location.

secrets

object

Secrets for the private location. Only present in the response when creating the private location.

authentication

object

Authentication part of the secrets.

id

string

Access key for the private location.

key

string

Secret access key for the private location.

config_decryption

object

Private key for the private location.

key

string

Private key for the private location.

tags [required]

[string]

Array of tags attached to the private location.

{
  "description": "Description of private location",
  "id": "string",
  "metadata": {
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ]
  },
  "name": "New private location",
  "secrets": {
    "authentication": {
      "id": "string",
      "key": "string"
    },
    "config_decryption": {
      "key": "string"
    }
  },
  "tags": [
    "team:front"
  ]
}

- Synthetic private locations are not activated for the user - Private location does not exist

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                  # Path parameters
export location_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/private-locations/${location_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get a private location returns "OK" response
"""

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

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.get_private_location(
        location_id="location_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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get a private location returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
p api_instance.get_private_location("location_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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get a private location 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/datadogV1"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.GetPrivateLocation(ctx, "location_id")

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.GetPrivateLocation`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get a private location returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsPrivateLocation;

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

    try {
      SyntheticsPrivateLocation result = apiInstance.getPrivateLocation("location_id");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#getPrivateLocation");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Get a private location returns "OK" response
 */

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

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

const params: v1.SyntheticsApiGetPrivateLocationRequest = {
  locationId: "location_id",
};

apiInstance
  .getPrivateLocation(params)
  .then((data: v1.SyntheticsPrivateLocation) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

PUT https://api.ap1.datadoghq.com/api/v1/synthetics/private-locations/{location_id}https://api.datadoghq.eu/api/v1/synthetics/private-locations/{location_id}https://api.ddog-gov.com/api/v1/synthetics/private-locations/{location_id}https://api.datadoghq.com/api/v1/synthetics/private-locations/{location_id}https://api.us3.datadoghq.com/api/v1/synthetics/private-locations/{location_id}https://api.us5.datadoghq.com/api/v1/synthetics/private-locations/{location_id}

概要

Synthetic プライベートロケーションを編集します。 This endpoint requires the synthetics_private_location_write authorization scope.

引数

パスパラメーター

名前

種類

説明

location_id [required]

string

The ID of the private location.

リクエスト

Body Data (required)

更新するプライベートロケーションの詳細。

Expand All

フィールド

種類

説明

description [required]

string

Description of the private location.

id

string

Unique identifier of the private location.

metadata

object

Object containing metadata about the private location.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

name [required]

string

Name of the private location.

secrets

object

Secrets for the private location. Only present in the response when creating the private location.

authentication

object

Authentication part of the secrets.

id

string

Access key for the private location.

key

string

Secret access key for the private location.

config_decryption

object

Private key for the private location.

key

string

Private key for the private location.

tags [required]

[string]

Array of tags attached to the private location.

{
  "description": "Description of private location",
  "metadata": {
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ]
  },
  "name": "New private location",
  "tags": [
    "team:front"
  ]
}

応答

OK

Object containing information about the private location to create.

Expand All

フィールド

種類

説明

description [required]

string

Description of the private location.

id

string

Unique identifier of the private location.

metadata

object

Object containing metadata about the private location.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

name [required]

string

Name of the private location.

secrets

object

Secrets for the private location. Only present in the response when creating the private location.

authentication

object

Authentication part of the secrets.

id

string

Access key for the private location.

key

string

Secret access key for the private location.

config_decryption

object

Private key for the private location.

key

string

Private key for the private location.

tags [required]

[string]

Array of tags attached to the private location.

{
  "description": "Description of private location",
  "id": "string",
  "metadata": {
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ]
  },
  "name": "New private location",
  "secrets": {
    "authentication": {
      "id": "string",
      "key": "string"
    },
    "config_decryption": {
      "key": "string"
    }
  },
  "tags": [
    "team:front"
  ]
}

- Private locations are not activated for the user - Private location does not exist

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                  # Path parameters
export location_id="CHANGE_ME"
# Curl command
curl -X PUT "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/private-locations/${location_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "description": "Description of private location", "name": "New private location", "tags": [ "team:front" ] } EOF
"""
Edit a private location returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_private_location import SyntheticsPrivateLocation
from datadog_api_client.v1.model.synthetics_private_location_metadata import SyntheticsPrivateLocationMetadata
from datadog_api_client.v1.model.synthetics_restricted_roles import SyntheticsRestrictedRoles

body = SyntheticsPrivateLocation(
    description="Description of private location",
    metadata=SyntheticsPrivateLocationMetadata(
        restricted_roles=SyntheticsRestrictedRoles(
            [
                "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
            ]
        ),
    ),
    name="New private location",
    tags=[
        "team:front",
    ],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.update_private_location(location_id="location_id", body=body)

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Edit a private location returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new

body = DatadogAPIClient::V1::SyntheticsPrivateLocation.new({
  description: "Description of private location",
  metadata: DatadogAPIClient::V1::SyntheticsPrivateLocationMetadata.new({
    restricted_roles: [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    ],
  }),
  name: "New private location",
  tags: [
    "team:front",
  ],
})
p api_instance.update_private_location("location_id", body)

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Edit a private location 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/datadogV1"
)

func main() {
	body := datadogV1.SyntheticsPrivateLocation{
		Description: "Description of private location",
		Metadata: &datadogV1.SyntheticsPrivateLocationMetadata{
			RestrictedRoles: []string{
				"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
			},
		},
		Name: "New private location",
		Tags: []string{
			"team:front",
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.UpdatePrivateLocation(ctx, "location_id", body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.UpdatePrivateLocation`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Edit a private location returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsPrivateLocation;
import com.datadog.api.client.v1.model.SyntheticsPrivateLocationMetadata;
import java.util.Collections;

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

    SyntheticsPrivateLocation body =
        new SyntheticsPrivateLocation()
            .description("Description of private location")
            .metadata(
                new SyntheticsPrivateLocationMetadata()
                    .restrictedRoles(
                        Collections.singletonList("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")))
            .name("New private location")
            .tags(Collections.singletonList("team:front"));

    try {
      SyntheticsPrivateLocation result = apiInstance.updatePrivateLocation("location_id", body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#updatePrivateLocation");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Edit a private location returns "OK" response
 */

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

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

const params: v1.SyntheticsApiUpdatePrivateLocationRequest = {
  body: {
    description: "Description of private location",
    metadata: {
      restrictedRoles: ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"],
    },
    name: "New private location",
    tags: ["team:front"],
  },
  locationId: "location_id",
};

apiInstance
  .updatePrivateLocation(params)
  .then((data: v1.SyntheticsPrivateLocation) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v1/synthetics/locationshttps://api.datadoghq.eu/api/v1/synthetics/locationshttps://api.ddog-gov.com/api/v1/synthetics/locationshttps://api.datadoghq.com/api/v1/synthetics/locationshttps://api.us3.datadoghq.com/api/v1/synthetics/locationshttps://api.us5.datadoghq.com/api/v1/synthetics/locations

概要

Synthetic テストで利用可能なパブリックおよびプライベートのロケーションリストを取得します。引数は不要です。 This endpoint requires the synthetics_private_location_read authorization scope.

応答

OK

List of Synthetic locations.

Expand All

フィールド

種類

説明

locations

[object]

List of Synthetic locations.

id

string

Unique identifier of the location.

name

string

Name of the location.

{
  "locations": [
    {
      "id": "string",
      "name": "string"
    }
  ]
}

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/locations" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get all locations (public and private) returns "OK" response
"""

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

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.list_locations()

    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get all locations (public and private) returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
p api_instance.list_locations()

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get all locations (public and private) 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/datadogV1"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.ListLocations(ctx)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.ListLocations`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get all locations (public and private) returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsLocations;

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

    try {
      SyntheticsLocations result = apiInstance.listLocations();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#listLocations");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Get all locations (public and private) returns "OK" response
 */

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

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

apiInstance
  .listLocations()
  .then((data: v1.SyntheticsLocations) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

DELETE https://api.ap1.datadoghq.com/api/v1/synthetics/private-locations/{location_id}https://api.datadoghq.eu/api/v1/synthetics/private-locations/{location_id}https://api.ddog-gov.com/api/v1/synthetics/private-locations/{location_id}https://api.datadoghq.com/api/v1/synthetics/private-locations/{location_id}https://api.us3.datadoghq.com/api/v1/synthetics/private-locations/{location_id}https://api.us5.datadoghq.com/api/v1/synthetics/private-locations/{location_id}

概要

Synthetic プライベートロケーションを削除します。 This endpoint requires the synthetics_private_location_write authorization scope.

引数

パスパラメーター

名前

種類

説明

location_id [required]

string

The ID of the private location.

応答

OK

- Private locations are not activated for the user - Private location does not exist

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                  # Path parameters
export location_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/private-locations/${location_id}" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Delete a private location returns "OK" response
"""

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

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    api_instance.delete_private_location(
        location_id="location_id",
    )

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Delete a private location returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
api_instance.delete_private_location("location_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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Delete a private location returns "OK" response

package main

import (
	"context"
	"fmt"
	"os"

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

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	r, err := api.DeletePrivateLocation(ctx, "location_id")

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

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Delete a private location returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;

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

    try {
      apiInstance.deletePrivateLocation("location_id");
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#deletePrivateLocation");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Delete a private location returns "OK" response
 */

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

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

const params: v1.SyntheticsApiDeletePrivateLocationRequest = {
  locationId: "location_id",
};

apiInstance
  .deletePrivateLocation(params)
  .then((data: any) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v1/synthetics/tests/{public_id}https://api.datadoghq.eu/api/v1/synthetics/tests/{public_id}https://api.ddog-gov.com/api/v1/synthetics/tests/{public_id}https://api.datadoghq.com/api/v1/synthetics/tests/{public_id}https://api.us3.datadoghq.com/api/v1/synthetics/tests/{public_id}https://api.us5.datadoghq.com/api/v1/synthetics/tests/{public_id}

概要

Synthetic テストに関連する詳細なコンフィギュレーションを取得します。 This endpoint requires the synthetics_read authorization scope.

引数

パスパラメーター

名前

種類

説明

public_id [required]

string

The public ID of the test to get details from.

応答

OK

Object containing details about your Synthetic test.

Expand All

フィールド

種類

説明

config

object

Configuration object for a Synthetic test.

assertions

[ <oneOf>]

Array of assertions used for the test. Required for single API tests.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

configVariables

[object]

Array of variables used for the test.

example

string

Example for the variable.

id

string

ID of the variable for global variables.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Whether the value of this variable will be obfuscated in test results. Only for config variables of type text.

type [required]

enum

Type of the configuration variable. Allowed enum values: global,text

request

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

variables

[object]

Browser tests only - array of variables used for the test steps.

example

string

Example for the variable.

id

string

ID for the variable. Global variables require an ID.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Determines whether or not the browser test variable is obfuscated. Can only be used with browser variables of type text.

type [required]

enum

Type of browser test variable. Allowed enum values: element,email,global,javascript,text

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

locations

[string]

Array of locations used to run the test.

message

string

Notification message associated with the test.

monitor_id

int64

The associated monitor ID.

name

string

Name of the test.

options

object

Object describing the extra options for a Synthetic test.

accept_self_signed

boolean

For SSL test, whether or not the test should allow self signed certificates.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in an API test.

checkCertificateRevocation

boolean

For SSL test, whether or not the test should fail on revoked certificate in stapled OCSP.

ci

object

CI/CD options for a Synthetic test.

executionRule

enum

Execution rule for a Synthetic test. Allowed enum values: blocking,non_blocking,skipped

device_ids

[string]

For browser test, array with the different device IDs used to run the test.

disableCors

boolean

Whether or not to disable CORS mechanism.

disableCsp

boolean

Disable Content Security Policy for browser tests.

enableProfiling

boolean

Enable profiling for browser tests.

enableSecurityTesting

boolean

DEPRECATED: Enable security testing for browser tests. Security testing is not available anymore. This field is deprecated and won't be used.

follow_redirects

boolean

For API HTTP test, whether or not the test should follow redirects.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

ignoreServerCertificateError

boolean

Ignore server certificate error for browser tests.

initialNavigationTimeout

int64

Timeout before declaring the initial step as failed (in seconds) for browser tests.

min_failure_duration

int64

Minimum amount of time in failure required to trigger an alert.

min_location_failed

int64

Minimum number of locations in failure required to trigger an alert.

monitor_name

string

The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.

monitor_options

object

Object containing the options for a Synthetic test as a monitor (for example, renotification).

renotify_interval

int64

Time interval before renotifying if the test is still failing (in minutes).

monitor_priority

int32

Integer from 1 (high) to 5 (low) indicating alert severity.

noScreenshot

boolean

Prevents saving screenshots of the steps.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

rumSettings

object

The RUM data collection settings for the Synthetic browser test. Note: There are 3 ways to format RUM settings:

{ isEnabled: false } RUM data is not collected.

{ isEnabled: true } RUM data is collected from the Synthetic test's default application.

{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 } RUM data is collected using the specified application.

applicationId

string

RUM application ID used to collect RUM data for the browser test.

clientTokenId

int64

RUM application API key ID used to collect RUM data for the browser test.

isEnabled [required]

boolean

Determines whether RUM data is collected during test runs.

scheduling

object

Object containing timeframes and timezone used for advanced scheduling.

timeframes

[object]

Array containing objects describing the scheduling pattern to apply to each day.

day

int32

Number representing the day of the week.

from

string

The hour of the day on which scheduling starts.

to

string

The hour of the day on which scheduling ends.

timezone

string

Timezone in which the timeframe is based.

tick_every

int64

The frequency at which to run the Synthetic test (in seconds).

public_id

string

The test public ID.

status

enum

Define whether you want to start (live) or pause (paused) a Synthetic test. Allowed enum values: live,paused

steps

[object]

For browser test, the steps of the test.

allowFailure

boolean

A boolean set to allow this step to fail.

isCritical

boolean

A boolean to use in addition to allowFailure to determine if the test should be marked as failed when the step fails.

name

string

The name of the step.

noScreenshot

boolean

A boolean set to not take a screenshot for the step.

params

object

The parameters of the step.

timeout

int64

The time before declaring a step failed.

type

enum

Step type used in your Synthetic test. Allowed enum values: assertCurrentUrl,assertElementAttribute,assertElementContent,assertElementPresent,assertEmail,assertFileDownload,assertFromJavascript,assertPageContains,assertPageLacks,click,extractFromJavascript,extractVariable,goToEmailLink,goToUrl,goToUrlAndMeasureTti,hover,playSubTest,pressKey,refresh,runApiTest,scroll,selectOption,typeText,uploadFiles,wait

subtype

enum

The subtype of the Synthetic API test, http, ssl, tcp, dns, icmp, udp, websocket, grpc or multi. Allowed enum values: http,ssl,tcp,dns,multi,icmp,udp,websocket,grpc

tags

[string]

Array of tags attached to the test.

type

enum

Type of the Synthetic test, either api or browser. Allowed enum values: api,browser

{
  "config": {
    "assertions": [
      {
        "operator": "contains",
        "property": "string",
        "target": 123456,
        "timingsScope": "string",
        "type": "statusCode"
      }
    ],
    "configVariables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ],
    "request": {
      "allow_insecure": false,
      "basicAuth": {
        "password": "PaSSw0RD!",
        "type": "web",
        "username": "my_username"
      },
      "body": "string",
      "bodyType": "text/plain",
      "callType": "unary",
      "certificate": {
        "cert": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        },
        "key": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        }
      },
      "certificateDomains": [],
      "compressedJsonDescriptor": "string",
      "compressedProtoFile": "string",
      "dnsServer": "string",
      "dnsServerPort": "integer",
      "files": [
        {
          "bucketKey": "string",
          "content": "string",
          "name": "string",
          "originalFileName": "string",
          "size": "integer",
          "type": "string"
        }
      ],
      "follow_redirects": false,
      "headers": {
        "<any-key>": "string"
      },
      "host": "string",
      "httpVersion": "string",
      "message": "string",
      "metadata": {
        "<any-key>": "string"
      },
      "method": "string",
      "noSavingResponseBody": false,
      "numberOfPackets": "integer",
      "persistCookies": false,
      "port": "integer",
      "proxy": {
        "headers": {
          "<any-key>": "string"
        },
        "url": "https://example.com"
      },
      "query": {},
      "servername": "string",
      "service": "Greeter",
      "shouldTrackHops": false,
      "timeout": "number",
      "url": "https://example.com"
    },
    "variables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ]
  },
  "creator": {
    "email": "string",
    "handle": "string",
    "name": "string"
  },
  "locations": [
    "aws:eu-west-3"
  ],
  "message": "string",
  "monitor_id": "integer",
  "name": "string",
  "options": {
    "accept_self_signed": false,
    "allow_insecure": false,
    "checkCertificateRevocation": false,
    "ci": {
      "executionRule": "string"
    },
    "device_ids": [
      "chrome.laptop_large"
    ],
    "disableCors": false,
    "disableCsp": false,
    "enableProfiling": false,
    "enableSecurityTesting": false,
    "follow_redirects": false,
    "httpVersion": "string",
    "ignoreServerCertificateError": false,
    "initialNavigationTimeout": "integer",
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "monitor_name": "string",
    "monitor_options": {
      "renotify_interval": "integer"
    },
    "monitor_priority": "integer",
    "noScreenshot": false,
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ],
    "retry": {
      "count": "integer",
      "interval": "number"
    },
    "rumSettings": {
      "applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "clientTokenId": 12345,
      "isEnabled": true
    },
    "scheduling": {
      "timeframes": [
        {
          "day": 1,
          "from": "07:00",
          "to": "16:00"
        }
      ],
      "timezone": "America/New_York"
    },
    "tick_every": "integer"
  },
  "public_id": "string",
  "status": "live",
  "steps": [
    {
      "allowFailure": false,
      "isCritical": false,
      "name": "string",
      "noScreenshot": false,
      "params": {},
      "timeout": "integer",
      "type": "assertElementContent"
    }
  ],
  "subtype": "http",
  "tags": [],
  "type": "string"
}

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

- Synthetic is not activated for the user - Test is not owned by the user

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

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

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

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.get_test(
        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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get a test configuration returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
p api_instance.get_test("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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

test_id = '<SYNTHETICS_TEST_PUBLIC_ID>'

dog = Dogapi::Client.new(api_key, app_key)

dog.get_synthetics_test('test_id'  => test_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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get a test configuration 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/datadogV1"
)

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

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.GetTest`:\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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get a test configuration returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsTestDetails;

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

    try {
      SyntheticsTestDetails result = apiInstance.getTest("public_id");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#getTest");
      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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
from datadog import initialize, api

options = {
    'api_key': '<DATADOG_API_KEY>',
    'app_key': '<DATADOG_APPLICATION_KEY>'
}

test_id = '<SYNTHETICS_TEST_PUBLIC_ID>'

initialize(**options)

api.Synthetics.get_test(id=test_id)

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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python "example.py"
/**
 * Get a test configuration returns "OK" response
 */

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

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

const params: v1.SyntheticsApiGetTestRequest = {
  publicId: "public_id",
};

apiInstance
  .getTest(params)
  .then((data: v1.SyntheticsTestDetails) => {
    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.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v1/synthetics/settings/default_locationshttps://api.datadoghq.eu/api/v1/synthetics/settings/default_locationshttps://api.ddog-gov.com/api/v1/synthetics/settings/default_locationshttps://api.datadoghq.com/api/v1/synthetics/settings/default_locationshttps://api.us3.datadoghq.com/api/v1/synthetics/settings/default_locationshttps://api.us5.datadoghq.com/api/v1/synthetics/settings/default_locations

概要

デフォルトの場所の設定を取得します。

応答

OK

List of Synthetics default locations settings.

Expand All

フィールド

種類

説明

description

Name of the location.

string

[
  "aws:eu-west-3"
]

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/settings/default_locations" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get the default locations returns "OK" response
"""

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

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.get_synthetics_default_locations()

    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.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Get the default locations returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
p api_instance.get_synthetics_default_locations()

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.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
// Get the default locations 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/datadogV1"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.GetSyntheticsDefaultLocations(ctx)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.GetSyntheticsDefaultLocations`:\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.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Get the default locations returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import java.util.List;

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

    try {
      List<String> result = apiInstance.getSyntheticsDefaultLocations();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#getSyntheticsDefaultLocations");
      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.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
/**
 * Get the default locations returns "OK" response
 */

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

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

apiInstance
  .getSyntheticsDefaultLocations()
  .then((data: string[]) => {
    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.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

PUT https://api.ap1.datadoghq.com/api/v1/synthetics/tests/{public_id}https://api.datadoghq.eu/api/v1/synthetics/tests/{public_id}https://api.ddog-gov.com/api/v1/synthetics/tests/{public_id}https://api.datadoghq.com/api/v1/synthetics/tests/{public_id}https://api.us3.datadoghq.com/api/v1/synthetics/tests/{public_id}https://api.us5.datadoghq.com/api/v1/synthetics/tests/{public_id}

概要

このエンドポイントは非推奨です。テストを編集するには、Edit an API test または Edit a browser test を使用してください。 This endpoint requires the synthetics_write authorization scope.

引数

パスパラメーター

名前

種類

説明

public_id [required]

string

The public ID of the test to get details from.

リクエスト

Body Data (required)

保存する新しいテストの詳細。

Expand All

フィールド

種類

説明

config

object

Configuration object for a Synthetic test.

assertions

[ <oneOf>]

Array of assertions used for the test. Required for single API tests.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

configVariables

[object]

Array of variables used for the test.

example

string

Example for the variable.

id

string

ID of the variable for global variables.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Whether the value of this variable will be obfuscated in test results. Only for config variables of type text.

type [required]

enum

Type of the configuration variable. Allowed enum values: global,text

request

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

variables

[object]

Browser tests only - array of variables used for the test steps.

example

string

Example for the variable.

id

string

ID for the variable. Global variables require an ID.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Determines whether or not the browser test variable is obfuscated. Can only be used with browser variables of type text.

type [required]

enum

Type of browser test variable. Allowed enum values: element,email,global,javascript,text

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

locations

[string]

Array of locations used to run the test.

message

string

Notification message associated with the test.

monitor_id

int64

The associated monitor ID.

name

string

Name of the test.

options

object

Object describing the extra options for a Synthetic test.

accept_self_signed

boolean

For SSL test, whether or not the test should allow self signed certificates.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in an API test.

checkCertificateRevocation

boolean

For SSL test, whether or not the test should fail on revoked certificate in stapled OCSP.

ci

object

CI/CD options for a Synthetic test.

executionRule

enum

Execution rule for a Synthetic test. Allowed enum values: blocking,non_blocking,skipped

device_ids

[string]

For browser test, array with the different device IDs used to run the test.

disableCors

boolean

Whether or not to disable CORS mechanism.

disableCsp

boolean

Disable Content Security Policy for browser tests.

enableProfiling

boolean

Enable profiling for browser tests.

enableSecurityTesting

boolean

DEPRECATED: Enable security testing for browser tests. Security testing is not available anymore. This field is deprecated and won't be used.

follow_redirects

boolean

For API HTTP test, whether or not the test should follow redirects.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

ignoreServerCertificateError

boolean

Ignore server certificate error for browser tests.

initialNavigationTimeout

int64

Timeout before declaring the initial step as failed (in seconds) for browser tests.

min_failure_duration

int64

Minimum amount of time in failure required to trigger an alert.

min_location_failed

int64

Minimum number of locations in failure required to trigger an alert.

monitor_name

string

The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.

monitor_options

object

Object containing the options for a Synthetic test as a monitor (for example, renotification).

renotify_interval

int64

Time interval before renotifying if the test is still failing (in minutes).

monitor_priority

int32

Integer from 1 (high) to 5 (low) indicating alert severity.

noScreenshot

boolean

Prevents saving screenshots of the steps.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

rumSettings

object

The RUM data collection settings for the Synthetic browser test. Note: There are 3 ways to format RUM settings:

{ isEnabled: false } RUM data is not collected.

{ isEnabled: true } RUM data is collected from the Synthetic test's default application.

{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 } RUM data is collected using the specified application.

applicationId

string

RUM application ID used to collect RUM data for the browser test.

clientTokenId

int64

RUM application API key ID used to collect RUM data for the browser test.

isEnabled [required]

boolean

Determines whether RUM data is collected during test runs.

scheduling

object

Object containing timeframes and timezone used for advanced scheduling.

timeframes

[object]

Array containing objects describing the scheduling pattern to apply to each day.

day

int32

Number representing the day of the week.

from

string

The hour of the day on which scheduling starts.

to

string

The hour of the day on which scheduling ends.

timezone

string

Timezone in which the timeframe is based.

tick_every

int64

The frequency at which to run the Synthetic test (in seconds).

public_id

string

The test public ID.

status

enum

Define whether you want to start (live) or pause (paused) a Synthetic test. Allowed enum values: live,paused

steps

[object]

For browser test, the steps of the test.

allowFailure

boolean

A boolean set to allow this step to fail.

isCritical

boolean

A boolean to use in addition to allowFailure to determine if the test should be marked as failed when the step fails.

name

string

The name of the step.

noScreenshot

boolean

A boolean set to not take a screenshot for the step.

params

object

The parameters of the step.

timeout

int64

The time before declaring a step failed.

type

enum

Step type used in your Synthetic test. Allowed enum values: assertCurrentUrl,assertElementAttribute,assertElementContent,assertElementPresent,assertEmail,assertFileDownload,assertFromJavascript,assertPageContains,assertPageLacks,click,extractFromJavascript,extractVariable,goToEmailLink,goToUrl,goToUrlAndMeasureTti,hover,playSubTest,pressKey,refresh,runApiTest,scroll,selectOption,typeText,uploadFiles,wait

subtype

enum

The subtype of the Synthetic API test, http, ssl, tcp, dns, icmp, udp, websocket, grpc or multi. Allowed enum values: http,ssl,tcp,dns,multi,icmp,udp,websocket,grpc

tags

[string]

Array of tags attached to the test.

type

enum

Type of the Synthetic test, either api or browser. Allowed enum values: api,browser

{
  "config": {
    "assertions": [
      {
        "operator": "contains",
        "property": "string",
        "target": 123456,
        "timingsScope": "string",
        "type": "statusCode"
      }
    ],
    "configVariables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ],
    "request": {
      "allow_insecure": false,
      "basicAuth": {
        "password": "PaSSw0RD!",
        "type": "web",
        "username": "my_username"
      },
      "body": "string",
      "bodyType": "text/plain",
      "callType": "unary",
      "certificate": {
        "cert": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        },
        "key": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        }
      },
      "certificateDomains": [],
      "compressedJsonDescriptor": "string",
      "compressedProtoFile": "string",
      "dnsServer": "string",
      "dnsServerPort": "integer",
      "files": [
        {
          "bucketKey": "string",
          "content": "string",
          "name": "string",
          "originalFileName": "string",
          "size": "integer",
          "type": "string"
        }
      ],
      "follow_redirects": false,
      "headers": {
        "<any-key>": "string"
      },
      "host": "string",
      "httpVersion": "string",
      "message": "string",
      "metadata": {
        "<any-key>": "string"
      },
      "method": "string",
      "noSavingResponseBody": false,
      "numberOfPackets": "integer",
      "persistCookies": false,
      "port": "integer",
      "proxy": {
        "headers": {
          "<any-key>": "string"
        },
        "url": "https://example.com"
      },
      "query": {},
      "servername": "string",
      "service": "Greeter",
      "shouldTrackHops": false,
      "timeout": "number",
      "url": "https://example.com"
    },
    "variables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ]
  },
  "locations": [
    "aws:eu-west-3"
  ],
  "message": "string",
  "name": "string",
  "options": {
    "accept_self_signed": false,
    "allow_insecure": false,
    "checkCertificateRevocation": false,
    "ci": {
      "executionRule": "string"
    },
    "device_ids": [
      "chrome.laptop_large"
    ],
    "disableCors": false,
    "disableCsp": false,
    "enableProfiling": false,
    "enableSecurityTesting": false,
    "follow_redirects": false,
    "httpVersion": "string",
    "ignoreServerCertificateError": false,
    "initialNavigationTimeout": "integer",
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "monitor_name": "string",
    "monitor_options": {
      "renotify_interval": "integer"
    },
    "monitor_priority": "integer",
    "noScreenshot": false,
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ],
    "retry": {
      "count": "integer",
      "interval": "number"
    },
    "rumSettings": {
      "applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "clientTokenId": 12345,
      "isEnabled": true
    },
    "scheduling": {
      "timeframes": [
        {
          "day": 1,
          "from": "07:00",
          "to": "16:00"
        }
      ],
      "timezone": "America/New_York"
    },
    "tick_every": "integer"
  },
  "status": "live",
  "steps": [
    {
      "allowFailure": false,
      "isCritical": false,
      "name": "string",
      "noScreenshot": false,
      "params": {},
      "timeout": "integer",
      "type": "assertElementContent"
    }
  ],
  "subtype": "http",
  "tags": [],
  "type": "string"
}

応答

OK

Object containing details about your Synthetic test.

Expand All

フィールド

種類

説明

config

object

Configuration object for a Synthetic test.

assertions

[ <oneOf>]

Array of assertions used for the test. Required for single API tests.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

configVariables

[object]

Array of variables used for the test.

example

string

Example for the variable.

id

string

ID of the variable for global variables.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Whether the value of this variable will be obfuscated in test results. Only for config variables of type text.

type [required]

enum

Type of the configuration variable. Allowed enum values: global,text

request

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

variables

[object]

Browser tests only - array of variables used for the test steps.

example

string

Example for the variable.

id

string

ID for the variable. Global variables require an ID.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Determines whether or not the browser test variable is obfuscated. Can only be used with browser variables of type text.

type [required]

enum

Type of browser test variable. Allowed enum values: element,email,global,javascript,text

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

locations

[string]

Array of locations used to run the test.

message

string

Notification message associated with the test.

monitor_id

int64

The associated monitor ID.

name

string

Name of the test.

options

object

Object describing the extra options for a Synthetic test.

accept_self_signed

boolean

For SSL test, whether or not the test should allow self signed certificates.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in an API test.

checkCertificateRevocation

boolean

For SSL test, whether or not the test should fail on revoked certificate in stapled OCSP.

ci

object

CI/CD options for a Synthetic test.

executionRule

enum

Execution rule for a Synthetic test. Allowed enum values: blocking,non_blocking,skipped

device_ids

[string]

For browser test, array with the different device IDs used to run the test.

disableCors

boolean

Whether or not to disable CORS mechanism.

disableCsp

boolean

Disable Content Security Policy for browser tests.

enableProfiling

boolean

Enable profiling for browser tests.

enableSecurityTesting

boolean

DEPRECATED: Enable security testing for browser tests. Security testing is not available anymore. This field is deprecated and won't be used.

follow_redirects

boolean

For API HTTP test, whether or not the test should follow redirects.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

ignoreServerCertificateError

boolean

Ignore server certificate error for browser tests.

initialNavigationTimeout

int64

Timeout before declaring the initial step as failed (in seconds) for browser tests.

min_failure_duration

int64

Minimum amount of time in failure required to trigger an alert.

min_location_failed

int64

Minimum number of locations in failure required to trigger an alert.

monitor_name

string

The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.

monitor_options

object

Object containing the options for a Synthetic test as a monitor (for example, renotification).

renotify_interval

int64

Time interval before renotifying if the test is still failing (in minutes).

monitor_priority

int32

Integer from 1 (high) to 5 (low) indicating alert severity.

noScreenshot

boolean

Prevents saving screenshots of the steps.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

rumSettings

object

The RUM data collection settings for the Synthetic browser test. Note: There are 3 ways to format RUM settings:

{ isEnabled: false } RUM data is not collected.

{ isEnabled: true } RUM data is collected from the Synthetic test's default application.

{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 } RUM data is collected using the specified application.

applicationId

string

RUM application ID used to collect RUM data for the browser test.

clientTokenId

int64

RUM application API key ID used to collect RUM data for the browser test.

isEnabled [required]

boolean

Determines whether RUM data is collected during test runs.

scheduling

object

Object containing timeframes and timezone used for advanced scheduling.

timeframes

[object]

Array containing objects describing the scheduling pattern to apply to each day.

day

int32

Number representing the day of the week.

from

string

The hour of the day on which scheduling starts.

to

string

The hour of the day on which scheduling ends.

timezone

string

Timezone in which the timeframe is based.

tick_every

int64

The frequency at which to run the Synthetic test (in seconds).

public_id

string

The test public ID.

status

enum

Define whether you want to start (live) or pause (paused) a Synthetic test. Allowed enum values: live,paused

steps

[object]

For browser test, the steps of the test.

allowFailure

boolean

A boolean set to allow this step to fail.

isCritical

boolean

A boolean to use in addition to allowFailure to determine if the test should be marked as failed when the step fails.

name

string

The name of the step.

noScreenshot

boolean

A boolean set to not take a screenshot for the step.

params

object

The parameters of the step.

timeout

int64

The time before declaring a step failed.

type

enum

Step type used in your Synthetic test. Allowed enum values: assertCurrentUrl,assertElementAttribute,assertElementContent,assertElementPresent,assertEmail,assertFileDownload,assertFromJavascript,assertPageContains,assertPageLacks,click,extractFromJavascript,extractVariable,goToEmailLink,goToUrl,goToUrlAndMeasureTti,hover,playSubTest,pressKey,refresh,runApiTest,scroll,selectOption,typeText,uploadFiles,wait

subtype

enum

The subtype of the Synthetic API test, http, ssl, tcp, dns, icmp, udp, websocket, grpc or multi. Allowed enum values: http,ssl,tcp,dns,multi,icmp,udp,websocket,grpc

tags

[string]

Array of tags attached to the test.

type

enum

Type of the Synthetic test, either api or browser. Allowed enum values: api,browser

{
  "config": {
    "assertions": [
      {
        "operator": "contains",
        "property": "string",
        "target": 123456,
        "timingsScope": "string",
        "type": "statusCode"
      }
    ],
    "configVariables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ],
    "request": {
      "allow_insecure": false,
      "basicAuth": {
        "password": "PaSSw0RD!",
        "type": "web",
        "username": "my_username"
      },
      "body": "string",
      "bodyType": "text/plain",
      "callType": "unary",
      "certificate": {
        "cert": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        },
        "key": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        }
      },
      "certificateDomains": [],
      "compressedJsonDescriptor": "string",
      "compressedProtoFile": "string",
      "dnsServer": "string",
      "dnsServerPort": "integer",
      "files": [
        {
          "bucketKey": "string",
          "content": "string",
          "name": "string",
          "originalFileName": "string",
          "size": "integer",
          "type": "string"
        }
      ],
      "follow_redirects": false,
      "headers": {
        "<any-key>": "string"
      },
      "host": "string",
      "httpVersion": "string",
      "message": "string",
      "metadata": {
        "<any-key>": "string"
      },
      "method": "string",
      "noSavingResponseBody": false,
      "numberOfPackets": "integer",
      "persistCookies": false,
      "port": "integer",
      "proxy": {
        "headers": {
          "<any-key>": "string"
        },
        "url": "https://example.com"
      },
      "query": {},
      "servername": "string",
      "service": "Greeter",
      "shouldTrackHops": false,
      "timeout": "number",
      "url": "https://example.com"
    },
    "variables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ]
  },
  "creator": {
    "email": "string",
    "handle": "string",
    "name": "string"
  },
  "locations": [
    "aws:eu-west-3"
  ],
  "message": "string",
  "monitor_id": "integer",
  "name": "string",
  "options": {
    "accept_self_signed": false,
    "allow_insecure": false,
    "checkCertificateRevocation": false,
    "ci": {
      "executionRule": "string"
    },
    "device_ids": [
      "chrome.laptop_large"
    ],
    "disableCors": false,
    "disableCsp": false,
    "enableProfiling": false,
    "enableSecurityTesting": false,
    "follow_redirects": false,
    "httpVersion": "string",
    "ignoreServerCertificateError": false,
    "initialNavigationTimeout": "integer",
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "monitor_name": "string",
    "monitor_options": {
      "renotify_interval": "integer"
    },
    "monitor_priority": "integer",
    "noScreenshot": false,
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ],
    "retry": {
      "count": "integer",
      "interval": "number"
    },
    "rumSettings": {
      "applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "clientTokenId": 12345,
      "isEnabled": true
    },
    "scheduling": {
      "timeframes": [
        {
          "day": 1,
          "from": "07:00",
          "to": "16:00"
        }
      ],
      "timezone": "America/New_York"
    },
    "tick_every": "integer"
  },
  "public_id": "string",
  "status": "live",
  "steps": [
    {
      "allowFailure": false,
      "isCritical": false,
      "name": "string",
      "noScreenshot": false,
      "params": {},
      "timeout": "integer",
      "type": "assertElementContent"
    }
  ],
  "subtype": "http",
  "tags": [],
  "type": "string"
}

- JSON format is wrong - Updating sub-type is forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

- Synthetic is not activated for the user - Test is not owned by the user - Test can't be found

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                  # Path parameters
export public_id="CHANGE_ME"
# Curl command
curl -X PUT "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/tests/${public_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "config": { "configVariables": [ { "name": "VARIABLE_NAME", "type": "text" } ], "request": { "proxy": { "url": "https://example.com" } }, "variables": [ { "name": "VARIABLE_NAME", "type": "text" } ] }, "options": { "rumSettings": { "isEnabled": true } } } EOF

POST https://api.ap1.datadoghq.com/api/v1/synthetics/testshttps://api.datadoghq.eu/api/v1/synthetics/testshttps://api.ddog-gov.com/api/v1/synthetics/testshttps://api.datadoghq.com/api/v1/synthetics/testshttps://api.us3.datadoghq.com/api/v1/synthetics/testshttps://api.us5.datadoghq.com/api/v1/synthetics/tests

概要

このエンドポイントは非推奨です。テストを作成するには、Create an API test または Create a browser test を使用してください。 This endpoint requires the synthetics_write authorization scope.

リクエスト

Body Data (required)

作成するテストの詳細。

Expand All

フィールド

種類

説明

config

object

Configuration object for a Synthetic test.

assertions

[ <oneOf>]

Array of assertions used for the test. Required for single API tests.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

configVariables

[object]

Array of variables used for the test.

example

string

Example for the variable.

id

string

ID of the variable for global variables.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Whether the value of this variable will be obfuscated in test results. Only for config variables of type text.

type [required]

enum

Type of the configuration variable. Allowed enum values: global,text

request

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

variables

[object]

Browser tests only - array of variables used for the test steps.

example

string

Example for the variable.

id

string

ID for the variable. Global variables require an ID.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Determines whether or not the browser test variable is obfuscated. Can only be used with browser variables of type text.

type [required]

enum

Type of browser test variable. Allowed enum values: element,email,global,javascript,text

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

locations

[string]

Array of locations used to run the test.

message

string

Notification message associated with the test.

monitor_id

int64

The associated monitor ID.

name

string

Name of the test.

options

object

Object describing the extra options for a Synthetic test.

accept_self_signed

boolean

For SSL test, whether or not the test should allow self signed certificates.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in an API test.

checkCertificateRevocation

boolean

For SSL test, whether or not the test should fail on revoked certificate in stapled OCSP.

ci

object

CI/CD options for a Synthetic test.

executionRule

enum

Execution rule for a Synthetic test. Allowed enum values: blocking,non_blocking,skipped

device_ids

[string]

For browser test, array with the different device IDs used to run the test.

disableCors

boolean

Whether or not to disable CORS mechanism.

disableCsp

boolean

Disable Content Security Policy for browser tests.

enableProfiling

boolean

Enable profiling for browser tests.

enableSecurityTesting

boolean

DEPRECATED: Enable security testing for browser tests. Security testing is not available anymore. This field is deprecated and won't be used.

follow_redirects

boolean

For API HTTP test, whether or not the test should follow redirects.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

ignoreServerCertificateError

boolean

Ignore server certificate error for browser tests.

initialNavigationTimeout

int64

Timeout before declaring the initial step as failed (in seconds) for browser tests.

min_failure_duration

int64

Minimum amount of time in failure required to trigger an alert.

min_location_failed

int64

Minimum number of locations in failure required to trigger an alert.

monitor_name

string

The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.

monitor_options

object

Object containing the options for a Synthetic test as a monitor (for example, renotification).

renotify_interval

int64

Time interval before renotifying if the test is still failing (in minutes).

monitor_priority

int32

Integer from 1 (high) to 5 (low) indicating alert severity.

noScreenshot

boolean

Prevents saving screenshots of the steps.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

rumSettings

object

The RUM data collection settings for the Synthetic browser test. Note: There are 3 ways to format RUM settings:

{ isEnabled: false } RUM data is not collected.

{ isEnabled: true } RUM data is collected from the Synthetic test's default application.

{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 } RUM data is collected using the specified application.

applicationId

string

RUM application ID used to collect RUM data for the browser test.

clientTokenId

int64

RUM application API key ID used to collect RUM data for the browser test.

isEnabled [required]

boolean

Determines whether RUM data is collected during test runs.

scheduling

object

Object containing timeframes and timezone used for advanced scheduling.

timeframes

[object]

Array containing objects describing the scheduling pattern to apply to each day.

day

int32

Number representing the day of the week.

from

string

The hour of the day on which scheduling starts.

to

string

The hour of the day on which scheduling ends.

timezone

string

Timezone in which the timeframe is based.

tick_every

int64

The frequency at which to run the Synthetic test (in seconds).

public_id

string

The test public ID.

status

enum

Define whether you want to start (live) or pause (paused) a Synthetic test. Allowed enum values: live,paused

steps

[object]

For browser test, the steps of the test.

allowFailure

boolean

A boolean set to allow this step to fail.

isCritical

boolean

A boolean to use in addition to allowFailure to determine if the test should be marked as failed when the step fails.

name

string

The name of the step.

noScreenshot

boolean

A boolean set to not take a screenshot for the step.

params

object

The parameters of the step.

timeout

int64

The time before declaring a step failed.

type

enum

Step type used in your Synthetic test. Allowed enum values: assertCurrentUrl,assertElementAttribute,assertElementContent,assertElementPresent,assertEmail,assertFileDownload,assertFromJavascript,assertPageContains,assertPageLacks,click,extractFromJavascript,extractVariable,goToEmailLink,goToUrl,goToUrlAndMeasureTti,hover,playSubTest,pressKey,refresh,runApiTest,scroll,selectOption,typeText,uploadFiles,wait

subtype

enum

The subtype of the Synthetic API test, http, ssl, tcp, dns, icmp, udp, websocket, grpc or multi. Allowed enum values: http,ssl,tcp,dns,multi,icmp,udp,websocket,grpc

tags

[string]

Array of tags attached to the test.

type

enum

Type of the Synthetic test, either api or browser. Allowed enum values: api,browser

{
  "config": {
    "assertions": [
      {
        "operator": "contains",
        "property": "string",
        "target": 123456,
        "timingsScope": "string",
        "type": "statusCode"
      }
    ],
    "configVariables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ],
    "request": {
      "allow_insecure": false,
      "basicAuth": {
        "password": "PaSSw0RD!",
        "type": "web",
        "username": "my_username"
      },
      "body": "string",
      "bodyType": "text/plain",
      "callType": "unary",
      "certificate": {
        "cert": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        },
        "key": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        }
      },
      "certificateDomains": [],
      "compressedJsonDescriptor": "string",
      "compressedProtoFile": "string",
      "dnsServer": "string",
      "dnsServerPort": "integer",
      "files": [
        {
          "bucketKey": "string",
          "content": "string",
          "name": "string",
          "originalFileName": "string",
          "size": "integer",
          "type": "string"
        }
      ],
      "follow_redirects": false,
      "headers": {
        "<any-key>": "string"
      },
      "host": "string",
      "httpVersion": "string",
      "message": "string",
      "metadata": {
        "<any-key>": "string"
      },
      "method": "string",
      "noSavingResponseBody": false,
      "numberOfPackets": "integer",
      "persistCookies": false,
      "port": "integer",
      "proxy": {
        "headers": {
          "<any-key>": "string"
        },
        "url": "https://example.com"
      },
      "query": {},
      "servername": "string",
      "service": "Greeter",
      "shouldTrackHops": false,
      "timeout": "number",
      "url": "https://example.com"
    },
    "variables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ]
  },
  "locations": [
    "aws:eu-west-3"
  ],
  "message": "string",
  "name": "string",
  "options": {
    "accept_self_signed": false,
    "allow_insecure": false,
    "checkCertificateRevocation": false,
    "ci": {
      "executionRule": "string"
    },
    "device_ids": [
      "chrome.laptop_large"
    ],
    "disableCors": false,
    "disableCsp": false,
    "enableProfiling": false,
    "enableSecurityTesting": false,
    "follow_redirects": false,
    "httpVersion": "string",
    "ignoreServerCertificateError": false,
    "initialNavigationTimeout": "integer",
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "monitor_name": "string",
    "monitor_options": {
      "renotify_interval": "integer"
    },
    "monitor_priority": "integer",
    "noScreenshot": false,
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ],
    "retry": {
      "count": "integer",
      "interval": "number"
    },
    "rumSettings": {
      "applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "clientTokenId": 12345,
      "isEnabled": true
    },
    "scheduling": {
      "timeframes": [
        {
          "day": 1,
          "from": "07:00",
          "to": "16:00"
        }
      ],
      "timezone": "America/New_York"
    },
    "tick_every": "integer"
  },
  "status": "live",
  "steps": [
    {
      "allowFailure": false,
      "isCritical": false,
      "name": "string",
      "noScreenshot": false,
      "params": {},
      "timeout": "integer",
      "type": "assertElementContent"
    }
  ],
  "subtype": "http",
  "tags": [],
  "type": "string"
}

応答

OK - Returns the created test details.

Object containing details about your Synthetic test.

Expand All

フィールド

種類

説明

config

object

Configuration object for a Synthetic test.

assertions

[ <oneOf>]

Array of assertions used for the test. Required for single API tests.

default:

Option 1

object

An assertion which uses a simple target.

operator [required]

enum

Assertion operator to apply. Allowed enum values: contains,doesNotContain,is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual,matches,doesNotMatch,validates,isInMoreThan,isInLessThan,doesNotExist,isUndefined

property

string

The associated assertion property.

target [required]

Value used by the operator.

timingsScope

enum

Timings scope for response time assertions. Allowed enum values: all,withoutDNS

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 2

object

An assertion which targets body hash.

operator [required]

enum

Assertion operator to apply. Allowed enum values: md5,sha1,sha256

target [required]

Value used by the operator.

type [required]

enum

Type of the assertion. Allowed enum values: bodyHash

Option 3

object

An assertion for the validatesJSONPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONPath

property

string

The associated assertion property.

target

object

Composed target for validatesJSONPath operator.

elementsOperator

string

The element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.

jsonPath

string

The JSON path to assert.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 4

object

An assertion for the validatesJSONSchema operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesJSONSchema

target

object

Composed target for validatesJSONSchema operator.

jsonSchema

string

The JSON Schema to assert.

metaSchema

enum

The JSON Schema meta-schema version used in the assertion. Allowed enum values: draft-07,draft-06

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

Option 5

object

An assertion for the validatesXPath operator.

operator [required]

enum

Assertion operator to apply. Allowed enum values: validatesXPath

property

string

The associated assertion property.

target

object

Composed target for validatesXPath operator.

operator

string

The specific operator to use on the path.

targetValue

The path target value to compare to.

xPath

string

The X path to assert.

type [required]

enum

Type of the assertion. Allowed enum values: body,header,statusCode,certificate,responseTime,property,recordEvery,recordSome,tlsVersion,minTlsVersion,latency,packetLossPercentage,packetsReceived,networkHop,receivedMessage,grpcHealthcheckStatus,grpcMetadata,grpcProto,connection

configVariables

[object]

Array of variables used for the test.

example

string

Example for the variable.

id

string

ID of the variable for global variables.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Whether the value of this variable will be obfuscated in test results. Only for config variables of type text.

type [required]

enum

Type of the configuration variable. Allowed enum values: global,text

request

object

Object describing the Synthetic test request.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in a multistep test step.

basicAuth

 <oneOf>

Object to handle basic authentication when performing the test.

Option 1

object

Object to handle basic authentication when performing the test.

password [required]

string

Password to use for the basic authentication.

type

enum

The type of basic authentication to use when performing the test. Allowed enum values: web

default: web

username [required]

string

Username to use for the basic authentication.

Option 2

object

Object to handle SIGV4 authentication when performing the test.

accessKey [required]

string

Access key for the SIGV4 authentication.

region

string

Region for the SIGV4 authentication.

secretKey [required]

string

Secret key for the SIGV4 authentication.

serviceName

string

Service name for the SIGV4 authentication.

sessionToken

string

Session token for the SIGV4 authentication.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: sigv4

default: sigv4

Option 3

object

Object to handle NTLM authentication when performing the test.

domain

string

Domain for the authentication to use when performing the test.

password

string

Password for the authentication to use when performing the test.

type [required]

enum

The type of authentication to use when performing the test. Allowed enum values: ntlm

default: ntlm

username

string

Username for the authentication to use when performing the test.

workstation

string

Workstation for the authentication to use when performing the test.

Option 4

object

Object to handle digest authentication when performing the test.

password [required]

string

Password to use for the digest authentication.

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: digest

default: digest

username [required]

string

Username to use for the digest authentication.

Option 5

object

Object to handle oauth client authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId [required]

string

Client ID to use when performing the authentication.

clientSecret [required]

string

Client secret to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-client

default: oauth-client

Option 6

object

Object to handle oauth rop authentication when performing the test.

accessTokenUrl [required]

string

Access token URL to use when performing the authentication.

audience

string

Audience to use when performing the authentication.

clientId

string

Client ID to use when performing the authentication.

clientSecret

string

Client secret to use when performing the authentication.

password [required]

string

Password to use when performing the authentication.

resource

string

Resource to use when performing the authentication.

scope

string

Scope to use when performing the authentication.

tokenApiAuthentication [required]

enum

Type of token to use when performing the authentication. Allowed enum values: header,body

type [required]

enum

The type of basic authentication to use when performing the test. Allowed enum values: oauth-rop

default: oauth-rop

username [required]

string

Username to use when performing the authentication.

body

string

Body to include in the test.

bodyType

enum

Type of the request body. Allowed enum values: text/plain,application/json,text/xml,text/html,application/x-www-form-urlencoded,graphql,application/octet-stream,multipart/form-data

callType

enum

The type of gRPC call to perform. Allowed enum values: healthcheck,unary

certificate

object

Client certificate to use when performing the test request.

cert

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

key

object

Define a request certificate.

content

string

Content of the certificate or key.

filename

string

File name for the certificate or key.

updatedAt

string

Date of update of the certificate or key, ISO format.

certificateDomains

[string]

By default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.

default:

compressedJsonDescriptor

string

A protobuf JSON descriptor that needs to be gzipped first then base64 encoded.

compressedProtoFile

string

A protobuf file that needs to be gzipped first then base64 encoded.

dnsServer

string

DNS server to use for DNS tests.

dnsServerPort

int32

DNS server port to use for DNS tests.

files

[object]

Files to be used as part of the request in the test.

bucketKey

string

Bucket key of the file.

content

string

Content of the file.

name

string

Name of the file.

originalFileName

string

Original name of the file.

size

int64

Size of the file.

type

string

Type of the file.

follow_redirects

boolean

Specifies whether or not the request follows redirects.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

host

string

Host name to perform the test with.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

message

string

Message to send for UDP or WebSocket tests.

metadata

object

Metadata to include when performing the gRPC test.

<any-key>

string

A single Metadatum.

method

string

Either the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.

noSavingResponseBody

boolean

Determines whether or not to save the response body.

numberOfPackets

int32

Number of pings to use per test.

persistCookies

boolean

Persist cookies across redirects.

port

int64

Port to use when performing the test.

proxy

object

The proxy to perform the test.

headers

object

Headers to include when performing the test.

<any-key>

string

A single Header.

url [required]

string

URL of the proxy to perform the test.

query

object

Query to use for the test.

servername

string

For SSL tests, it specifies on which server you want to initiate the TLS handshake, allowing the server to present one of multiple possible certificates on the same IP address and TCP port number.

service

string

The gRPC service on which you want to perform the gRPC call.

shouldTrackHops

boolean

Turns on a traceroute probe to discover all gateways along the path to the host destination.

timeout

double

Timeout in seconds for the test.

url

string

URL to perform the test with.

variables

[object]

Browser tests only - array of variables used for the test steps.

example

string

Example for the variable.

id

string

ID for the variable. Global variables require an ID.

name [required]

string

Name of the variable.

pattern

string

Pattern of the variable.

secure

boolean

Determines whether or not the browser test variable is obfuscated. Can only be used with browser variables of type text.

type [required]

enum

Type of browser test variable. Allowed enum values: element,email,global,javascript,text

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

locations

[string]

Array of locations used to run the test.

message

string

Notification message associated with the test.

monitor_id

int64

The associated monitor ID.

name

string

Name of the test.

options

object

Object describing the extra options for a Synthetic test.

accept_self_signed

boolean

For SSL test, whether or not the test should allow self signed certificates.

allow_insecure

boolean

Allows loading insecure content for an HTTP request in an API test.

checkCertificateRevocation

boolean

For SSL test, whether or not the test should fail on revoked certificate in stapled OCSP.

ci

object

CI/CD options for a Synthetic test.

executionRule

enum

Execution rule for a Synthetic test. Allowed enum values: blocking,non_blocking,skipped

device_ids

[string]

For browser test, array with the different device IDs used to run the test.

disableCors

boolean

Whether or not to disable CORS mechanism.

disableCsp

boolean

Disable Content Security Policy for browser tests.

enableProfiling

boolean

Enable profiling for browser tests.

enableSecurityTesting

boolean

DEPRECATED: Enable security testing for browser tests. Security testing is not available anymore. This field is deprecated and won't be used.

follow_redirects

boolean

For API HTTP test, whether or not the test should follow redirects.

httpVersion

enum

HTTP version to use for a Synthetic test. Allowed enum values: http1,http2,any

ignoreServerCertificateError

boolean

Ignore server certificate error for browser tests.

initialNavigationTimeout

int64

Timeout before declaring the initial step as failed (in seconds) for browser tests.

min_failure_duration

int64

Minimum amount of time in failure required to trigger an alert.

min_location_failed

int64

Minimum number of locations in failure required to trigger an alert.

monitor_name

string

The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.

monitor_options

object

Object containing the options for a Synthetic test as a monitor (for example, renotification).

renotify_interval

int64

Time interval before renotifying if the test is still failing (in minutes).

monitor_priority

int32

Integer from 1 (high) to 5 (low) indicating alert severity.

noScreenshot

boolean

Prevents saving screenshots of the steps.

restricted_roles

[string]

A list of role identifiers that can be pulled from the Roles API, for restricting read and write access.

retry

object

Object describing the retry strategy to apply to a Synthetic test.

count

int64

Number of times a test needs to be retried before marking a location as failed. Defaults to 0.

interval

double

Time interval between retries (in milliseconds). Defaults to 300ms.

rumSettings

object

The RUM data collection settings for the Synthetic browser test. Note: There are 3 ways to format RUM settings:

{ isEnabled: false } RUM data is not collected.

{ isEnabled: true } RUM data is collected from the Synthetic test's default application.

{ isEnabled: true, applicationId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientTokenId: 12345 } RUM data is collected using the specified application.

applicationId

string

RUM application ID used to collect RUM data for the browser test.

clientTokenId

int64

RUM application API key ID used to collect RUM data for the browser test.

isEnabled [required]

boolean

Determines whether RUM data is collected during test runs.

scheduling

object

Object containing timeframes and timezone used for advanced scheduling.

timeframes

[object]

Array containing objects describing the scheduling pattern to apply to each day.

day

int32

Number representing the day of the week.

from

string

The hour of the day on which scheduling starts.

to

string

The hour of the day on which scheduling ends.

timezone

string

Timezone in which the timeframe is based.

tick_every

int64

The frequency at which to run the Synthetic test (in seconds).

public_id

string

The test public ID.

status

enum

Define whether you want to start (live) or pause (paused) a Synthetic test. Allowed enum values: live,paused

steps

[object]

For browser test, the steps of the test.

allowFailure

boolean

A boolean set to allow this step to fail.

isCritical

boolean

A boolean to use in addition to allowFailure to determine if the test should be marked as failed when the step fails.

name

string

The name of the step.

noScreenshot

boolean

A boolean set to not take a screenshot for the step.

params

object

The parameters of the step.

timeout

int64

The time before declaring a step failed.

type

enum

Step type used in your Synthetic test. Allowed enum values: assertCurrentUrl,assertElementAttribute,assertElementContent,assertElementPresent,assertEmail,assertFileDownload,assertFromJavascript,assertPageContains,assertPageLacks,click,extractFromJavascript,extractVariable,goToEmailLink,goToUrl,goToUrlAndMeasureTti,hover,playSubTest,pressKey,refresh,runApiTest,scroll,selectOption,typeText,uploadFiles,wait

subtype

enum

The subtype of the Synthetic API test, http, ssl, tcp, dns, icmp, udp, websocket, grpc or multi. Allowed enum values: http,ssl,tcp,dns,multi,icmp,udp,websocket,grpc

tags

[string]

Array of tags attached to the test.

type

enum

Type of the Synthetic test, either api or browser. Allowed enum values: api,browser

{
  "config": {
    "assertions": [
      {
        "operator": "contains",
        "property": "string",
        "target": 123456,
        "timingsScope": "string",
        "type": "statusCode"
      }
    ],
    "configVariables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ],
    "request": {
      "allow_insecure": false,
      "basicAuth": {
        "password": "PaSSw0RD!",
        "type": "web",
        "username": "my_username"
      },
      "body": "string",
      "bodyType": "text/plain",
      "callType": "unary",
      "certificate": {
        "cert": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        },
        "key": {
          "content": "string",
          "filename": "string",
          "updatedAt": "string"
        }
      },
      "certificateDomains": [],
      "compressedJsonDescriptor": "string",
      "compressedProtoFile": "string",
      "dnsServer": "string",
      "dnsServerPort": "integer",
      "files": [
        {
          "bucketKey": "string",
          "content": "string",
          "name": "string",
          "originalFileName": "string",
          "size": "integer",
          "type": "string"
        }
      ],
      "follow_redirects": false,
      "headers": {
        "<any-key>": "string"
      },
      "host": "string",
      "httpVersion": "string",
      "message": "string",
      "metadata": {
        "<any-key>": "string"
      },
      "method": "string",
      "noSavingResponseBody": false,
      "numberOfPackets": "integer",
      "persistCookies": false,
      "port": "integer",
      "proxy": {
        "headers": {
          "<any-key>": "string"
        },
        "url": "https://example.com"
      },
      "query": {},
      "servername": "string",
      "service": "Greeter",
      "shouldTrackHops": false,
      "timeout": "number",
      "url": "https://example.com"
    },
    "variables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ]
  },
  "creator": {
    "email": "string",
    "handle": "string",
    "name": "string"
  },
  "locations": [
    "aws:eu-west-3"
  ],
  "message": "string",
  "monitor_id": "integer",
  "name": "string",
  "options": {
    "accept_self_signed": false,
    "allow_insecure": false,
    "checkCertificateRevocation": false,
    "ci": {
      "executionRule": "string"
    },
    "device_ids": [
      "chrome.laptop_large"
    ],
    "disableCors": false,
    "disableCsp": false,
    "enableProfiling": false,
    "enableSecurityTesting": false,
    "follow_redirects": false,
    "httpVersion": "string",
    "ignoreServerCertificateError": false,
    "initialNavigationTimeout": "integer",
    "min_failure_duration": "integer",
    "min_location_failed": "integer",
    "monitor_name": "string",
    "monitor_options": {
      "renotify_interval": "integer"
    },
    "monitor_priority": "integer",
    "noScreenshot": false,
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ],
    "retry": {
      "count": "integer",
      "interval": "number"
    },
    "rumSettings": {
      "applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "clientTokenId": 12345,
      "isEnabled": true
    },
    "scheduling": {
      "timeframes": [
        {
          "day": 1,
          "from": "07:00",
          "to": "16:00"
        }
      ],
      "timezone": "America/New_York"
    },
    "tick_every": "integer"
  },
  "public_id": "string",
  "status": "live",
  "steps": [
    {
      "allowFailure": false,
      "isCritical": false,
      "name": "string",
      "noScreenshot": false,
      "params": {},
      "timeout": "integer",
      "type": "assertElementContent"
    }
  ],
  "subtype": "http",
  "tags": [],
  "type": "string"
}

- JSON format is wrong - Creation failed

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Test quota is reached

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

コード例

                  # Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/synthetics/tests" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "config": { "configVariables": [ { "name": "VARIABLE_NAME", "type": "text" } ], "request": { "proxy": { "url": "https://example.com" } }, "variables": [ { "name": "VARIABLE_NAME", "type": "text" } ] }, "options": { "rumSettings": { "isEnabled": true } } } EOF