Array of assertions used for the test. Required for single API tests.
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
property
string
The associated assertion property.
target [required]
Value used by the operator.
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,connection
Option 2
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.
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,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.
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
object <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
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
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
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
enum
The type of basic authentication to use when performing the test.
Allowed enum values: digest
username [required]
string
Username to use for the digest authentication.
body
string
Body to include in the test.
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.
dnsServer
string
DNS server to use for DNS tests.
dnsServerPort
int32
DNS server port to use for DNS tests.
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.
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
enum
The HTTP method.
Allowed enum values: GET,POST,PATCH,PUT,DELETE,HEAD,OPTIONS
noSavingResponseBody
boolean
Determines whether or not to save the response body.
numberOfPackets
int32
Number of pings to use per test.
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
gRPC service on which you want to perform the healthcheck.
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]
When the test subtype is multi, the steps of the test.
allowFailure
boolean
Determines whether or not to continue with test if this step fails.
assertions [required]
[object <oneOf>]
Array of assertions used for the test.
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
property
string
The associated assertion property.
target [required]
Value used by the operator.
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,connection
Option 2
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.
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,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 Synthetics 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
enum
Property of the Synthetics Test Response to use for a Synthetics global variable.
Allowed enum values: http_body,http_header
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
object <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
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
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
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
enum
The type of basic authentication to use when performing the test.
Allowed enum values: digest
username [required]
string
Username to use for the digest authentication.
body
string
Body to include in the test.
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.
dnsServer
string
DNS server to use for DNS tests.
dnsServerPort
int32
DNS server port to use for DNS tests.
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.
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
enum
The HTTP method.
Allowed enum values: GET,POST,PATCH,PUT,DELETE,HEAD,OPTIONS
noSavingResponseBody
boolean
Determines whether or not to save the response body.
numberOfPackets
int32
Number of pings to use per test.
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
gRPC service on which you want to perform the healthcheck.
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 multistep API test step, currently only supporting http.
Allowed enum values: http
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.
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 Synthetics 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.
follow_redirects
boolean
For API HTTP test, whether or not the test should follow redirects.
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.
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
{"config":{"assertions":[{"operator":"is","target":1,"type":"grpcHealthcheckStatus"}],"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-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response","options":{"min_failure_duration":0,"min_location_failed":1,"monitor_options":{"renotify_interval":0},"monitor_name":"Example-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response","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"},{"operator":"validatesJSONPath","target":{"jsonPath":"topKey","operator":"isNot","targetValue":"0"},"type":"body"}],"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"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":"examplecreateanapihttptestreturnsokreturnsthecreatedtestdetailsresponse"},"method":"GET","timeout":10,"url":"https://datadoghq.com","proxy":{"url":"https://datadoghq.com","headers":{}}}},"locations":["aws:us-east-2"],"message":"BDD test payload: synthetics_api_http_test_payload.json","name":"Example-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"min_location_failed":1,"monitor_name":"Example-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"subtype":"http","tags":["testing:api"],"type":"api"}
{"config":{"assertions":[{"operator":"isInMoreThan","target":10,"type":"certificate"}],"request":{"host":"datadoghq.com","port":443}},"locations":["aws:us-east-2"],"message":"BDD test payload: synthetics_api_ssl_test_payload.json","name":"Example-Create_an_API_SSL_test_returns_OK_Returns_the_created_test_details_response","options":{"accept_self_signed":true,"checkCertificateRevocation":true,"tick_every":60},"subtype":"ssl","tags":["testing:api"],"type":"api"}
Object containing details about a Synthetic API test.
Expand All
フィールド
種類
説明
config [required]
object
Configuration object for a Synthetic API test.
assertions
[object <oneOf>]
Array of assertions used for the test. Required for single API tests.
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
property
string
The associated assertion property.
target [required]
Value used by the operator.
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,connection
Option 2
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.
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,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.
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
object <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
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
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
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
enum
The type of basic authentication to use when performing the test.
Allowed enum values: digest
username [required]
string
Username to use for the digest authentication.
body
string
Body to include in the test.
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.
dnsServer
string
DNS server to use for DNS tests.
dnsServerPort
int32
DNS server port to use for DNS tests.
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.
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
enum
The HTTP method.
Allowed enum values: GET,POST,PATCH,PUT,DELETE,HEAD,OPTIONS
noSavingResponseBody
boolean
Determines whether or not to save the response body.
numberOfPackets
int32
Number of pings to use per test.
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
gRPC service on which you want to perform the healthcheck.
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]
When the test subtype is multi, the steps of the test.
allowFailure
boolean
Determines whether or not to continue with test if this step fails.
assertions [required]
[object <oneOf>]
Array of assertions used for the test.
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
property
string
The associated assertion property.
target [required]
Value used by the operator.
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,connection
Option 2
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.
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,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 Synthetics 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
enum
Property of the Synthetics Test Response to use for a Synthetics global variable.
Allowed enum values: http_body,http_header
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
object <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
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
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
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
enum
The type of basic authentication to use when performing the test.
Allowed enum values: digest
username [required]
string
Username to use for the digest authentication.
body
string
Body to include in the test.
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.
dnsServer
string
DNS server to use for DNS tests.
dnsServerPort
int32
DNS server port to use for DNS tests.
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.
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
enum
The HTTP method.
Allowed enum values: GET,POST,PATCH,PUT,DELETE,HEAD,OPTIONS
noSavingResponseBody
boolean
Determines whether or not to save the response body.
numberOfPackets
int32
Number of pings to use per test.
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
gRPC service on which you want to perform the healthcheck.
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 multistep API test step, currently only supporting http.
Allowed enum values: http
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.
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 Synthetics 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.
follow_redirects
boolean
For API HTTP test, whether or not the test should follow redirects.
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.
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
{"config":{"assertions":[[]],"configVariables":[{"example":"string","id":"string","name":"VARIABLE_NAME","pattern":"string","type":"text"}],"request":{"allow_insecure":false,"basicAuth":{"password":"PaSSw0RD!","type":"web","username":"my_username"},"body":"string","certificate":{"cert":{"content":"string","filename":"string","updatedAt":"string"},"key":{"content":"string","filename":"string","updatedAt":"string"}},"dnsServer":"string","dnsServerPort":"integer","follow_redirects":false,"headers":{"<any-key>":"string"},"host":"string","message":"string","metadata":{"<any-key>":"string"},"method":"GET","noSavingResponseBody":false,"numberOfPackets":"integer","port":"integer","proxy":{"headers":{"<any-key>":"string"},"url":"https://example.com"},"query":{},"servername":"string","service":"string","shouldTrackHops":false,"timeout":"number","url":"https://example.com"},"steps":[{"allowFailure":false,"assertions":[{"operator":"contains","property":"string","target":123456,"type":"statusCode"}],"extractedValues":[{"field":"content-type","name":"string","parser":{"type":"raw","value":"string"},"type":"http_body"}],"isCritical":false,"name":"Example step name","request":{"allow_insecure":false,"basicAuth":{"password":"PaSSw0RD!","type":"web","username":"my_username"},"body":"string","certificate":{"cert":{"content":"string","filename":"string","updatedAt":"string"},"key":{"content":"string","filename":"string","updatedAt":"string"}},"dnsServer":"string","dnsServerPort":"integer","follow_redirects":false,"headers":{"<any-key>":"string"},"host":"string","message":"string","metadata":{"<any-key>":"string"},"method":"GET","noSavingResponseBody":false,"numberOfPackets":"integer","port":"integer","proxy":{"headers":{"<any-key>":"string"},"url":"https://example.com"},"query":{},"servername":"string","service":"string","shouldTrackHops":false,"timeout":"number","url":"https://example.com"},"retry":{"count":"integer","interval":"number"},"subtype":"http"}]},"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":["laptop_large"],"disableCors":false,"follow_redirects":false,"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},"tick_every":"integer"},"public_id":"123-abc-456","status":"live","subtype":"http","tags":["env:production"],"type":"api"}
## Create an API test.
# Example of an API test.
# Curl commandcurl-XPOST"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": "isInMoreThan",
"target": 10,
"type": "certificate"
}
],
"request": {
"host": "datadoghq.com",
"port": 443
}
},
"locations": [
"aws:us-east-2"
],
"message": "BDD test payload: synthetics_api_ssl_test_payload.json",
"name": "Example-Create_an_API_SSL_test_returns_OK_Returns_the_created_test_details_response",
"options": {
"accept_self_signed": true,
"checkCertificateRevocation": true,
"tick_every": 60
},
"subtype": "ssl",
"tags": [
"testing:api"
],
"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 commandcurl-XPOST"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": "isInMoreThan",
"target": 10,
"type": "certificate"
}
],
"request": {
"host": "datadoghq.com",
"port": 443
}
},
"locations": [
"aws:us-east-2"
],
"message": "BDD test payload: synthetics_api_ssl_test_payload.json",
"name": "Example-Create_an_API_SSL_test_returns_OK_Returns_the_created_test_details_response",
"options": {
"accept_self_signed": true,
"checkCertificateRevocation": true,
"tick_every": 60
},
"subtype": "ssl",
"tags": [
"testing:api"
],
"type": "api"
}EOF
// Create an API GRPC test returns "OK - Returns the created test details." response
packagemainimport("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")funcmain(){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,}},},Request:&datadogV1.SyntheticsTestRequest{Host:datadog.PtrString("localhost"),Port:datadog.PtrInt64(50051),Service:datadog.PtrString("Hello"),Method:datadogV1.HTTPMETHOD_GET.Ptr(),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-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response",Options:datadogV1.SyntheticsTestOptions{MinFailureDuration:datadog.PtrInt64(0),MinLocationFailed:datadog.PtrInt64(1),MonitorOptions:&datadogV1.SyntheticsTestOptionsMonitorOptions{RenotifyInterval:datadog.PtrInt64(0),},MonitorName:datadog.PtrString("Example-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response"),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)iferr!=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 returns "OK - Returns the created test details." response
packagemainimport("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")funcmain(){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,}},},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{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":"examplecreateanapihttptestreturnsokreturnsthecreatedtestdetailsresponse",},Method:datadogV1.HTTPMETHOD_GET.Ptr(),Timeout:datadog.PtrFloat64(10),Url:datadog.PtrString("https://datadoghq.com"),Proxy:&datadogV1.SyntheticsTestRequestProxy{Url:"https://datadoghq.com",Headers:map[string]string{},},},},Locations:[]string{"aws:us-east-2",},Message:"BDD test payload: synthetics_api_http_test_payload.json",Name:"Example-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response",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-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response"),MonitorPriority:datadog.PtrInt32(5),Retry:&datadogV1.SyntheticsTestOptionsRetry{Count:datadog.PtrInt64(3),Interval:datadog.PtrFloat64(10),},TickEvery:datadog.PtrInt64(60),},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)iferr!=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 SSL test returns "OK - Returns the created test details." response
packagemainimport("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")funcmain(){body:=datadogV1.SyntheticsAPITest{Config:datadogV1.SyntheticsAPITestConfig{Assertions:[]datadogV1.SyntheticsAssertion{datadogV1.SyntheticsAssertion{SyntheticsAssertionTarget:&datadogV1.SyntheticsAssertionTarget{Operator:datadogV1.SYNTHETICSASSERTIONOPERATOR_IS_IN_MORE_DAYS_THAN,Target:10,Type:datadogV1.SYNTHETICSASSERTIONTYPE_CERTIFICATE,}},},Request:&datadogV1.SyntheticsTestRequest{Host:datadog.PtrString("datadoghq.com"),Port:datadog.PtrInt64(443),},},Locations:[]string{"aws:us-east-2",},Message:"BDD test payload: synthetics_api_ssl_test_payload.json",Name:"Example-Create_an_API_SSL_test_returns_OK_Returns_the_created_test_details_response",Options:datadogV1.SyntheticsTestOptions{AcceptSelfSigned:datadog.PtrBool(true),CheckCertificateRevocation:datadog.PtrBool(true),TickEvery:datadog.PtrInt64(60),},Subtype:datadogV1.SYNTHETICSTESTDETAILSSUBTYPE_SSL.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)iferr!=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
importcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.SyntheticsApi;importcom.datadog.api.client.v1.model.HTTPMethod;importcom.datadog.api.client.v1.model.SyntheticsAPITest;importcom.datadog.api.client.v1.model.SyntheticsAPITestConfig;importcom.datadog.api.client.v1.model.SyntheticsAPITestType;importcom.datadog.api.client.v1.model.SyntheticsAssertion;importcom.datadog.api.client.v1.model.SyntheticsAssertionOperator;importcom.datadog.api.client.v1.model.SyntheticsAssertionTarget;importcom.datadog.api.client.v1.model.SyntheticsAssertionType;importcom.datadog.api.client.v1.model.SyntheticsTestDetailsSubType;importcom.datadog.api.client.v1.model.SyntheticsTestOptions;importcom.datadog.api.client.v1.model.SyntheticsTestOptionsMonitorOptions;importcom.datadog.api.client.v1.model.SyntheticsTestRequest;importjava.util.Collections;importjava.util.Map;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();SyntheticsApiapiInstance=newSyntheticsApi(defaultClient);SyntheticsAPITestbody=newSyntheticsAPITest().config(newSyntheticsAPITestConfig().assertions(Collections.singletonList(newSyntheticsAssertion(newSyntheticsAssertionTarget().operator(SyntheticsAssertionOperator.IS).target(1).type(SyntheticsAssertionType.GRPC_HEALTHCHECK_STATUS)))).request(newSyntheticsTestRequest().host("localhost").port(50051L).service("Hello").method(HTTPMethod.GET).message("").metadata(Map.ofEntries()))).locations(Collections.singletonList("aws:us-east-2")).message("BDD test payload: synthetics_api_grpc_test_payload.json").name("Example-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response").options(newSyntheticsTestOptions().minFailureDuration(0L).minLocationFailed(1L).monitorOptions(newSyntheticsTestOptionsMonitorOptions().renotifyInterval(0L)).monitorName("Example-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response").tickEvery(60L)).subtype(SyntheticsTestDetailsSubType.GRPC).tags(Collections.singletonList("testing:api")).type(SyntheticsAPITestType.API);try{SyntheticsAPITestresult=apiInstance.createSyntheticsAPITest(body);System.out.println(result);}catch(ApiExceptione){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
importcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.SyntheticsApi;importcom.datadog.api.client.v1.model.HTTPMethod;importcom.datadog.api.client.v1.model.SyntheticsAPITest;importcom.datadog.api.client.v1.model.SyntheticsAPITestConfig;importcom.datadog.api.client.v1.model.SyntheticsAPITestType;importcom.datadog.api.client.v1.model.SyntheticsAssertion;importcom.datadog.api.client.v1.model.SyntheticsAssertionJSONPathOperator;importcom.datadog.api.client.v1.model.SyntheticsAssertionJSONPathTarget;importcom.datadog.api.client.v1.model.SyntheticsAssertionJSONPathTargetTarget;importcom.datadog.api.client.v1.model.SyntheticsAssertionOperator;importcom.datadog.api.client.v1.model.SyntheticsAssertionTarget;importcom.datadog.api.client.v1.model.SyntheticsAssertionType;importcom.datadog.api.client.v1.model.SyntheticsConfigVariable;importcom.datadog.api.client.v1.model.SyntheticsConfigVariableType;importcom.datadog.api.client.v1.model.SyntheticsTestDetailsSubType;importcom.datadog.api.client.v1.model.SyntheticsTestOptions;importcom.datadog.api.client.v1.model.SyntheticsTestOptionsRetry;importcom.datadog.api.client.v1.model.SyntheticsTestRequest;importcom.datadog.api.client.v1.model.SyntheticsTestRequestCertificate;importcom.datadog.api.client.v1.model.SyntheticsTestRequestCertificateItem;importcom.datadog.api.client.v1.model.SyntheticsTestRequestProxy;importjava.util.Arrays;importjava.util.Collections;importjava.util.Map;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();SyntheticsApiapiInstance=newSyntheticsApi(defaultClient);SyntheticsAPITestbody=newSyntheticsAPITest().config(newSyntheticsAPITestConfig().assertions(Arrays.asList(newSyntheticsAssertion(newSyntheticsAssertionTarget().operator(SyntheticsAssertionOperator.IS).property("{{ PROPERTY }}").target("text/html").type(SyntheticsAssertionType.HEADER)),newSyntheticsAssertion(newSyntheticsAssertionTarget().operator(SyntheticsAssertionOperator.LESS_THAN).target(2000).type(SyntheticsAssertionType.RESPONSE_TIME)),newSyntheticsAssertion(newSyntheticsAssertionJSONPathTarget().operator(SyntheticsAssertionJSONPathOperator.VALIDATES_JSON_PATH).target(newSyntheticsAssertionJSONPathTargetTarget().jsonPath("topKey").operator("isNot").targetValue("0")).type(SyntheticsAssertionType.BODY)))).configVariables(Collections.singletonList(newSyntheticsConfigVariable().example("content-type").name("PROPERTY").pattern("content-type").type(SyntheticsConfigVariableType.TEXT))).request(newSyntheticsTestRequest().certificate(newSyntheticsTestRequestCertificate().cert(newSyntheticsTestRequestCertificateItem().content("cert-content").filename("cert-filename").updatedAt("2020-10-16T09:23:24.857Z")).key(newSyntheticsTestRequestCertificateItem().content("key-content").filename("key-filename").updatedAt("2020-10-16T09:23:24.857Z"))).headers(Map.ofEntries(Map.entry("unique","examplecreateanapihttptestreturnsokreturnsthecreatedtestdetailsresponse"))).method(HTTPMethod.GET).timeout(10.0).url("https://datadoghq.com").proxy(newSyntheticsTestRequestProxy().url("https://datadoghq.com").headers(Map.ofEntries())))).locations(Collections.singletonList("aws:us-east-2")).message("BDD test payload: synthetics_api_http_test_payload.json").name("Example-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response").options(newSyntheticsTestOptions().acceptSelfSigned(false).allowInsecure(true).followRedirects(true).minFailureDuration(10L).minLocationFailed(1L).monitorName("Example-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response").monitorPriority(5).retry(newSyntheticsTestOptionsRetry().count(3L).interval(10.0)).tickEvery(60L)).subtype(SyntheticsTestDetailsSubType.HTTP).tags(Collections.singletonList("testing:api")).type(SyntheticsAPITestType.API);try{SyntheticsAPITestresult=apiInstance.createSyntheticsAPITest(body);System.out.println(result);}catch(ApiExceptione){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 SSL test returns "OK - Returns the created test details." response
importcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.SyntheticsApi;importcom.datadog.api.client.v1.model.SyntheticsAPITest;importcom.datadog.api.client.v1.model.SyntheticsAPITestConfig;importcom.datadog.api.client.v1.model.SyntheticsAPITestType;importcom.datadog.api.client.v1.model.SyntheticsAssertion;importcom.datadog.api.client.v1.model.SyntheticsAssertionOperator;importcom.datadog.api.client.v1.model.SyntheticsAssertionTarget;importcom.datadog.api.client.v1.model.SyntheticsAssertionType;importcom.datadog.api.client.v1.model.SyntheticsTestDetailsSubType;importcom.datadog.api.client.v1.model.SyntheticsTestOptions;importcom.datadog.api.client.v1.model.SyntheticsTestRequest;importjava.util.Collections;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();SyntheticsApiapiInstance=newSyntheticsApi(defaultClient);SyntheticsAPITestbody=newSyntheticsAPITest().config(newSyntheticsAPITestConfig().assertions(Collections.singletonList(newSyntheticsAssertion(newSyntheticsAssertionTarget().operator(SyntheticsAssertionOperator.IS_IN_MORE_DAYS_THAN).target(10).type(SyntheticsAssertionType.CERTIFICATE)))).request(newSyntheticsTestRequest().host("datadoghq.com").port(443L))).locations(Collections.singletonList("aws:us-east-2")).message("BDD test payload: synthetics_api_ssl_test_payload.json").name("Example-Create_an_API_SSL_test_returns_OK_Returns_the_created_test_details_response").options(newSyntheticsTestOptions().acceptSelfSigned(true).checkCertificateRevocation(true).tickEvery(60L)).subtype(SyntheticsTestDetailsSubType.SSL).tags(Collections.singletonList("testing:api")).type(SyntheticsAPITestType.API);try{SyntheticsAPITestresult=apiInstance.createSyntheticsAPITest(body);System.out.println(result);}catch(ApiExceptione){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 GRPC test returns "OK - Returns the created test details." response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.synthetics_apiimportSyntheticsApifromdatadog_api_client.v1.model.http_methodimportHTTPMethodfromdatadog_api_client.v1.model.synthetics_api_testimportSyntheticsAPITestfromdatadog_api_client.v1.model.synthetics_api_test_configimportSyntheticsAPITestConfigfromdatadog_api_client.v1.model.synthetics_api_test_typeimportSyntheticsAPITestTypefromdatadog_api_client.v1.model.synthetics_assertion_operatorimportSyntheticsAssertionOperatorfromdatadog_api_client.v1.model.synthetics_assertion_targetimportSyntheticsAssertionTargetfromdatadog_api_client.v1.model.synthetics_assertion_typeimportSyntheticsAssertionTypefromdatadog_api_client.v1.model.synthetics_test_details_sub_typeimportSyntheticsTestDetailsSubTypefromdatadog_api_client.v1.model.synthetics_test_metadataimportSyntheticsTestMetadatafromdatadog_api_client.v1.model.synthetics_test_optionsimportSyntheticsTestOptionsfromdatadog_api_client.v1.model.synthetics_test_options_monitor_optionsimportSyntheticsTestOptionsMonitorOptionsfromdatadog_api_client.v1.model.synthetics_test_requestimportSyntheticsTestRequestbody=SyntheticsAPITest(config=SyntheticsAPITestConfig(assertions=[SyntheticsAssertionTarget(operator=SyntheticsAssertionOperator("is"),target=1,type=SyntheticsAssertionType("grpcHealthcheckStatus"),),],request=SyntheticsTestRequest(host="localhost",port=50051,service="Hello",method=HTTPMethod("GET"),message="",metadata=SyntheticsTestMetadata(),),),locations=["aws:us-east-2",],message="BDD test payload: synthetics_api_grpc_test_payload.json",name="Example-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response",options=SyntheticsTestOptions(min_failure_duration=0,min_location_failed=1,monitor_options=SyntheticsTestOptionsMonitorOptions(renotify_interval=0,),monitor_name="Example-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response",tick_every=60,),subtype=SyntheticsTestDetailsSubType("grpc"),tags=["testing:api",],type=SyntheticsAPITestType("api"),)configuration=Configuration()withApiClient(configuration)asapi_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
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.synthetics_apiimportSyntheticsApifromdatadog_api_client.v1.model.http_methodimportHTTPMethodfromdatadog_api_client.v1.model.synthetics_api_testimportSyntheticsAPITestfromdatadog_api_client.v1.model.synthetics_api_test_configimportSyntheticsAPITestConfigfromdatadog_api_client.v1.model.synthetics_api_test_typeimportSyntheticsAPITestTypefromdatadog_api_client.v1.model.synthetics_assertion_json_path_operatorimportSyntheticsAssertionJSONPathOperatorfromdatadog_api_client.v1.model.synthetics_assertion_json_path_targetimportSyntheticsAssertionJSONPathTargetfromdatadog_api_client.v1.model.synthetics_assertion_json_path_target_targetimport(SyntheticsAssertionJSONPathTargetTarget,)fromdatadog_api_client.v1.model.synthetics_assertion_operatorimportSyntheticsAssertionOperatorfromdatadog_api_client.v1.model.synthetics_assertion_targetimportSyntheticsAssertionTargetfromdatadog_api_client.v1.model.synthetics_assertion_typeimportSyntheticsAssertionTypefromdatadog_api_client.v1.model.synthetics_config_variableimportSyntheticsConfigVariablefromdatadog_api_client.v1.model.synthetics_config_variable_typeimportSyntheticsConfigVariableTypefromdatadog_api_client.v1.model.synthetics_test_details_sub_typeimportSyntheticsTestDetailsSubTypefromdatadog_api_client.v1.model.synthetics_test_headersimportSyntheticsTestHeadersfromdatadog_api_client.v1.model.synthetics_test_optionsimportSyntheticsTestOptionsfromdatadog_api_client.v1.model.synthetics_test_options_retryimportSyntheticsTestOptionsRetryfromdatadog_api_client.v1.model.synthetics_test_requestimportSyntheticsTestRequestfromdatadog_api_client.v1.model.synthetics_test_request_certificateimportSyntheticsTestRequestCertificatefromdatadog_api_client.v1.model.synthetics_test_request_certificate_itemimportSyntheticsTestRequestCertificateItemfromdatadog_api_client.v1.model.synthetics_test_request_proxyimportSyntheticsTestRequestProxybody=SyntheticsAPITest(config=SyntheticsAPITestConfig(assertions=[SyntheticsAssertionTarget(operator=SyntheticsAssertionOperator("is"),_property="{{ PROPERTY }}",target="text/html",type=SyntheticsAssertionType("header"),),SyntheticsAssertionTarget(operator=SyntheticsAssertionOperator("lessThan"),target=2000,type=SyntheticsAssertionType("responseTime"),),SyntheticsAssertionJSONPathTarget(operator=SyntheticsAssertionJSONPathOperator("validatesJSONPath"),target=SyntheticsAssertionJSONPathTargetTarget(json_path="topKey",operator="isNot",target_value="0",),type=SyntheticsAssertionType("body"),),],config_variables=[SyntheticsConfigVariable(example="content-type",name="PROPERTY",pattern="content-type",type=SyntheticsConfigVariableType("text"),),],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="examplecreateanapihttptestreturnsokreturnsthecreatedtestdetailsresponse",),method=HTTPMethod("GET"),timeout=10.0,url="https://datadoghq.com",proxy=SyntheticsTestRequestProxy(url="https://datadoghq.com",headers=SyntheticsTestHeaders(),),),),locations=["aws:us-east-2",],message="BDD test payload: synthetics_api_http_test_payload.json",name="Example-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response",options=SyntheticsTestOptions(accept_self_signed=False,allow_insecure=True,follow_redirects=True,min_failure_duration=10,min_location_failed=1,monitor_name="Example-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response",monitor_priority=5,retry=SyntheticsTestOptionsRetry(count=3,interval=10.0,),tick_every=60,),subtype=SyntheticsTestDetailsSubType("http"),tags=["testing:api",],type=SyntheticsAPITestType("api"),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=SyntheticsApi(api_client)response=api_instance.create_synthetics_api_test(body=body)print(response)
"""
Create an API SSL test returns "OK - Returns the created test details." response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.synthetics_apiimportSyntheticsApifromdatadog_api_client.v1.model.synthetics_api_testimportSyntheticsAPITestfromdatadog_api_client.v1.model.synthetics_api_test_configimportSyntheticsAPITestConfigfromdatadog_api_client.v1.model.synthetics_api_test_typeimportSyntheticsAPITestTypefromdatadog_api_client.v1.model.synthetics_assertion_operatorimportSyntheticsAssertionOperatorfromdatadog_api_client.v1.model.synthetics_assertion_targetimportSyntheticsAssertionTargetfromdatadog_api_client.v1.model.synthetics_assertion_typeimportSyntheticsAssertionTypefromdatadog_api_client.v1.model.synthetics_test_details_sub_typeimportSyntheticsTestDetailsSubTypefromdatadog_api_client.v1.model.synthetics_test_optionsimportSyntheticsTestOptionsfromdatadog_api_client.v1.model.synthetics_test_requestimportSyntheticsTestRequestbody=SyntheticsAPITest(config=SyntheticsAPITestConfig(assertions=[SyntheticsAssertionTarget(operator=SyntheticsAssertionOperator("isInMoreThan"),target=10,type=SyntheticsAssertionType("certificate"),),],request=SyntheticsTestRequest(host="datadoghq.com",port=443,),),locations=["aws:us-east-2",],message="BDD test payload: synthetics_api_ssl_test_payload.json",name="Example-Create_an_API_SSL_test_returns_OK_Returns_the_created_test_details_response",options=SyntheticsTestOptions(accept_self_signed=True,check_certificate_revocation=True,tick_every=60,),subtype=SyntheticsTestDetailsSubType("ssl"),tags=["testing:api",],type=SyntheticsAPITestType("api"),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=SyntheticsApi(api_client)response=api_instance.create_synthetics_api_test(body=body)print(response)
# Create an API GRPC test returns "OK - Returns the created test details." responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::SyntheticsAPI.newbody=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,}),],request:DatadogAPIClient::V1::SyntheticsTestRequest.new({host:"localhost",port:50051,service:"Hello",method:DatadogAPIClient::V1::HTTPMethod::GET,message:"",metadata:DatadogAPIClient::V1::SyntheticsTestMetadata.new({}),}),}),locations:["aws:us-east-2",],message:"BDD test payload: synthetics_api_grpc_test_payload.json",name:"Example-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response",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-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response",tick_every:60,}),subtype:DatadogAPIClient::V1::SyntheticsTestDetailsSubType::GRPC,tags:["testing:api",],type:DatadogAPIClient::V1::SyntheticsAPITestType::API,})papi_instance.create_synthetics_api_test(body)
# Create an API HTTP test returns "OK - Returns the created test details." responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::SyntheticsAPI.newbody=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,}),],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({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:DatadogAPIClient::V1::SyntheticsTestHeaders.new({unique:"examplecreateanapihttptestreturnsokreturnsthecreatedtestdetailsresponse",}),method:DatadogAPIClient::V1::HTTPMethod::GET,timeout:10,url:"https://datadoghq.com",proxy:DatadogAPIClient::V1::SyntheticsTestRequestProxy.new({url:"https://datadoghq.com",headers:DatadogAPIClient::V1::SyntheticsTestHeaders.new({}),}),}),}),locations:["aws:us-east-2",],message:"BDD test payload: synthetics_api_http_test_payload.json",name:"Example-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response",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-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response",monitor_priority:5,_retry:DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({count:3,interval:10,}),tick_every:60,}),subtype:DatadogAPIClient::V1::SyntheticsTestDetailsSubType::HTTP,tags:["testing:api",],type:DatadogAPIClient::V1::SyntheticsAPITestType::API,})papi_instance.create_synthetics_api_test(body)
# Create an API SSL test returns "OK - Returns the created test details." responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::SyntheticsAPI.newbody=DatadogAPIClient::V1::SyntheticsAPITest.new({config:DatadogAPIClient::V1::SyntheticsAPITestConfig.new({assertions:[DatadogAPIClient::V1::SyntheticsAssertionTarget.new({operator:DatadogAPIClient::V1::SyntheticsAssertionOperator::IS_IN_MORE_DAYS_THAN,target:10,type:DatadogAPIClient::V1::SyntheticsAssertionType::CERTIFICATE,}),],request:DatadogAPIClient::V1::SyntheticsTestRequest.new({host:"datadoghq.com",port:443,}),}),locations:["aws:us-east-2",],message:"BDD test payload: synthetics_api_ssl_test_payload.json",name:"Example-Create_an_API_SSL_test_returns_OK_Returns_the_created_test_details_response",options:DatadogAPIClient::V1::SyntheticsTestOptions.new({accept_self_signed:true,check_certificate_revocation:true,tick_every:60,}),subtype:DatadogAPIClient::V1::SyntheticsTestDetailsSubType::SSL,tags:["testing:api",],type:DatadogAPIClient::V1::SyntheticsAPITestType::API,})papi_instance.create_synthetics_api_test(body)
/**
* Create an API GRPC test returns "OK - Returns the created test details." response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.SyntheticsApi(configuration);constparams: v1.SyntheticsApiCreateSyntheticsAPITestRequest={body:{config:{assertions:[{operator:"is",target: 1,type:"grpcHealthcheckStatus",},],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-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response",options:{minFailureDuration: 0,minLocationFailed: 1,monitorOptions:{renotifyInterval: 0,},monitorName:"Example-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response",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 returns "OK - Returns the created test details." response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.SyntheticsApi(configuration);constparams: v1.SyntheticsApiCreateSyntheticsAPITestRequest={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",},],configVariables:[{example:"content-type",name:"PROPERTY",pattern:"content-type",type:"text",},],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:"examplecreateanapihttptestreturnsokreturnsthecreatedtestdetailsresponse",},method:"GET",timeout: 10,url:"https://datadoghq.com",proxy:{url:"https://datadoghq.com",headers:{},},},},locations:["aws:us-east-2"],message:"BDD test payload: synthetics_api_http_test_payload.json",name:"Example-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response",options:{acceptSelfSigned: false,allowInsecure: true,followRedirects: true,minFailureDuration: 10,minLocationFailed: 1,monitorName:"Example-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response",monitorPriority: 5,retry:{count: 3,interval: 10,},tickEvery: 60,},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 SSL test returns "OK - Returns the created test details." response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.SyntheticsApi(configuration);constparams: v1.SyntheticsApiCreateSyntheticsAPITestRequest={body:{config:{assertions:[{operator:"isInMoreThan",target: 10,type:"certificate",},],request:{host:"datadoghq.com",port: 443,},},locations:["aws:us-east-2"],message:"BDD test payload: synthetics_api_ssl_test_payload.json",name:"Example-Create_an_API_SSL_test_returns_OK_Returns_the_created_test_details_response",options:{acceptSelfSigned: true,checkCertificateRevocation: true,tickEvery: 60,},subtype:"ssl",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));
Configuration object for a Synthetic browser test.
assertions [required]
[object <oneOf>]
Array of assertions used for the test.
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
property
string
The associated assertion property.
target [required]
Value used by the operator.
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,connection
Option 2
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.
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,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.
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
object <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
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
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
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
enum
The type of basic authentication to use when performing the test.
Allowed enum values: digest
username [required]
string
Username to use for the digest authentication.
body
string
Body to include in the test.
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.
dnsServer
string
DNS server to use for DNS tests.
dnsServerPort
int32
DNS server port to use for DNS tests.
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.
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
enum
The HTTP method.
Allowed enum values: GET,POST,PATCH,PUT,DELETE,HEAD,OPTIONS
noSavingResponseBody
boolean
Determines whether or not to save the response body.
numberOfPackets
int32
Number of pings to use per test.
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
gRPC service on which you want to perform the healthcheck.
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.
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.
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 Synthetics 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.
follow_redirects
boolean
For API HTTP test, whether or not the test should follow redirects.
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.
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]
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.
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
Object containing details about a Synthetic browser test.
Expand All
フィールド
種類
説明
config [required]
object
Configuration object for a Synthetic browser test.
assertions [required]
[object <oneOf>]
Array of assertions used for the test.
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
property
string
The associated assertion property.
target [required]
Value used by the operator.
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,connection
Option 2
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.
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,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.
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
object <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
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
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
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
enum
The type of basic authentication to use when performing the test.
Allowed enum values: digest
username [required]
string
Username to use for the digest authentication.
body
string
Body to include in the test.
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.
dnsServer
string
DNS server to use for DNS tests.
dnsServerPort
int32
DNS server port to use for DNS tests.
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.
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
enum
The HTTP method.
Allowed enum values: GET,POST,PATCH,PUT,DELETE,HEAD,OPTIONS
noSavingResponseBody
boolean
Determines whether or not to save the response body.
numberOfPackets
int32
Number of pings to use per test.
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
gRPC service on which you want to perform the healthcheck.
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.
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.
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 Synthetics 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.
follow_redirects
boolean
For API HTTP test, whether or not the test should follow redirects.
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.
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]
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.
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
{"config":{"assertions":[{"operator":"contains","property":"string","target":123456,"type":"statusCode"}],"configVariables":[{"example":"string","id":"string","name":"VARIABLE_NAME","pattern":"string","type":"text"}],"request":{"allow_insecure":false,"basicAuth":{"password":"PaSSw0RD!","type":"web","username":"my_username"},"body":"string","certificate":{"cert":{"content":"string","filename":"string","updatedAt":"string"},"key":{"content":"string","filename":"string","updatedAt":"string"}},"dnsServer":"string","dnsServerPort":"integer","follow_redirects":false,"headers":{"<any-key>":"string"},"host":"string","message":"string","metadata":{"<any-key>":"string"},"method":"GET","noSavingResponseBody":false,"numberOfPackets":"integer","port":"integer","proxy":{"headers":{"<any-key>":"string"},"url":"https://example.com"},"query":{},"servername":"string","service":"string","shouldTrackHops":false,"timeout":"number","url":"https://example.com"},"setCookie":"string","variables":[{"example":"string","id":"string","name":"VARIABLE_NAME","pattern":"string","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":["laptop_large"],"disableCors":false,"follow_redirects":false,"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},"tick_every":"integer"},"public_id":"string","status":"live","steps":[{"allowFailure":false,"isCritical":false,"name":"string","params":{},"timeout":"integer","type":"assertElementContent"}],"tags":["env:prod"],"type":"browser"}