Create a browser test
https://api.datadoghq.com/api/v1/synthetics/tests/browserhttps://api.us3.datadoghq.com/api/v1/synthetics/tests/browserhttps://api.us5.datadoghq.com/api/v1/synthetics/tests/browserhttps://api.datadoghq.eu/api/v1/synthetics/tests/browserhttps://api.ap1.datadoghq.com/api/v1/synthetics/tests/browserhttps://api.ap2.datadoghq.com/api/v1/synthetics/tests/browserhttps://api.uk1.datadoghq.com/api/v1/synthetics/tests/browserhttps://api.ddog-gov.com/api/v1/synthetics/tests/browserhttps://api.us2.ddog-gov.com/api/v1/synthetics/tests/browserOverview
Create a Synthetic browser test.
OAuth apps require the synthetics_write authorization scope to access this endpoint.
Request
Body Data (required)
Details of the test to create.
config [required]Configuration object for a Synthetic browser test.
assertions [required]Array of assertions used for the test.
Object 1An assertion which uses a simple target.
operator [required]Assertion operator to apply.
contains, doesNotContain, is, isNot, lessThan, lessThanOrEqual, moreThan, moreThanOrEqual, matches, doesNotMatchShow 5 more
validates, isInMoreThan, isInLessThan, doesNotExist, isUndefinedpropertyThe associated assertion property.
target [required]Value used by the operator.
Object 1Numeric value used by the operator in assertions.
Object 2String value used by the operator in assertions. Supports templated variables.
timingsScopeTimings scope for response time assertions.
all, withoutDNStype [required]Type of the assertion.
body, header, statusCode, certificate, responseTime, property, recordEvery, recordSome, tlsVersion, minTlsVersionShow 13 more
latency, packetLossPercentage, packetsReceived, networkHop, receivedMessage, grpcHealthcheckStatus, grpcMetadata, grpcProto, connection, multiNetworkHop, jitter, mcpToolNameLength, mcpToolCountObject 2An assertion which targets body hash.
operator [required]Assertion operator to apply.
md5, sha1, sha256target [required]Value used by the operator.
Object 1Numeric value used by the operator in assertions.
Object 2String value used by the operator in assertions. Supports templated variables.
type [required]Type of the assertion.
bodyHashObject 3An assertion for the validatesJSONPath operator.
operator [required]Assertion operator to apply.
validatesJSONPathpropertyThe associated assertion property.
targetComposed target for validatesJSONPath operator.
elementsOperatorThe element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.
jsonPathThe JSON path to assert.
operatorThe specific operator to use on the path.
targetValueThe path target value to compare to.
Object 1Numeric value used by the operator in assertions.
Object 2String value used by the operator in assertions. Supports templated variables.
type [required]Type of the assertion.
body, header, statusCode, certificate, responseTime, property, recordEvery, recordSome, tlsVersion, minTlsVersionShow 13 more
latency, packetLossPercentage, packetsReceived, networkHop, receivedMessage, grpcHealthcheckStatus, grpcMetadata, grpcProto, connection, multiNetworkHop, jitter, mcpToolNameLength, mcpToolCountObject 4An assertion for the validatesJSONSchema operator.
operator [required]Assertion operator to apply.
validatesJSONSchematargetComposed target for validatesJSONSchema operator.
jsonSchemaThe JSON Schema to assert.
metaSchemaThe JSON Schema meta-schema version used in the assertion.
draft-07, draft-06type [required]Type of the assertion.
body, header, statusCode, certificate, responseTime, property, recordEvery, recordSome, tlsVersion, minTlsVersionShow 13 more
latency, packetLossPercentage, packetsReceived, networkHop, receivedMessage, grpcHealthcheckStatus, grpcMetadata, grpcProto, connection, multiNetworkHop, jitter, mcpToolNameLength, mcpToolCountObject 5An assertion for the validatesXPath operator.
operator [required]Assertion operator to apply.
validatesXPathpropertyThe associated assertion property.
targetComposed target for validatesXPath operator.
operatorThe specific operator to use on the path.
targetValueThe path target value to compare to.
Object 1Numeric value used by the operator in assertions.
Object 2String value used by the operator in assertions. Supports templated variables.
xPathThe X path to assert.
type [required]Type of the assertion.
body, header, statusCode, certificate, responseTime, property, recordEvery, recordSome, tlsVersion, minTlsVersionShow 13 more
latency, packetLossPercentage, packetsReceived, networkHop, receivedMessage, grpcHealthcheckStatus, grpcMetadata, grpcProto, connection, multiNetworkHop, jitter, mcpToolNameLength, mcpToolCountObject 6A JavaScript assertion.
code [required]The JavaScript code that performs the assertions.
type [required]Type of the assertion.
javascriptObject 7An assertion that checks that an MCP server advertises the expected capabilities.
operator [required]Assertion operator to apply.
contains, doesNotContain, is, isNot, lessThan, lessThanOrEqual, moreThan, moreThanOrEqual, matches, doesNotMatchShow 5 more
validates, isInMoreThan, isInLessThan, doesNotExist, isUndefinedtarget [required]List of MCP server capabilities to assert against.
type [required]Type of the assertion.
mcpServerCapabilitiesObject 8An assertion that verifies the MCP server response respects the MCP specification.
type [required]Type of the assertion.
mcpRespectsSpecificationconfigVariablesArray of variables used for the test.
exampleExample for the variable.
idID of the variable for global variables.
name [required]Name of the variable.
patternPattern of the variable.
secureWhether the value of this variable will be obfuscated in test results. Only for config variables of type text.
type [required]Type of the configuration variable.
global, text, emailrequest [required]Object describing the Synthetic test request.
allow_insecureAllows loading insecure content for an HTTP request in a multistep test step.
basicAuthObject to handle basic authentication when performing the test.
<type=web>Object to handle basic authentication when performing the test.
passwordPassword to use for the basic authentication.
typeThe type of basic authentication to use when performing the test.
webwebusernameUsername to use for the basic authentication.
<type=sigv4>Object to handle SIGV4 authentication when performing the test.
accessKey [required]Access key for the SIGV4 authentication.
regionRegion for the SIGV4 authentication.
secretKey [required]Secret key for the SIGV4 authentication.
serviceNameService name for the SIGV4 authentication.
sessionTokenSession token for the SIGV4 authentication.
type [required]The type of authentication to use when performing the test.
sigv4sigv4<type=ntlm>Object to handle NTLM authentication when performing the test.
domainDomain for the authentication to use when performing the test.
passwordPassword for the authentication to use when performing the test.
type [required]The type of authentication to use when performing the test.
ntlmntlmusernameUsername for the authentication to use when performing the test.
workstationWorkstation for the authentication to use when performing the test.
<type=digest>Object to handle digest authentication when performing the test.
password [required]Password to use for the digest authentication.
type [required]The type of basic authentication to use when performing the test.
digestdigestusername [required]Username to use for the digest authentication.
<type=oauth-client>Object to handle oauth client authentication when performing the test.
accessTokenUrl [required]Access token URL to use when performing the authentication.
audienceAudience to use when performing the authentication.
clientId [required]Client ID to use when performing the authentication.
clientSecret [required]Client secret to use when performing the authentication.
resourceResource to use when performing the authentication.
scopeScope to use when performing the authentication.
tokenApiAuthentication [required]Type of token to use when performing the authentication.
header, bodytype [required]The type of basic authentication to use when performing the test.
oauth-clientoauth-client<type=oauth-rop>Object to handle oauth rop authentication when performing the test.
accessTokenUrl [required]Access token URL to use when performing the authentication.
audienceAudience to use when performing the authentication.
clientIdClient ID to use when performing the authentication.
clientSecretClient secret to use when performing the authentication.
password [required]Password to use when performing the authentication.
resourceResource to use when performing the authentication.
scopeScope to use when performing the authentication.
tokenApiAuthentication [required]Type of token to use when performing the authentication.
header, bodytype [required]The type of basic authentication to use when performing the test.
oauth-ropoauth-ropusername [required]Username to use when performing the authentication.
<type=jwt>Object to handle JWT authentication when performing the test.
addClaimsStandard JWT claims to automatically inject.
expWhether to inject the exp (expiration) claim.
iatWhether to inject the iat (issued at) claim.
algorithm [required]Algorithm to use for the JWT authentication.
HS256, RS256, ES256expiresInToken time-to-live in seconds.
headerCustom JWT header as a JSON string.
payload [required]JWT claims as a JSON string.
secret [required]Signing key for the JWT authentication. Use the shared secret for HS256
or the private key (PEM format) for RS256 and ES256.
tokenPrefixPrefix added before the token in the Authorization header. Defaults to Bearer.
type [required]The type of authentication to use when performing the test.
jwtjwtbodyBody to include in the test.
bodyTypeType of the request body.
text/plain, application/json, text/xml, text/html, application/x-www-form-urlencoded, graphql, application/octet-stream, multipart/form-datacallTypeThe type of call to perform. Used by gRPC steps (healthcheck, unary)
and MCP steps (init, tool_list, tool_call). Valid values depend on
the parent step's subtype.
healthcheck, unary, init, tool_list, tool_callcertificateClient certificate to use when performing the test request.
certDefine a request certificate.
contentContent of the certificate or key.
filenameFile name for the certificate or key.
updatedAtDate of update of the certificate or key, ISO format.
keyDefine a request certificate.
contentContent of the certificate or key.
filenameFile name for the certificate or key.
updatedAtDate of update of the certificate or key, ISO format.
certificateDomainsBy default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.
checkCertificateRevocationCheck for certificate revocation.
compressedJsonDescriptorA protobuf JSON descriptor that needs to be gzipped first then base64 encoded.
compressedProtoFileA protobuf file that needs to be gzipped first then base64 encoded.
disableAiaIntermediateFetchingDisable fetching intermediate certificates from AIA.
dnsServerDNS server to use for DNS tests.
dnsServerPortDNS server port to use for DNS tests.
Object 1Integer DNS server port number to use when performing the test.
Object 2String DNS server port number to use when performing the test. Supports templated variables.
filesFiles to be used as part of the request in the test. Only valid if bodyType is multipart/form-data.
bucketKeyBucket key of the file.
contentContent of the file.
encodingEncoding of the file content. The only supported value is base64, indicating the content field contains base64-encoded data.
nameName of the file.
originalFileNameOriginal name of the file.
sizeSize of the file.
typeType of the file.
follow_redirectsSpecifies whether or not the request follows redirects.
formForm to be used as part of the request in the test. Only valid if bodyType is multipart/form-data.
<any-key>A single form entry.
headersHeaders to include when performing the test.
<any-key>A single Header.
hostHost name to perform the test with.
httpVersionHTTP version to use for a Synthetic test.
http1, http2, anyignore_certificate_validationFor SSL tests, whether the test should ignore certificate validation.
isMessageBase64EncodedWhether the message is base64 encoded.
mcpProtocolVersionThe MCP protocol version used by the step. See https://modelcontextprotocol.io/specification.
2025-06-18messageMessage to send for UDP or WebSocket tests.
metadataMetadata to include when performing the gRPC test.
<any-key>A single metadatum.
methodEither the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.
noSavingResponseBodyDetermines whether or not to save the response body.
numberOfPacketsNumber of pings to use per test.
persistCookiesPersist cookies across redirects.
portPort to use when performing the test.
Object 1Integer Port number to use when performing the test.
Object 2String Port number to use when performing the test. Supports templated variables.
proxyThe proxy to perform the test.
headersHeaders to include when performing the test.
<any-key>A single Header.
url [required]URL of the proxy to perform the test.
queryQuery to use for the test.
servernameFor 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.
serviceThe gRPC service on which you want to perform the gRPC call.
shouldTrackHopsTurns on a traceroute probe to discover all gateways along the path to the host destination.
timeoutTimeout in seconds for the test.
toolArgsArguments to pass to the MCP tool. Free-form object whose shape depends on the tool. Used when callType is tool_call.
toolNameThe name of the MCP tool to call. Required when callType is tool_call.
urlURL to perform the test with.
variablesArray of variables used for the test steps.
exampleExample for the variable.
idID for the variable. Global variables require an ID.
name [required]Name of the variable.
patternPattern of the variable.
secureDetermines whether or not the browser test variable is obfuscated. Can only be used with browser variables of type text.
type [required]Type of browser test variable.
element, email, global, textlocations [required]Array of locations used to run the test.
message [required]Notification message associated with the test. Message can either be text or an empty string.
name [required]Name of the test.
options [required]Object describing the extra options for a Synthetic test.
accept_self_signedFor SSL tests, whether or not the test should allow self signed certificates.
allow_insecureAllows loading insecure content for an HTTP request in an API test.
bits_ai_auto_investigateWhether Bits AI automatically investigates alerts from the test monitor.
blockedRequestPatternsArray of URL patterns to block.
captureNetworkPayloadsCapture HTTP request/response headers and bodies for Fetch/XHR calls made during browser tests.
checkCertificateRevocationFor SSL tests, whether or not the test should fail on revoked certificate in stapled OCSP.
ciCI/CD options for a Synthetic test.
executionRule [required]Execution rule for a Synthetic test.
blocking, non_blocking, skippeddevice_idsFor browser test, array with the different device IDs used to run the test.
disableAiaIntermediateFetchingFor SSL tests, whether or not the test should disable fetching intermediate certificates from AIA.
disableCorsWhether or not to disable CORS mechanism.
disableCspDisable Content Security Policy for browser tests.
enableProfilingEnable profiling for browser tests.
enableSecurityTestingDEPRECATED Enable security testing for browser tests. Security testing is not available anymore. This field is deprecated and won't be used.
follow_redirectsFor API HTTP test, whether or not the test should follow redirects.
httpVersionHTTP version to use for a Synthetic test.
http1, http2, anyignoreServerCertificateErrorIgnore server certificate error for browser tests.
ignore_certificate_validationFor SSL tests, whether the test should ignore certificate validation.
initialNavigationTimeoutTimeout before declaring the initial step as failed (in seconds) for browser tests.
min_failure_durationMinimum amount of time in failure required to trigger an alert.
min_location_failedMinimum number of locations in failure required to trigger an alert.
monitor_nameThe monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.
monitor_optionsObject containing the options for a Synthetic test as a monitor (for example, renotification).
escalation_messageMessage to include in the escalation notification.
notification_preset_nameThe name of the preset for the notification for the monitor.
show_all, hide_all, hide_query, hide_handles, hide_query_and_handles, show_only_snapshot, hide_handles_and_footerrenotify_intervalTime interval before renotifying if the test is still failing (in minutes).
renotify_occurrencesThe number of times to renotify if the test is still failing.
monitor_priorityInteger from 1 (high) to 5 (low) indicating alert severity.
noScreenshotPrevents saving screenshots of the steps.
restricted_rolesDEPRECATED A list of role identifiers that can be pulled from the Roles API, for restricting read and write access. This field is deprecated. Use the restriction policies API to manage permissions.
retryObject describing the retry strategy to apply to a Synthetic test.
countNumber of times a test needs to be retried before marking a location as failed. Defaults to 0.
intervalTime interval between retries (in milliseconds). Defaults to 300ms.
rumSettingsThe 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.
applicationIdRUM application ID used to collect RUM data for the browser test.
clientTokenIdRUM application API key ID used to collect RUM data for the browser test.
isEnabled [required]Determines whether RUM data is collected during test runs.
schedulingObject containing timeframes and timezone used for advanced scheduling.
timeframes [required]Array containing objects describing the scheduling pattern to apply to each day.
day [required]Number representing the day of the week.
from [required]The hour of the day on which scheduling starts.
to [required]The hour of the day on which scheduling ends.
timezone [required]Timezone in which the timeframe is based.
tick_everyThe frequency at which to run the Synthetic test (in seconds).
statusDefine whether you want to start (live) or pause (paused) a
Synthetic test.
live, pausedstepsArray of steps for the test.
allowFailureA boolean set to allow this step to fail.
alwaysExecuteA boolean set to always execute this step even if the previous step failed or was skipped.
exitIfSucceedA boolean set to exit the test if the step succeeds.
isCriticalA boolean to use in addition to allowFailure to determine if the test should be marked as failed when the step fails.
nameThe name of the step.
noScreenshotA boolean set to skip taking a screenshot for the step.
paramsThe parameters of the step.
public_idThe public ID of the step.
timeoutThe time before declaring a step failed.
typeStep type used in your Synthetic test.
assertCurrentUrl, assertElementAttribute, assertElementContent, assertElementPresent, assertEmail, assertFileDownload, assertFromJavascript, assertPageContains, assertPageLacks, assertRequestsShow 19 more
click, drag, drop, extractFromJavascript, extractFromEmailBody, extractVariable, goToEmailLink, goToUrl, goToUrlAndMeasureTti, hover, playSubTest, pressKey, refresh, runApiTest, scroll, selectOption, typeText, uploadFiles, waittagsArray of tags attached to the test.
type [required]Type of the Synthetic test, browser.
browserbrowserCreate a browser test returns "OK - Returns saved rumSettings." response
{
"config": {
"assertions": [],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com",
"certificateDomains": [
"https://datadoghq.com"
]
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"tablet"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"rumSettings": {
"isEnabled": true,
"applicationId": "mockApplicationId",
"clientTokenId": 12345
},
"tick_every": 300,
"ci": {
"executionRule": "skipped"
},
"ignoreServerCertificateError": true,
"disableCsp": true,
"initialNavigationTimeout": 200
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}Create a browser test returns "OK - Returns the created test details." response
{
"config": {
"assertions": [],
"variables": [
{
"type": "text",
"name": "TEST_VARIABLE",
"pattern": "secret",
"secure": true,
"example": "secret"
}
],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text",
"secure": true
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com"
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"chrome.laptop_large"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"tick_every": 300,
"enableProfiling": true,
"enableSecurityTesting": true
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"alwaysExecute": true,
"exitIfSucceed": true,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}Create a browser test with advanced scheduling options returns "OK - Returns the created test details." response
{
"config": {
"assertions": [],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com"
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"tablet"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"tick_every": 300,
"scheduling": {
"timeframes": [
{
"day": 1,
"from": "07:00",
"to": "16:00"
},
{
"day": 3,
"from": "07:00",
"to": "16:00"
}
],
"timezone": "America/New_York"
}
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}Response
OK - Returns the created test details.
Object containing details about a Synthetic browser test.
config [required]Configuration object for a Synthetic browser test.
assertions [required]Array of assertions used for the test.
Object 1An assertion which uses a simple target.
operator [required]Assertion operator to apply.
contains, doesNotContain, is, isNot, lessThan, lessThanOrEqual, moreThan, moreThanOrEqual, matches, doesNotMatchShow 5 more
validates, isInMoreThan, isInLessThan, doesNotExist, isUndefinedpropertyThe associated assertion property.
target [required]Value used by the operator.
Object 1Numeric value used by the operator in assertions.
Object 2String value used by the operator in assertions. Supports templated variables.
timingsScopeTimings scope for response time assertions.
all, withoutDNStype [required]Type of the assertion.
body, header, statusCode, certificate, responseTime, property, recordEvery, recordSome, tlsVersion, minTlsVersionShow 13 more
latency, packetLossPercentage, packetsReceived, networkHop, receivedMessage, grpcHealthcheckStatus, grpcMetadata, grpcProto, connection, multiNetworkHop, jitter, mcpToolNameLength, mcpToolCountObject 2An assertion which targets body hash.
operator [required]Assertion operator to apply.
md5, sha1, sha256target [required]Value used by the operator.
Object 1Numeric value used by the operator in assertions.
Object 2String value used by the operator in assertions. Supports templated variables.
type [required]Type of the assertion.
bodyHashObject 3An assertion for the validatesJSONPath operator.
operator [required]Assertion operator to apply.
validatesJSONPathpropertyThe associated assertion property.
targetComposed target for validatesJSONPath operator.
elementsOperatorThe element from the list of results to assert on. To choose from the first element in the list firstElementMatches, every element in the list everyElementMatches, at least one element in the list atLeastOneElementMatches or the serialized value of the list serializationMatches.
jsonPathThe JSON path to assert.
operatorThe specific operator to use on the path.
targetValueThe path target value to compare to.
Object 1Numeric value used by the operator in assertions.
Object 2String value used by the operator in assertions. Supports templated variables.
type [required]Type of the assertion.
body, header, statusCode, certificate, responseTime, property, recordEvery, recordSome, tlsVersion, minTlsVersionShow 13 more
latency, packetLossPercentage, packetsReceived, networkHop, receivedMessage, grpcHealthcheckStatus, grpcMetadata, grpcProto, connection, multiNetworkHop, jitter, mcpToolNameLength, mcpToolCountObject 4An assertion for the validatesJSONSchema operator.
operator [required]Assertion operator to apply.
validatesJSONSchematargetComposed target for validatesJSONSchema operator.
jsonSchemaThe JSON Schema to assert.
metaSchemaThe JSON Schema meta-schema version used in the assertion.
draft-07, draft-06type [required]Type of the assertion.
body, header, statusCode, certificate, responseTime, property, recordEvery, recordSome, tlsVersion, minTlsVersionShow 13 more
latency, packetLossPercentage, packetsReceived, networkHop, receivedMessage, grpcHealthcheckStatus, grpcMetadata, grpcProto, connection, multiNetworkHop, jitter, mcpToolNameLength, mcpToolCountObject 5An assertion for the validatesXPath operator.
operator [required]Assertion operator to apply.
validatesXPathpropertyThe associated assertion property.
targetComposed target for validatesXPath operator.
operatorThe specific operator to use on the path.
targetValueThe path target value to compare to.
Object 1Numeric value used by the operator in assertions.
Object 2String value used by the operator in assertions. Supports templated variables.
xPathThe X path to assert.
type [required]Type of the assertion.
body, header, statusCode, certificate, responseTime, property, recordEvery, recordSome, tlsVersion, minTlsVersionShow 13 more
latency, packetLossPercentage, packetsReceived, networkHop, receivedMessage, grpcHealthcheckStatus, grpcMetadata, grpcProto, connection, multiNetworkHop, jitter, mcpToolNameLength, mcpToolCountObject 6A JavaScript assertion.
code [required]The JavaScript code that performs the assertions.
type [required]Type of the assertion.
javascriptObject 7An assertion that checks that an MCP server advertises the expected capabilities.
operator [required]Assertion operator to apply.
contains, doesNotContain, is, isNot, lessThan, lessThanOrEqual, moreThan, moreThanOrEqual, matches, doesNotMatchShow 5 more
validates, isInMoreThan, isInLessThan, doesNotExist, isUndefinedtarget [required]List of MCP server capabilities to assert against.
type [required]Type of the assertion.
mcpServerCapabilitiesObject 8An assertion that verifies the MCP server response respects the MCP specification.
type [required]Type of the assertion.
mcpRespectsSpecificationconfigVariablesArray of variables used for the test.
exampleExample for the variable.
idID of the variable for global variables.
name [required]Name of the variable.
patternPattern of the variable.
secureWhether the value of this variable will be obfuscated in test results. Only for config variables of type text.
type [required]Type of the configuration variable.
global, text, emailrequest [required]Object describing the Synthetic test request.
allow_insecureAllows loading insecure content for an HTTP request in a multistep test step.
basicAuthObject to handle basic authentication when performing the test.
<type=web>Object to handle basic authentication when performing the test.
passwordPassword to use for the basic authentication.
typeThe type of basic authentication to use when performing the test.
webwebusernameUsername to use for the basic authentication.
<type=sigv4>Object to handle SIGV4 authentication when performing the test.
accessKey [required]Access key for the SIGV4 authentication.
regionRegion for the SIGV4 authentication.
secretKey [required]Secret key for the SIGV4 authentication.
serviceNameService name for the SIGV4 authentication.
sessionTokenSession token for the SIGV4 authentication.
type [required]The type of authentication to use when performing the test.
sigv4sigv4<type=ntlm>Object to handle NTLM authentication when performing the test.
domainDomain for the authentication to use when performing the test.
passwordPassword for the authentication to use when performing the test.
type [required]The type of authentication to use when performing the test.
ntlmntlmusernameUsername for the authentication to use when performing the test.
workstationWorkstation for the authentication to use when performing the test.
<type=digest>Object to handle digest authentication when performing the test.
password [required]Password to use for the digest authentication.
type [required]The type of basic authentication to use when performing the test.
digestdigestusername [required]Username to use for the digest authentication.
<type=oauth-client>Object to handle oauth client authentication when performing the test.
accessTokenUrl [required]Access token URL to use when performing the authentication.
audienceAudience to use when performing the authentication.
clientId [required]Client ID to use when performing the authentication.
clientSecret [required]Client secret to use when performing the authentication.
resourceResource to use when performing the authentication.
scopeScope to use when performing the authentication.
tokenApiAuthentication [required]Type of token to use when performing the authentication.
header, bodytype [required]The type of basic authentication to use when performing the test.
oauth-clientoauth-client<type=oauth-rop>Object to handle oauth rop authentication when performing the test.
accessTokenUrl [required]Access token URL to use when performing the authentication.
audienceAudience to use when performing the authentication.
clientIdClient ID to use when performing the authentication.
clientSecretClient secret to use when performing the authentication.
password [required]Password to use when performing the authentication.
resourceResource to use when performing the authentication.
scopeScope to use when performing the authentication.
tokenApiAuthentication [required]Type of token to use when performing the authentication.
header, bodytype [required]The type of basic authentication to use when performing the test.
oauth-ropoauth-ropusername [required]Username to use when performing the authentication.
<type=jwt>Object to handle JWT authentication when performing the test.
addClaimsStandard JWT claims to automatically inject.
expWhether to inject the exp (expiration) claim.
iatWhether to inject the iat (issued at) claim.
algorithm [required]Algorithm to use for the JWT authentication.
HS256, RS256, ES256expiresInToken time-to-live in seconds.
headerCustom JWT header as a JSON string.
payload [required]JWT claims as a JSON string.
secret [required]Signing key for the JWT authentication. Use the shared secret for HS256
or the private key (PEM format) for RS256 and ES256.
tokenPrefixPrefix added before the token in the Authorization header. Defaults to Bearer.
type [required]The type of authentication to use when performing the test.
jwtjwtbodyBody to include in the test.
bodyTypeType of the request body.
text/plain, application/json, text/xml, text/html, application/x-www-form-urlencoded, graphql, application/octet-stream, multipart/form-datacallTypeThe type of call to perform. Used by gRPC steps (healthcheck, unary)
and MCP steps (init, tool_list, tool_call). Valid values depend on
the parent step's subtype.
healthcheck, unary, init, tool_list, tool_callcertificateClient certificate to use when performing the test request.
certDefine a request certificate.
contentContent of the certificate or key.
filenameFile name for the certificate or key.
updatedAtDate of update of the certificate or key, ISO format.
keyDefine a request certificate.
contentContent of the certificate or key.
filenameFile name for the certificate or key.
updatedAtDate of update of the certificate or key, ISO format.
certificateDomainsBy default, the client certificate is applied on the domain of the starting URL for browser tests. If you want your client certificate to be applied on other domains instead, add them in certificateDomains.
checkCertificateRevocationCheck for certificate revocation.
compressedJsonDescriptorA protobuf JSON descriptor that needs to be gzipped first then base64 encoded.
compressedProtoFileA protobuf file that needs to be gzipped first then base64 encoded.
disableAiaIntermediateFetchingDisable fetching intermediate certificates from AIA.
dnsServerDNS server to use for DNS tests.
dnsServerPortDNS server port to use for DNS tests.
Object 1Integer DNS server port number to use when performing the test.
Object 2String DNS server port number to use when performing the test. Supports templated variables.
filesFiles to be used as part of the request in the test. Only valid if bodyType is multipart/form-data.
bucketKeyBucket key of the file.
contentContent of the file.
encodingEncoding of the file content. The only supported value is base64, indicating the content field contains base64-encoded data.
nameName of the file.
originalFileNameOriginal name of the file.
sizeSize of the file.
typeType of the file.
follow_redirectsSpecifies whether or not the request follows redirects.
formForm to be used as part of the request in the test. Only valid if bodyType is multipart/form-data.
<any-key>A single form entry.
headersHeaders to include when performing the test.
<any-key>A single Header.
hostHost name to perform the test with.
httpVersionHTTP version to use for a Synthetic test.
http1, http2, anyignore_certificate_validationFor SSL tests, whether the test should ignore certificate validation.
isMessageBase64EncodedWhether the message is base64 encoded.
mcpProtocolVersionThe MCP protocol version used by the step. See https://modelcontextprotocol.io/specification.
2025-06-18messageMessage to send for UDP or WebSocket tests.
metadataMetadata to include when performing the gRPC test.
<any-key>A single metadatum.
methodEither the HTTP method/verb to use or a gRPC method available on the service set in the service field. Required if subtype is HTTP or if subtype is grpc and callType is unary.
noSavingResponseBodyDetermines whether or not to save the response body.
numberOfPacketsNumber of pings to use per test.
persistCookiesPersist cookies across redirects.
portPort to use when performing the test.
Object 1Integer Port number to use when performing the test.
Object 2String Port number to use when performing the test. Supports templated variables.
proxyThe proxy to perform the test.
headersHeaders to include when performing the test.
<any-key>A single Header.
url [required]URL of the proxy to perform the test.
queryQuery to use for the test.
servernameFor 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.
serviceThe gRPC service on which you want to perform the gRPC call.
shouldTrackHopsTurns on a traceroute probe to discover all gateways along the path to the host destination.
timeoutTimeout in seconds for the test.
toolArgsArguments to pass to the MCP tool. Free-form object whose shape depends on the tool. Used when callType is tool_call.
toolNameThe name of the MCP tool to call. Required when callType is tool_call.
urlURL to perform the test with.
variablesArray of variables used for the test steps.
exampleExample for the variable.
idID for the variable. Global variables require an ID.
name [required]Name of the variable.
patternPattern of the variable.
secureDetermines whether or not the browser test variable is obfuscated. Can only be used with browser variables of type text.
type [required]Type of browser test variable.
element, email, global, textlocations [required]Array of locations used to run the test.
message [required]Notification message associated with the test. Message can either be text or an empty string.
monitor_idThe associated monitor ID.
name [required]Name of the test.
options [required]Object describing the extra options for a Synthetic test.
accept_self_signedFor SSL tests, whether or not the test should allow self signed certificates.
allow_insecureAllows loading insecure content for an HTTP request in an API test.
bits_ai_auto_investigateWhether Bits AI automatically investigates alerts from the test monitor.
blockedRequestPatternsArray of URL patterns to block.
captureNetworkPayloadsCapture HTTP request/response headers and bodies for Fetch/XHR calls made during browser tests.
checkCertificateRevocationFor SSL tests, whether or not the test should fail on revoked certificate in stapled OCSP.
ciCI/CD options for a Synthetic test.
executionRule [required]Execution rule for a Synthetic test.
blocking, non_blocking, skippeddevice_idsFor browser test, array with the different device IDs used to run the test.
disableAiaIntermediateFetchingFor SSL tests, whether or not the test should disable fetching intermediate certificates from AIA.
disableCorsWhether or not to disable CORS mechanism.
disableCspDisable Content Security Policy for browser tests.
enableProfilingEnable profiling for browser tests.
enableSecurityTestingDEPRECATED Enable security testing for browser tests. Security testing is not available anymore. This field is deprecated and won't be used.
follow_redirectsFor API HTTP test, whether or not the test should follow redirects.
httpVersionHTTP version to use for a Synthetic test.
http1, http2, anyignoreServerCertificateErrorIgnore server certificate error for browser tests.
ignore_certificate_validationFor SSL tests, whether the test should ignore certificate validation.
initialNavigationTimeoutTimeout before declaring the initial step as failed (in seconds) for browser tests.
min_failure_durationMinimum amount of time in failure required to trigger an alert.
min_location_failedMinimum number of locations in failure required to trigger an alert.
monitor_nameThe monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.
monitor_optionsObject containing the options for a Synthetic test as a monitor (for example, renotification).
escalation_messageMessage to include in the escalation notification.
notification_preset_nameThe name of the preset for the notification for the monitor.
show_all, hide_all, hide_query, hide_handles, hide_query_and_handles, show_only_snapshot, hide_handles_and_footerrenotify_intervalTime interval before renotifying if the test is still failing (in minutes).
renotify_occurrencesThe number of times to renotify if the test is still failing.
monitor_priorityInteger from 1 (high) to 5 (low) indicating alert severity.
noScreenshotPrevents saving screenshots of the steps.
restricted_rolesDEPRECATED A list of role identifiers that can be pulled from the Roles API, for restricting read and write access. This field is deprecated. Use the restriction policies API to manage permissions.
retryObject describing the retry strategy to apply to a Synthetic test.
countNumber of times a test needs to be retried before marking a location as failed. Defaults to 0.
intervalTime interval between retries (in milliseconds). Defaults to 300ms.
rumSettingsThe 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.
applicationIdRUM application ID used to collect RUM data for the browser test.
clientTokenIdRUM application API key ID used to collect RUM data for the browser test.
isEnabled [required]Determines whether RUM data is collected during test runs.
schedulingObject containing timeframes and timezone used for advanced scheduling.
timeframes [required]Array containing objects describing the scheduling pattern to apply to each day.
day [required]Number representing the day of the week.
from [required]The hour of the day on which scheduling starts.
to [required]The hour of the day on which scheduling ends.
timezone [required]Timezone in which the timeframe is based.
tick_everyThe frequency at which to run the Synthetic test (in seconds).
public_idThe public ID of the test.
statusDefine whether you want to start (live) or pause (paused) a
Synthetic test.
live, pausedstepsArray of steps for the test.
allowFailureA boolean set to allow this step to fail.
alwaysExecuteA boolean set to always execute this step even if the previous step failed or was skipped.
exitIfSucceedA boolean set to exit the test if the step succeeds.
isCriticalA boolean to use in addition to allowFailure to determine if the test should be marked as failed when the step fails.
nameThe name of the step.
noScreenshotA boolean set to skip taking a screenshot for the step.
paramsThe parameters of the step.
public_idThe public ID of the step.
timeoutThe time before declaring a step failed.
typeStep type used in your Synthetic test.
assertCurrentUrl, assertElementAttribute, assertElementContent, assertElementPresent, assertEmail, assertFileDownload, assertFromJavascript, assertPageContains, assertPageLacks, assertRequestsShow 19 more
click, drag, drop, extractFromJavascript, extractFromEmailBody, extractVariable, goToEmailLink, goToUrl, goToUrlAndMeasureTti, hover, playSubTest, pressKey, refresh, runApiTest, scroll, selectOption, typeText, uploadFiles, waittagsArray of tags attached to the test.
type [required]Type of the Synthetic test, browser.
browserbrowser{
"config": {
"assertions": [
{
"operator": "contains",
"property": "string",
"target": 0,
"timingsScope": "string",
"type": "statusCode"
}
],
"configVariables": [
{
"example": "string",
"id": "string",
"name": "VARIABLE_NAME",
"pattern": "string",
"secure": false,
"type": "text"
}
],
"request": {
"allow_insecure": false,
"basicAuth": {
"password": "PaSSw0RD!",
"type": "web",
"username": "my_username"
},
"body": "string",
"bodyType": "text/plain",
"callType": "unary",
"certificate": {
"cert": {
"content": "string",
"filename": "string",
"updatedAt": "string"
},
"key": {
"content": "string",
"filename": "string",
"updatedAt": "string"
}
},
"certificateDomains": [],
"checkCertificateRevocation": false,
"compressedJsonDescriptor": "string",
"compressedProtoFile": "string",
"disableAiaIntermediateFetching": false,
"dnsServer": "string",
"dnsServerPort": {
"description": "undefined",
"format": "undefined",
"type": "undefined"
},
"files": [
{
"bucketKey": "string",
"content": "string",
"encoding": "string",
"name": "string",
"originalFileName": "string",
"size": "integer",
"type": "string"
}
],
"follow_redirects": false,
"form": {
"<any-key>": "string"
},
"headers": {
"<any-key>": "string"
},
"host": "string",
"httpVersion": "string",
"ignore_certificate_validation": false,
"isMessageBase64Encoded": false,
"mcpProtocolVersion": "2025-06-18",
"message": "string",
"metadata": {
"<any-key>": "string"
},
"method": "string",
"noSavingResponseBody": false,
"numberOfPackets": "integer",
"persistCookies": false,
"port": {
"description": "undefined",
"format": "undefined",
"type": "undefined"
},
"proxy": {
"headers": {
"<any-key>": "string"
},
"url": "https://example.com"
},
"query": {},
"servername": "string",
"service": "Greeter",
"shouldTrackHops": false,
"timeout": "number",
"toolArgs": {},
"toolName": "search",
"url": "https://example.com"
},
"setCookie": "string",
"variables": [
{
"example": "string",
"id": "string",
"name": "VARIABLE_NAME",
"pattern": "string",
"secure": false,
"type": "text"
}
]
},
"locations": [
"aws:eu-west-3"
],
"message": "",
"monitor_id": "integer",
"name": "Example test name",
"options": {
"accept_self_signed": false,
"allow_insecure": false,
"bits_ai_auto_investigate": false,
"blockedRequestPatterns": [],
"captureNetworkPayloads": false,
"checkCertificateRevocation": false,
"ci": {
"executionRule": "blocking"
},
"device_ids": [
"chrome.laptop_large"
],
"disableAiaIntermediateFetching": false,
"disableCors": false,
"disableCsp": false,
"enableProfiling": false,
"enableSecurityTesting": false,
"follow_redirects": false,
"httpVersion": "string",
"ignoreServerCertificateError": false,
"ignore_certificate_validation": false,
"initialNavigationTimeout": "integer",
"min_failure_duration": "integer",
"min_location_failed": "integer",
"monitor_name": "string",
"monitor_options": {
"escalation_message": "string",
"notification_preset_name": "string",
"renotify_interval": "integer",
"renotify_occurrences": "integer"
},
"monitor_priority": "integer",
"noScreenshot": false,
"restricted_roles": [
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
],
"retry": {
"count": "integer",
"interval": "number"
},
"rumSettings": {
"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"clientTokenId": 12345,
"isEnabled": true
},
"scheduling": {
"timeframes": [
{
"day": 1,
"from": "07:00",
"to": "16:00"
}
],
"timezone": "America/New_York"
},
"tick_every": "integer"
},
"public_id": "string",
"status": "live",
"steps": [
{
"allowFailure": false,
"alwaysExecute": false,
"exitIfSucceed": false,
"isCritical": false,
"name": "string",
"noScreenshot": false,
"params": {},
"public_id": "string",
"timeout": "integer",
"type": "assertElementContent"
}
],
"tags": [
"env:prod"
],
"type": "browser"
}- JSON format is wrong - Creation failed
Error response object.
errors [required]Array of errors returned by the API.
{
"errors": [
"Bad Request"
]
}Test quota is reached
Error response object.
errors [required]Array of errors returned by the API.
{
"errors": [
"Bad Request"
]
}Forbidden
Error response object.
errors [required]Array of errors returned by the API.
{
"errors": [
"Bad Request"
]
}Too many requests
Error response object.
errors [required]Array of errors returned by the API.
{
"errors": [
"Bad Request"
]
}Code Example
Create a browser test returns "OK - Returns saved rumSettings." response
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com",
"certificateDomains": [
"https://datadoghq.com"
]
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"tablet"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"rumSettings": {
"isEnabled": true,
"applicationId": "mockApplicationId",
"clientTokenId": 12345
},
"tick_every": 300,
"ci": {
"executionRule": "skipped"
},
"ignoreServerCertificateError": true,
"disableCsp": true,
"initialNavigationTimeout": 200
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com",
"certificateDomains": [
"https://datadoghq.com"
]
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"tablet"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"rumSettings": {
"isEnabled": true,
"applicationId": "mockApplicationId",
"clientTokenId": 12345
},
"tick_every": 300,
"ci": {
"executionRule": "skipped"
},
"ignoreServerCertificateError": true,
"disableCsp": true,
"initialNavigationTimeout": 200
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com",
"certificateDomains": [
"https://datadoghq.com"
]
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"tablet"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"rumSettings": {
"isEnabled": true,
"applicationId": "mockApplicationId",
"clientTokenId": 12345
},
"tick_every": 300,
"ci": {
"executionRule": "skipped"
},
"ignoreServerCertificateError": true,
"disableCsp": true,
"initialNavigationTimeout": 200
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com",
"certificateDomains": [
"https://datadoghq.com"
]
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"tablet"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"rumSettings": {
"isEnabled": true,
"applicationId": "mockApplicationId",
"clientTokenId": 12345
},
"tick_every": 300,
"ci": {
"executionRule": "skipped"
},
"ignoreServerCertificateError": true,
"disableCsp": true,
"initialNavigationTimeout": 200
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com",
"certificateDomains": [
"https://datadoghq.com"
]
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"tablet"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"rumSettings": {
"isEnabled": true,
"applicationId": "mockApplicationId",
"clientTokenId": 12345
},
"tick_every": 300,
"ci": {
"executionRule": "skipped"
},
"ignoreServerCertificateError": true,
"disableCsp": true,
"initialNavigationTimeout": 200
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com",
"certificateDomains": [
"https://datadoghq.com"
]
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"tablet"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"rumSettings": {
"isEnabled": true,
"applicationId": "mockApplicationId",
"clientTokenId": 12345
},
"tick_every": 300,
"ci": {
"executionRule": "skipped"
},
"ignoreServerCertificateError": true,
"disableCsp": true,
"initialNavigationTimeout": 200
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com",
"certificateDomains": [
"https://datadoghq.com"
]
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"tablet"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"rumSettings": {
"isEnabled": true,
"applicationId": "mockApplicationId",
"clientTokenId": 12345
},
"tick_every": 300,
"ci": {
"executionRule": "skipped"
},
"ignoreServerCertificateError": true,
"disableCsp": true,
"initialNavigationTimeout": 200
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com",
"certificateDomains": [
"https://datadoghq.com"
]
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"tablet"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"rumSettings": {
"isEnabled": true,
"applicationId": "mockApplicationId",
"clientTokenId": 12345
},
"tick_every": 300,
"ci": {
"executionRule": "skipped"
},
"ignoreServerCertificateError": true,
"disableCsp": true,
"initialNavigationTimeout": 200
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com",
"certificateDomains": [
"https://datadoghq.com"
]
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"tablet"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"rumSettings": {
"isEnabled": true,
"applicationId": "mockApplicationId",
"clientTokenId": 12345
},
"tick_every": 300,
"ci": {
"executionRule": "skipped"
},
"ignoreServerCertificateError": true,
"disableCsp": true,
"initialNavigationTimeout": 200
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOFCreate a browser test returns "OK - Returns the created test details." response
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"variables": [
{
"type": "text",
"name": "TEST_VARIABLE",
"pattern": "secret",
"secure": true,
"example": "secret"
}
],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text",
"secure": true
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com"
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"chrome.laptop_large"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"tick_every": 300,
"enableProfiling": true,
"enableSecurityTesting": true
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"alwaysExecute": true,
"exitIfSucceed": true,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"variables": [
{
"type": "text",
"name": "TEST_VARIABLE",
"pattern": "secret",
"secure": true,
"example": "secret"
}
],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text",
"secure": true
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com"
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"chrome.laptop_large"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"tick_every": 300,
"enableProfiling": true,
"enableSecurityTesting": true
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"alwaysExecute": true,
"exitIfSucceed": true,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"variables": [
{
"type": "text",
"name": "TEST_VARIABLE",
"pattern": "secret",
"secure": true,
"example": "secret"
}
],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text",
"secure": true
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com"
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"chrome.laptop_large"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"tick_every": 300,
"enableProfiling": true,
"enableSecurityTesting": true
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"alwaysExecute": true,
"exitIfSucceed": true,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"variables": [
{
"type": "text",
"name": "TEST_VARIABLE",
"pattern": "secret",
"secure": true,
"example": "secret"
}
],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text",
"secure": true
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com"
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"chrome.laptop_large"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"tick_every": 300,
"enableProfiling": true,
"enableSecurityTesting": true
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"alwaysExecute": true,
"exitIfSucceed": true,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"variables": [
{
"type": "text",
"name": "TEST_VARIABLE",
"pattern": "secret",
"secure": true,
"example": "secret"
}
],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text",
"secure": true
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com"
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"chrome.laptop_large"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"tick_every": 300,
"enableProfiling": true,
"enableSecurityTesting": true
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"alwaysExecute": true,
"exitIfSucceed": true,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"variables": [
{
"type": "text",
"name": "TEST_VARIABLE",
"pattern": "secret",
"secure": true,
"example": "secret"
}
],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text",
"secure": true
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com"
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"chrome.laptop_large"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"tick_every": 300,
"enableProfiling": true,
"enableSecurityTesting": true
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"alwaysExecute": true,
"exitIfSucceed": true,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"variables": [
{
"type": "text",
"name": "TEST_VARIABLE",
"pattern": "secret",
"secure": true,
"example": "secret"
}
],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text",
"secure": true
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com"
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"chrome.laptop_large"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"tick_every": 300,
"enableProfiling": true,
"enableSecurityTesting": true
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"alwaysExecute": true,
"exitIfSucceed": true,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"variables": [
{
"type": "text",
"name": "TEST_VARIABLE",
"pattern": "secret",
"secure": true,
"example": "secret"
}
],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text",
"secure": true
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com"
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"chrome.laptop_large"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"tick_every": 300,
"enableProfiling": true,
"enableSecurityTesting": true
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"alwaysExecute": true,
"exitIfSucceed": true,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"variables": [
{
"type": "text",
"name": "TEST_VARIABLE",
"pattern": "secret",
"secure": true,
"example": "secret"
}
],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text",
"secure": true
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com"
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"chrome.laptop_large"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"tick_every": 300,
"enableProfiling": true,
"enableSecurityTesting": true
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"alwaysExecute": true,
"exitIfSucceed": true,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOFCreate a browser test with advanced scheduling options returns "OK - Returns the created test details." response
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com"
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"tablet"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"tick_every": 300,
"scheduling": {
"timeframes": [
{
"day": 1,
"from": "07:00",
"to": "16:00"
},
{
"day": 3,
"from": "07:00",
"to": "16:00"
}
],
"timezone": "America/New_York"
}
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com"
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"tablet"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"tick_every": 300,
"scheduling": {
"timeframes": [
{
"day": 1,
"from": "07:00",
"to": "16:00"
},
{
"day": 3,
"from": "07:00",
"to": "16:00"
}
],
"timezone": "America/New_York"
}
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com"
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"tablet"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"tick_every": 300,
"scheduling": {
"timeframes": [
{
"day": 1,
"from": "07:00",
"to": "16:00"
},
{
"day": 3,
"from": "07:00",
"to": "16:00"
}
],
"timezone": "America/New_York"
}
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com"
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"tablet"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"tick_every": 300,
"scheduling": {
"timeframes": [
{
"day": 1,
"from": "07:00",
"to": "16:00"
},
{
"day": 3,
"from": "07:00",
"to": "16:00"
}
],
"timezone": "America/New_York"
}
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com"
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"tablet"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"tick_every": 300,
"scheduling": {
"timeframes": [
{
"day": 1,
"from": "07:00",
"to": "16:00"
},
{
"day": 3,
"from": "07:00",
"to": "16:00"
}
],
"timezone": "America/New_York"
}
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com"
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"tablet"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"tick_every": 300,
"scheduling": {
"timeframes": [
{
"day": 1,
"from": "07:00",
"to": "16:00"
},
{
"day": 3,
"from": "07:00",
"to": "16:00"
}
],
"timezone": "America/New_York"
}
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com"
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"tablet"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"tick_every": 300,
"scheduling": {
"timeframes": [
{
"day": 1,
"from": "07:00",
"to": "16:00"
},
{
"day": 3,
"from": "07:00",
"to": "16:00"
}
],
"timezone": "America/New_York"
}
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com"
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"tablet"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"tick_every": 300,
"scheduling": {
"timeframes": [
{
"day": 1,
"from": "07:00",
"to": "16:00"
},
{
"day": 3,
"from": "07:00",
"to": "16:00"
}
],
"timezone": "America/New_York"
}
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/browser" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"config": {
"assertions": [],
"configVariables": [
{
"example": "content-type",
"name": "PROPERTY",
"pattern": "content-type",
"type": "text"
}
],
"request": {
"method": "GET",
"url": "https://datadoghq.com"
},
"setCookie": "name:test"
},
"locations": [
"aws:us-east-2"
],
"message": "Test message",
"name": "Example-Synthetic",
"options": {
"accept_self_signed": false,
"allow_insecure": true,
"device_ids": [
"tablet"
],
"disableCors": true,
"follow_redirects": true,
"min_failure_duration": 10,
"min_location_failed": 1,
"noScreenshot": true,
"retry": {
"count": 2,
"interval": 10
},
"tick_every": 300,
"scheduling": {
"timeframes": [
{
"day": 1,
"from": "07:00",
"to": "16:00"
},
{
"day": 3,
"from": "07:00",
"to": "16:00"
}
],
"timezone": "America/New_York"
}
},
"tags": [
"testing:browser"
],
"type": "browser",
"steps": [
{
"allowFailure": false,
"isCritical": true,
"name": "Refresh page",
"params": {},
"type": "refresh"
}
]
}
EOFCreate a browser test returns "OK - Returns saved rumSettings." response
// Create a browser test returns "OK - Returns saved rumSettings." response
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
)
func main() {
body := datadogV1.SyntheticsBrowserTest{
Config: datadogV1.SyntheticsBrowserTestConfig{
Assertions: []datadogV1.SyntheticsAssertion{},
ConfigVariables: []datadogV1.SyntheticsConfigVariable{
{
Example: datadog.PtrString("content-type"),
Name: "PROPERTY",
Pattern: datadog.PtrString("content-type"),
Type: datadogV1.SYNTHETICSCONFIGVARIABLETYPE_TEXT,
},
},
Request: datadogV1.SyntheticsTestRequest{
Method: datadog.PtrString("GET"),
Url: datadog.PtrString("https://datadoghq.com"),
CertificateDomains: []string{
"https://datadoghq.com",
},
},
SetCookie: datadog.PtrString("name:test"),
},
Locations: []string{
"aws:us-east-2",
},
Message: "Test message",
Name: "Example-Synthetic",
Options: datadogV1.SyntheticsTestOptions{
AcceptSelfSigned: datadog.PtrBool(false),
AllowInsecure: datadog.PtrBool(true),
DeviceIds: []string{
"tablet",
},
DisableCors: datadog.PtrBool(true),
FollowRedirects: datadog.PtrBool(true),
MinFailureDuration: datadog.PtrInt64(10),
MinLocationFailed: datadog.PtrInt64(1),
NoScreenshot: datadog.PtrBool(true),
Retry: &datadogV1.SyntheticsTestOptionsRetry{
Count: datadog.PtrInt64(2),
Interval: datadog.PtrFloat64(10),
},
RumSettings: &datadogV1.SyntheticsBrowserTestRumSettings{
IsEnabled: true,
ApplicationId: datadog.PtrString("mockApplicationId"),
ClientTokenId: datadog.PtrInt64(12345),
},
TickEvery: datadog.PtrInt64(300),
Ci: &datadogV1.SyntheticsTestCiOptions{
ExecutionRule: datadogV1.SYNTHETICSTESTEXECUTIONRULE_SKIPPED,
},
IgnoreServerCertificateError: datadog.PtrBool(true),
DisableCsp: datadog.PtrBool(true),
InitialNavigationTimeout: datadog.PtrInt64(200),
},
Tags: []string{
"testing:browser",
},
Type: datadogV1.SYNTHETICSBROWSERTESTTYPE_BROWSER,
Steps: []datadogV1.SyntheticsStep{
{
AllowFailure: datadog.PtrBool(false),
IsCritical: datadog.PtrBool(true),
Name: datadog.PtrString("Refresh page"),
Params: new(interface{}),
Type: datadogV1.SYNTHETICSSTEPTYPE_REFRESH.Ptr(),
},
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV1.NewSyntheticsApi(apiClient)
resp, r, err := api.CreateSyntheticsBrowserTest(ctx, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.CreateSyntheticsBrowserTest`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.CreateSyntheticsBrowserTest`:\n%s\n", responseContent)
}
Create a browser test returns "OK - Returns the created test details." response
// Create a browser test returns "OK - Returns the created test details." response
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
)
func main() {
body := datadogV1.SyntheticsBrowserTest{
Config: datadogV1.SyntheticsBrowserTestConfig{
Assertions: []datadogV1.SyntheticsAssertion{},
Variables: []datadogV1.SyntheticsBrowserVariable{
{
Type: datadogV1.SYNTHETICSBROWSERVARIABLETYPE_TEXT,
Name: "TEST_VARIABLE",
Pattern: datadog.PtrString("secret"),
Secure: datadog.PtrBool(true),
Example: datadog.PtrString("secret"),
},
},
ConfigVariables: []datadogV1.SyntheticsConfigVariable{
{
Example: datadog.PtrString("content-type"),
Name: "PROPERTY",
Pattern: datadog.PtrString("content-type"),
Type: datadogV1.SYNTHETICSCONFIGVARIABLETYPE_TEXT,
Secure: datadog.PtrBool(true),
},
},
Request: datadogV1.SyntheticsTestRequest{
Method: datadog.PtrString("GET"),
Url: datadog.PtrString("https://datadoghq.com"),
},
SetCookie: datadog.PtrString("name:test"),
},
Locations: []string{
"aws:us-east-2",
},
Message: "Test message",
Name: "Example-Synthetic",
Options: datadogV1.SyntheticsTestOptions{
AcceptSelfSigned: datadog.PtrBool(false),
AllowInsecure: datadog.PtrBool(true),
DeviceIds: []string{
"chrome.laptop_large",
},
DisableCors: datadog.PtrBool(true),
FollowRedirects: datadog.PtrBool(true),
MinFailureDuration: datadog.PtrInt64(10),
MinLocationFailed: datadog.PtrInt64(1),
NoScreenshot: datadog.PtrBool(true),
Retry: &datadogV1.SyntheticsTestOptionsRetry{
Count: datadog.PtrInt64(2),
Interval: datadog.PtrFloat64(10),
},
TickEvery: datadog.PtrInt64(300),
EnableProfiling: datadog.PtrBool(true),
EnableSecurityTesting: datadog.PtrBool(true),
},
Tags: []string{
"testing:browser",
},
Type: datadogV1.SYNTHETICSBROWSERTESTTYPE_BROWSER,
Steps: []datadogV1.SyntheticsStep{
{
AllowFailure: datadog.PtrBool(false),
AlwaysExecute: datadog.PtrBool(true),
ExitIfSucceed: datadog.PtrBool(true),
IsCritical: datadog.PtrBool(true),
Name: datadog.PtrString("Refresh page"),
Params: new(interface{}),
Type: datadogV1.SYNTHETICSSTEPTYPE_REFRESH.Ptr(),
},
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV1.NewSyntheticsApi(apiClient)
resp, r, err := api.CreateSyntheticsBrowserTest(ctx, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.CreateSyntheticsBrowserTest`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.CreateSyntheticsBrowserTest`:\n%s\n", responseContent)
}
Create a browser test with advanced scheduling options returns "OK - Returns the created test details." response
// Create a browser test with advanced scheduling options returns "OK - Returns the created test details." response
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
)
func main() {
body := datadogV1.SyntheticsBrowserTest{
Config: datadogV1.SyntheticsBrowserTestConfig{
Assertions: []datadogV1.SyntheticsAssertion{},
ConfigVariables: []datadogV1.SyntheticsConfigVariable{
{
Example: datadog.PtrString("content-type"),
Name: "PROPERTY",
Pattern: datadog.PtrString("content-type"),
Type: datadogV1.SYNTHETICSCONFIGVARIABLETYPE_TEXT,
},
},
Request: datadogV1.SyntheticsTestRequest{
Method: datadog.PtrString("GET"),
Url: datadog.PtrString("https://datadoghq.com"),
},
SetCookie: datadog.PtrString("name:test"),
},
Locations: []string{
"aws:us-east-2",
},
Message: "Test message",
Name: "Example-Synthetic",
Options: datadogV1.SyntheticsTestOptions{
AcceptSelfSigned: datadog.PtrBool(false),
AllowInsecure: datadog.PtrBool(true),
DeviceIds: []string{
"tablet",
},
DisableCors: datadog.PtrBool(true),
FollowRedirects: datadog.PtrBool(true),
MinFailureDuration: datadog.PtrInt64(10),
MinLocationFailed: datadog.PtrInt64(1),
NoScreenshot: datadog.PtrBool(true),
Retry: &datadogV1.SyntheticsTestOptionsRetry{
Count: datadog.PtrInt64(2),
Interval: datadog.PtrFloat64(10),
},
TickEvery: datadog.PtrInt64(300),
Scheduling: &datadogV1.SyntheticsTestOptionsScheduling{
Timeframes: []datadogV1.SyntheticsTestOptionsSchedulingTimeframe{
{
Day: 1,
From: "07:00",
To: "16:00",
},
{
Day: 3,
From: "07:00",
To: "16:00",
},
},
Timezone: "America/New_York",
},
},
Tags: []string{
"testing:browser",
},
Type: datadogV1.SYNTHETICSBROWSERTESTTYPE_BROWSER,
Steps: []datadogV1.SyntheticsStep{
{
AllowFailure: datadog.PtrBool(false),
IsCritical: datadog.PtrBool(true),
Name: datadog.PtrString("Refresh page"),
Params: new(interface{}),
Type: datadogV1.SYNTHETICSSTEPTYPE_REFRESH.Ptr(),
},
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV1.NewSyntheticsApi(apiClient)
resp, r, err := api.CreateSyntheticsBrowserTest(ctx, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.CreateSyntheticsBrowserTest`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.CreateSyntheticsBrowserTest`:\n%s\n", responseContent)
}
Instructions
First install the library and its dependencies and then save the example to main.go and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"Create a browser test returns "OK - Returns saved rumSettings." response
// Create a browser test returns "OK - Returns saved rumSettings." response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsBrowserTest;
import com.datadog.api.client.v1.model.SyntheticsBrowserTestConfig;
import com.datadog.api.client.v1.model.SyntheticsBrowserTestRumSettings;
import com.datadog.api.client.v1.model.SyntheticsBrowserTestType;
import com.datadog.api.client.v1.model.SyntheticsConfigVariable;
import com.datadog.api.client.v1.model.SyntheticsConfigVariableType;
import com.datadog.api.client.v1.model.SyntheticsStep;
import com.datadog.api.client.v1.model.SyntheticsStepType;
import com.datadog.api.client.v1.model.SyntheticsTestCiOptions;
import com.datadog.api.client.v1.model.SyntheticsTestExecutionRule;
import com.datadog.api.client.v1.model.SyntheticsTestOptions;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsRetry;
import com.datadog.api.client.v1.model.SyntheticsTestRequest;
import java.util.Collections;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
SyntheticsBrowserTest body =
new SyntheticsBrowserTest()
.config(
new SyntheticsBrowserTestConfig()
.configVariables(
Collections.singletonList(
new SyntheticsConfigVariable()
.example("content-type")
.name("PROPERTY")
.pattern("content-type")
.type(SyntheticsConfigVariableType.TEXT)))
.request(
new SyntheticsTestRequest()
.method("GET")
.url("https://datadoghq.com")
.certificateDomains(Collections.singletonList("https://datadoghq.com")))
.setCookie("name:test"))
.locations(Collections.singletonList("aws:us-east-2"))
.message("Test message")
.name("Example-Synthetic")
.options(
new SyntheticsTestOptions()
.acceptSelfSigned(false)
.allowInsecure(true)
.deviceIds(Collections.singletonList("tablet"))
.disableCors(true)
.followRedirects(true)
.minFailureDuration(10L)
.minLocationFailed(1L)
.noScreenshot(true)
.retry(new SyntheticsTestOptionsRetry().count(2L).interval(10.0))
.rumSettings(
new SyntheticsBrowserTestRumSettings()
.isEnabled(true)
.applicationId("mockApplicationId")
.clientTokenId(12345L))
.tickEvery(300L)
.ci(
new SyntheticsTestCiOptions()
.executionRule(SyntheticsTestExecutionRule.SKIPPED))
.ignoreServerCertificateError(true)
.disableCsp(true)
.initialNavigationTimeout(200L))
.tags(Collections.singletonList("testing:browser"))
.type(SyntheticsBrowserTestType.BROWSER)
.steps(
Collections.singletonList(
new SyntheticsStep()
.allowFailure(false)
.isCritical(true)
.name("Refresh page")
.params(new Object())
.type(SyntheticsStepType.REFRESH)));
try {
SyntheticsBrowserTest result = apiInstance.createSyntheticsBrowserTest(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#createSyntheticsBrowserTest");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Create a browser test returns "OK - Returns the created test details." response
// Create a browser test returns "OK - Returns the created test details." response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsBrowserTest;
import com.datadog.api.client.v1.model.SyntheticsBrowserTestConfig;
import com.datadog.api.client.v1.model.SyntheticsBrowserTestType;
import com.datadog.api.client.v1.model.SyntheticsBrowserVariable;
import com.datadog.api.client.v1.model.SyntheticsBrowserVariableType;
import com.datadog.api.client.v1.model.SyntheticsConfigVariable;
import com.datadog.api.client.v1.model.SyntheticsConfigVariableType;
import com.datadog.api.client.v1.model.SyntheticsStep;
import com.datadog.api.client.v1.model.SyntheticsStepType;
import com.datadog.api.client.v1.model.SyntheticsTestOptions;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsRetry;
import com.datadog.api.client.v1.model.SyntheticsTestRequest;
import java.util.Collections;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
SyntheticsBrowserTest body =
new SyntheticsBrowserTest()
.config(
new SyntheticsBrowserTestConfig()
.variables(
Collections.singletonList(
new SyntheticsBrowserVariable()
.type(SyntheticsBrowserVariableType.TEXT)
.name("TEST_VARIABLE")
.pattern("secret")
.secure(true)
.example("secret")))
.configVariables(
Collections.singletonList(
new SyntheticsConfigVariable()
.example("content-type")
.name("PROPERTY")
.pattern("content-type")
.type(SyntheticsConfigVariableType.TEXT)
.secure(true)))
.request(new SyntheticsTestRequest().method("GET").url("https://datadoghq.com"))
.setCookie("name:test"))
.locations(Collections.singletonList("aws:us-east-2"))
.message("Test message")
.name("Example-Synthetic")
.options(
new SyntheticsTestOptions()
.acceptSelfSigned(false)
.allowInsecure(true)
.deviceIds(Collections.singletonList("chrome.laptop_large"))
.disableCors(true)
.followRedirects(true)
.minFailureDuration(10L)
.minLocationFailed(1L)
.noScreenshot(true)
.retry(new SyntheticsTestOptionsRetry().count(2L).interval(10.0))
.tickEvery(300L)
.enableProfiling(true)
.enableSecurityTesting(true))
.tags(Collections.singletonList("testing:browser"))
.type(SyntheticsBrowserTestType.BROWSER)
.steps(
Collections.singletonList(
new SyntheticsStep()
.allowFailure(false)
.alwaysExecute(true)
.exitIfSucceed(true)
.isCritical(true)
.name("Refresh page")
.params(new Object())
.type(SyntheticsStepType.REFRESH)));
try {
SyntheticsBrowserTest result = apiInstance.createSyntheticsBrowserTest(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#createSyntheticsBrowserTest");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Create a browser test with advanced scheduling options returns "OK - Returns the created test details." response
// Create a browser test with advanced scheduling options returns "OK - Returns the created test
// details." response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsBrowserTest;
import com.datadog.api.client.v1.model.SyntheticsBrowserTestConfig;
import com.datadog.api.client.v1.model.SyntheticsBrowserTestType;
import com.datadog.api.client.v1.model.SyntheticsConfigVariable;
import com.datadog.api.client.v1.model.SyntheticsConfigVariableType;
import com.datadog.api.client.v1.model.SyntheticsStep;
import com.datadog.api.client.v1.model.SyntheticsStepType;
import com.datadog.api.client.v1.model.SyntheticsTestOptions;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsRetry;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsScheduling;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsSchedulingTimeframe;
import com.datadog.api.client.v1.model.SyntheticsTestRequest;
import java.util.Arrays;
import java.util.Collections;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
SyntheticsBrowserTest body =
new SyntheticsBrowserTest()
.config(
new SyntheticsBrowserTestConfig()
.configVariables(
Collections.singletonList(
new SyntheticsConfigVariable()
.example("content-type")
.name("PROPERTY")
.pattern("content-type")
.type(SyntheticsConfigVariableType.TEXT)))
.request(new SyntheticsTestRequest().method("GET").url("https://datadoghq.com"))
.setCookie("name:test"))
.locations(Collections.singletonList("aws:us-east-2"))
.message("Test message")
.name("Example-Synthetic")
.options(
new SyntheticsTestOptions()
.acceptSelfSigned(false)
.allowInsecure(true)
.deviceIds(Collections.singletonList("tablet"))
.disableCors(true)
.followRedirects(true)
.minFailureDuration(10L)
.minLocationFailed(1L)
.noScreenshot(true)
.retry(new SyntheticsTestOptionsRetry().count(2L).interval(10.0))
.tickEvery(300L)
.scheduling(
new SyntheticsTestOptionsScheduling()
.timeframes(
Arrays.asList(
new SyntheticsTestOptionsSchedulingTimeframe()
.day(1)
.from("07:00")
.to("16:00"),
new SyntheticsTestOptionsSchedulingTimeframe()
.day(3)
.from("07:00")
.to("16:00")))
.timezone("America/New_York")))
.tags(Collections.singletonList("testing:browser"))
.type(SyntheticsBrowserTestType.BROWSER)
.steps(
Collections.singletonList(
new SyntheticsStep()
.allowFailure(false)
.isCritical(true)
.name("Refresh page")
.params(new Object())
.type(SyntheticsStepType.REFRESH)));
try {
SyntheticsBrowserTest result = apiInstance.createSyntheticsBrowserTest(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#createSyntheticsBrowserTest");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Instructions
First install the library and its dependencies and then save the example to Example.java and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"Create a browser test returns "OK - Returns saved rumSettings." response
"""
Create a browser test returns "OK - Returns saved rumSettings." response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_browser_test import SyntheticsBrowserTest
from datadog_api_client.v1.model.synthetics_browser_test_config import SyntheticsBrowserTestConfig
from datadog_api_client.v1.model.synthetics_browser_test_rum_settings import SyntheticsBrowserTestRumSettings
from datadog_api_client.v1.model.synthetics_browser_test_type import SyntheticsBrowserTestType
from datadog_api_client.v1.model.synthetics_config_variable import SyntheticsConfigVariable
from datadog_api_client.v1.model.synthetics_config_variable_type import SyntheticsConfigVariableType
from datadog_api_client.v1.model.synthetics_step import SyntheticsStep
from datadog_api_client.v1.model.synthetics_step_type import SyntheticsStepType
from datadog_api_client.v1.model.synthetics_test_ci_options import SyntheticsTestCiOptions
from datadog_api_client.v1.model.synthetics_test_execution_rule import SyntheticsTestExecutionRule
from datadog_api_client.v1.model.synthetics_test_options import SyntheticsTestOptions
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry
from datadog_api_client.v1.model.synthetics_test_request import SyntheticsTestRequest
body = SyntheticsBrowserTest(
config=SyntheticsBrowserTestConfig(
assertions=[],
config_variables=[
SyntheticsConfigVariable(
example="content-type",
name="PROPERTY",
pattern="content-type",
type=SyntheticsConfigVariableType.TEXT,
),
],
request=SyntheticsTestRequest(
method="GET",
url="https://datadoghq.com",
certificate_domains=[
"https://datadoghq.com",
],
),
set_cookie="name:test",
),
locations=[
"aws:us-east-2",
],
message="Test message",
name="Example-Synthetic",
options=SyntheticsTestOptions(
accept_self_signed=False,
allow_insecure=True,
device_ids=[
"tablet",
],
disable_cors=True,
follow_redirects=True,
min_failure_duration=10,
min_location_failed=1,
no_screenshot=True,
retry=SyntheticsTestOptionsRetry(
count=2,
interval=10.0,
),
rum_settings=SyntheticsBrowserTestRumSettings(
is_enabled=True,
application_id="mockApplicationId",
client_token_id=12345,
),
tick_every=300,
ci=SyntheticsTestCiOptions(
execution_rule=SyntheticsTestExecutionRule.SKIPPED,
),
ignore_server_certificate_error=True,
disable_csp=True,
initial_navigation_timeout=200,
),
tags=[
"testing:browser",
],
type=SyntheticsBrowserTestType.BROWSER,
steps=[
SyntheticsStep(
allow_failure=False,
is_critical=True,
name="Refresh page",
params=dict(),
type=SyntheticsStepType.REFRESH,
),
],
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = SyntheticsApi(api_client)
response = api_instance.create_synthetics_browser_test(body=body)
print(response)
Create a browser test returns "OK - Returns the created test details." response
"""
Create a browser test returns "OK - Returns the created test details." response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_browser_test import SyntheticsBrowserTest
from datadog_api_client.v1.model.synthetics_browser_test_config import SyntheticsBrowserTestConfig
from datadog_api_client.v1.model.synthetics_browser_test_type import SyntheticsBrowserTestType
from datadog_api_client.v1.model.synthetics_browser_variable import SyntheticsBrowserVariable
from datadog_api_client.v1.model.synthetics_browser_variable_type import SyntheticsBrowserVariableType
from datadog_api_client.v1.model.synthetics_config_variable import SyntheticsConfigVariable
from datadog_api_client.v1.model.synthetics_config_variable_type import SyntheticsConfigVariableType
from datadog_api_client.v1.model.synthetics_step import SyntheticsStep
from datadog_api_client.v1.model.synthetics_step_type import SyntheticsStepType
from datadog_api_client.v1.model.synthetics_test_options import SyntheticsTestOptions
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry
from datadog_api_client.v1.model.synthetics_test_request import SyntheticsTestRequest
body = SyntheticsBrowserTest(
config=SyntheticsBrowserTestConfig(
assertions=[],
variables=[
SyntheticsBrowserVariable(
type=SyntheticsBrowserVariableType.TEXT,
name="TEST_VARIABLE",
pattern="secret",
secure=True,
example="secret",
),
],
config_variables=[
SyntheticsConfigVariable(
example="content-type",
name="PROPERTY",
pattern="content-type",
type=SyntheticsConfigVariableType.TEXT,
secure=True,
),
],
request=SyntheticsTestRequest(
method="GET",
url="https://datadoghq.com",
),
set_cookie="name:test",
),
locations=[
"aws:us-east-2",
],
message="Test message",
name="Example-Synthetic",
options=SyntheticsTestOptions(
accept_self_signed=False,
allow_insecure=True,
device_ids=[
"chrome.laptop_large",
],
disable_cors=True,
follow_redirects=True,
min_failure_duration=10,
min_location_failed=1,
no_screenshot=True,
retry=SyntheticsTestOptionsRetry(
count=2,
interval=10.0,
),
tick_every=300,
enable_profiling=True,
enable_security_testing=True,
),
tags=[
"testing:browser",
],
type=SyntheticsBrowserTestType.BROWSER,
steps=[
SyntheticsStep(
allow_failure=False,
always_execute=True,
exit_if_succeed=True,
is_critical=True,
name="Refresh page",
params=dict(),
type=SyntheticsStepType.REFRESH,
),
],
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = SyntheticsApi(api_client)
response = api_instance.create_synthetics_browser_test(body=body)
print(response)
Create a browser test with advanced scheduling options returns "OK - Returns the created test details." response
"""
Create a browser test with advanced scheduling options returns "OK - Returns the created test details." response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_browser_test import SyntheticsBrowserTest
from datadog_api_client.v1.model.synthetics_browser_test_config import SyntheticsBrowserTestConfig
from datadog_api_client.v1.model.synthetics_browser_test_type import SyntheticsBrowserTestType
from datadog_api_client.v1.model.synthetics_config_variable import SyntheticsConfigVariable
from datadog_api_client.v1.model.synthetics_config_variable_type import SyntheticsConfigVariableType
from datadog_api_client.v1.model.synthetics_step import SyntheticsStep
from datadog_api_client.v1.model.synthetics_step_type import SyntheticsStepType
from datadog_api_client.v1.model.synthetics_test_options import SyntheticsTestOptions
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry
from datadog_api_client.v1.model.synthetics_test_options_scheduling import SyntheticsTestOptionsScheduling
from datadog_api_client.v1.model.synthetics_test_options_scheduling_timeframe import (
SyntheticsTestOptionsSchedulingTimeframe,
)
from datadog_api_client.v1.model.synthetics_test_request import SyntheticsTestRequest
body = SyntheticsBrowserTest(
config=SyntheticsBrowserTestConfig(
assertions=[],
config_variables=[
SyntheticsConfigVariable(
example="content-type",
name="PROPERTY",
pattern="content-type",
type=SyntheticsConfigVariableType.TEXT,
),
],
request=SyntheticsTestRequest(
method="GET",
url="https://datadoghq.com",
),
set_cookie="name:test",
),
locations=[
"aws:us-east-2",
],
message="Test message",
name="Example-Synthetic",
options=SyntheticsTestOptions(
accept_self_signed=False,
allow_insecure=True,
device_ids=[
"tablet",
],
disable_cors=True,
follow_redirects=True,
min_failure_duration=10,
min_location_failed=1,
no_screenshot=True,
retry=SyntheticsTestOptionsRetry(
count=2,
interval=10.0,
),
tick_every=300,
scheduling=SyntheticsTestOptionsScheduling(
timeframes=[
SyntheticsTestOptionsSchedulingTimeframe(
day=1,
_from="07:00",
to="16:00",
),
SyntheticsTestOptionsSchedulingTimeframe(
day=3,
_from="07:00",
to="16:00",
),
],
timezone="America/New_York",
),
),
tags=[
"testing:browser",
],
type=SyntheticsBrowserTestType.BROWSER,
steps=[
SyntheticsStep(
allow_failure=False,
is_critical=True,
name="Refresh page",
params=dict(),
type=SyntheticsStepType.REFRESH,
),
],
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = SyntheticsApi(api_client)
response = api_instance.create_synthetics_browser_test(body=body)
print(response)
Instructions
First install the library and its dependencies and then save the example to example.py and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"Create a browser test returns "OK - Returns saved rumSettings." response
# Create a browser test returns "OK - Returns saved rumSettings." response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
body = DatadogAPIClient::V1::SyntheticsBrowserTest.new({
config: DatadogAPIClient::V1::SyntheticsBrowserTestConfig.new({
assertions: [],
config_variables: [
DatadogAPIClient::V1::SyntheticsConfigVariable.new({
example: "content-type",
name: "PROPERTY",
pattern: "content-type",
type: DatadogAPIClient::V1::SyntheticsConfigVariableType::TEXT,
}),
],
request: DatadogAPIClient::V1::SyntheticsTestRequest.new({
method: "GET",
url: "https://datadoghq.com",
certificate_domains: [
"https://datadoghq.com",
],
}),
set_cookie: "name:test",
}),
locations: [
"aws:us-east-2",
],
message: "Test message",
name: "Example-Synthetic",
options: DatadogAPIClient::V1::SyntheticsTestOptions.new({
accept_self_signed: false,
allow_insecure: true,
device_ids: [
"tablet",
],
disable_cors: true,
follow_redirects: true,
min_failure_duration: 10,
min_location_failed: 1,
no_screenshot: true,
_retry: DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({
count: 2,
interval: 10,
}),
rum_settings: DatadogAPIClient::V1::SyntheticsBrowserTestRumSettings.new({
is_enabled: true,
application_id: "mockApplicationId",
client_token_id: 12345,
}),
tick_every: 300,
ci: DatadogAPIClient::V1::SyntheticsTestCiOptions.new({
execution_rule: DatadogAPIClient::V1::SyntheticsTestExecutionRule::SKIPPED,
}),
ignore_server_certificate_error: true,
disable_csp: true,
initial_navigation_timeout: 200,
}),
tags: [
"testing:browser",
],
type: DatadogAPIClient::V1::SyntheticsBrowserTestType::BROWSER,
steps: [
DatadogAPIClient::V1::SyntheticsStep.new({
allow_failure: false,
is_critical: true,
name: "Refresh page",
params: {},
type: DatadogAPIClient::V1::SyntheticsStepType::REFRESH,
}),
],
})
p api_instance.create_synthetics_browser_test(body)
Create a browser test returns "OK - Returns the created test details." response
# Create a browser test returns "OK - Returns the created test details." response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
body = DatadogAPIClient::V1::SyntheticsBrowserTest.new({
config: DatadogAPIClient::V1::SyntheticsBrowserTestConfig.new({
assertions: [],
variables: [
DatadogAPIClient::V1::SyntheticsBrowserVariable.new({
type: DatadogAPIClient::V1::SyntheticsBrowserVariableType::TEXT,
name: "TEST_VARIABLE",
pattern: "secret",
secure: true,
example: "secret",
}),
],
config_variables: [
DatadogAPIClient::V1::SyntheticsConfigVariable.new({
example: "content-type",
name: "PROPERTY",
pattern: "content-type",
type: DatadogAPIClient::V1::SyntheticsConfigVariableType::TEXT,
secure: true,
}),
],
request: DatadogAPIClient::V1::SyntheticsTestRequest.new({
method: "GET",
url: "https://datadoghq.com",
}),
set_cookie: "name:test",
}),
locations: [
"aws:us-east-2",
],
message: "Test message",
name: "Example-Synthetic",
options: DatadogAPIClient::V1::SyntheticsTestOptions.new({
accept_self_signed: false,
allow_insecure: true,
device_ids: [
"chrome.laptop_large",
],
disable_cors: true,
follow_redirects: true,
min_failure_duration: 10,
min_location_failed: 1,
no_screenshot: true,
_retry: DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({
count: 2,
interval: 10,
}),
tick_every: 300,
enable_profiling: true,
enable_security_testing: true,
}),
tags: [
"testing:browser",
],
type: DatadogAPIClient::V1::SyntheticsBrowserTestType::BROWSER,
steps: [
DatadogAPIClient::V1::SyntheticsStep.new({
allow_failure: false,
always_execute: true,
exit_if_succeed: true,
is_critical: true,
name: "Refresh page",
params: {},
type: DatadogAPIClient::V1::SyntheticsStepType::REFRESH,
}),
],
})
p api_instance.create_synthetics_browser_test(body)
Create a browser test with advanced scheduling options returns "OK - Returns the created test details." response
# Create a browser test with advanced scheduling options returns "OK - Returns the created test details." response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
body = DatadogAPIClient::V1::SyntheticsBrowserTest.new({
config: DatadogAPIClient::V1::SyntheticsBrowserTestConfig.new({
assertions: [],
config_variables: [
DatadogAPIClient::V1::SyntheticsConfigVariable.new({
example: "content-type",
name: "PROPERTY",
pattern: "content-type",
type: DatadogAPIClient::V1::SyntheticsConfigVariableType::TEXT,
}),
],
request: DatadogAPIClient::V1::SyntheticsTestRequest.new({
method: "GET",
url: "https://datadoghq.com",
}),
set_cookie: "name:test",
}),
locations: [
"aws:us-east-2",
],
message: "Test message",
name: "Example-Synthetic",
options: DatadogAPIClient::V1::SyntheticsTestOptions.new({
accept_self_signed: false,
allow_insecure: true,
device_ids: [
"tablet",
],
disable_cors: true,
follow_redirects: true,
min_failure_duration: 10,
min_location_failed: 1,
no_screenshot: true,
_retry: DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({
count: 2,
interval: 10,
}),
tick_every: 300,
scheduling: DatadogAPIClient::V1::SyntheticsTestOptionsScheduling.new({
timeframes: [
DatadogAPIClient::V1::SyntheticsTestOptionsSchedulingTimeframe.new({
day: 1,
from: "07:00",
to: "16:00",
}),
DatadogAPIClient::V1::SyntheticsTestOptionsSchedulingTimeframe.new({
day: 3,
from: "07:00",
to: "16:00",
}),
],
timezone: "America/New_York",
}),
}),
tags: [
"testing:browser",
],
type: DatadogAPIClient::V1::SyntheticsBrowserTestType::BROWSER,
steps: [
DatadogAPIClient::V1::SyntheticsStep.new({
allow_failure: false,
is_critical: true,
name: "Refresh page",
params: {},
type: DatadogAPIClient::V1::SyntheticsStepType::REFRESH,
}),
],
})
p api_instance.create_synthetics_browser_test(body)
Instructions
First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"Create a browser test returns "OK - Returns saved rumSettings." response
// Create a browser test returns "OK - Returns saved rumSettings." response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_synthetics::SyntheticsAPI;
use datadog_api_client::datadogV1::model::SyntheticsBrowserTest;
use datadog_api_client::datadogV1::model::SyntheticsBrowserTestConfig;
use datadog_api_client::datadogV1::model::SyntheticsBrowserTestRumSettings;
use datadog_api_client::datadogV1::model::SyntheticsBrowserTestType;
use datadog_api_client::datadogV1::model::SyntheticsConfigVariable;
use datadog_api_client::datadogV1::model::SyntheticsConfigVariableType;
use datadog_api_client::datadogV1::model::SyntheticsStep;
use datadog_api_client::datadogV1::model::SyntheticsStepType;
use datadog_api_client::datadogV1::model::SyntheticsTestCiOptions;
use datadog_api_client::datadogV1::model::SyntheticsTestExecutionRule;
use datadog_api_client::datadogV1::model::SyntheticsTestOptions;
use datadog_api_client::datadogV1::model::SyntheticsTestOptionsRetry;
use datadog_api_client::datadogV1::model::SyntheticsTestRequest;
use std::collections::BTreeMap;
#[tokio::main]
async fn main() {
let body = SyntheticsBrowserTest::new(
SyntheticsBrowserTestConfig::new(
vec![],
SyntheticsTestRequest::new()
.certificate_domains(vec!["https://datadoghq.com".to_string()])
.method("GET".to_string())
.url("https://datadoghq.com".to_string()),
)
.config_variables(vec![SyntheticsConfigVariable::new(
"PROPERTY".to_string(),
SyntheticsConfigVariableType::TEXT,
)
.example("content-type".to_string())
.pattern("content-type".to_string())])
.set_cookie("name:test".to_string()),
vec!["aws:us-east-2".to_string()],
"Test message".to_string(),
"Example-Synthetic".to_string(),
SyntheticsTestOptions::new()
.accept_self_signed(false)
.allow_insecure(true)
.ci(SyntheticsTestCiOptions::new(
SyntheticsTestExecutionRule::SKIPPED,
))
.device_ids(vec!["tablet".to_string()])
.disable_cors(true)
.disable_csp(true)
.follow_redirects(true)
.ignore_server_certificate_error(true)
.initial_navigation_timeout(200)
.min_failure_duration(10)
.min_location_failed(1)
.no_screenshot(true)
.retry(
SyntheticsTestOptionsRetry::new()
.count(2)
.interval(10.0 as f64),
)
.rum_settings(
SyntheticsBrowserTestRumSettings::new(true)
.application_id("mockApplicationId".to_string())
.client_token_id(12345),
)
.tick_every(300),
SyntheticsBrowserTestType::BROWSER,
)
.steps(vec![SyntheticsStep::new()
.allow_failure(false)
.is_critical(true)
.name("Refresh page".to_string())
.params(BTreeMap::new())
.type_(SyntheticsStepType::REFRESH)])
.tags(vec!["testing:browser".to_string()]);
let configuration = datadog::Configuration::new();
let api = SyntheticsAPI::with_config(configuration);
let resp = api.create_synthetics_browser_test(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Create a browser test returns "OK - Returns the created test details." response
// Create a browser test returns "OK - Returns the created test details." response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_synthetics::SyntheticsAPI;
use datadog_api_client::datadogV1::model::SyntheticsBrowserTest;
use datadog_api_client::datadogV1::model::SyntheticsBrowserTestConfig;
use datadog_api_client::datadogV1::model::SyntheticsBrowserTestType;
use datadog_api_client::datadogV1::model::SyntheticsBrowserVariable;
use datadog_api_client::datadogV1::model::SyntheticsBrowserVariableType;
use datadog_api_client::datadogV1::model::SyntheticsConfigVariable;
use datadog_api_client::datadogV1::model::SyntheticsConfigVariableType;
use datadog_api_client::datadogV1::model::SyntheticsStep;
use datadog_api_client::datadogV1::model::SyntheticsStepType;
use datadog_api_client::datadogV1::model::SyntheticsTestOptions;
use datadog_api_client::datadogV1::model::SyntheticsTestOptionsRetry;
use datadog_api_client::datadogV1::model::SyntheticsTestRequest;
use std::collections::BTreeMap;
#[tokio::main]
async fn main() {
let body = SyntheticsBrowserTest::new(
SyntheticsBrowserTestConfig::new(
vec![],
SyntheticsTestRequest::new()
.method("GET".to_string())
.url("https://datadoghq.com".to_string()),
)
.config_variables(vec![SyntheticsConfigVariable::new(
"PROPERTY".to_string(),
SyntheticsConfigVariableType::TEXT,
)
.example("content-type".to_string())
.pattern("content-type".to_string())
.secure(true)])
.set_cookie("name:test".to_string())
.variables(vec![SyntheticsBrowserVariable::new(
"TEST_VARIABLE".to_string(),
SyntheticsBrowserVariableType::TEXT,
)
.example("secret".to_string())
.pattern("secret".to_string())
.secure(true)]),
vec!["aws:us-east-2".to_string()],
"Test message".to_string(),
"Example-Synthetic".to_string(),
SyntheticsTestOptions::new()
.accept_self_signed(false)
.allow_insecure(true)
.device_ids(vec!["chrome.laptop_large".to_string()])
.disable_cors(true)
.enable_profiling(true)
.enable_security_testing(true)
.follow_redirects(true)
.min_failure_duration(10)
.min_location_failed(1)
.no_screenshot(true)
.retry(
SyntheticsTestOptionsRetry::new()
.count(2)
.interval(10.0 as f64),
)
.tick_every(300),
SyntheticsBrowserTestType::BROWSER,
)
.steps(vec![SyntheticsStep::new()
.allow_failure(false)
.always_execute(true)
.exit_if_succeed(true)
.is_critical(true)
.name("Refresh page".to_string())
.params(BTreeMap::new())
.type_(SyntheticsStepType::REFRESH)])
.tags(vec!["testing:browser".to_string()]);
let configuration = datadog::Configuration::new();
let api = SyntheticsAPI::with_config(configuration);
let resp = api.create_synthetics_browser_test(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Create a browser test with advanced scheduling options returns "OK - Returns the created test details." response
// Create a browser test with advanced scheduling options returns "OK - Returns
// the created test details." response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_synthetics::SyntheticsAPI;
use datadog_api_client::datadogV1::model::SyntheticsBrowserTest;
use datadog_api_client::datadogV1::model::SyntheticsBrowserTestConfig;
use datadog_api_client::datadogV1::model::SyntheticsBrowserTestType;
use datadog_api_client::datadogV1::model::SyntheticsConfigVariable;
use datadog_api_client::datadogV1::model::SyntheticsConfigVariableType;
use datadog_api_client::datadogV1::model::SyntheticsStep;
use datadog_api_client::datadogV1::model::SyntheticsStepType;
use datadog_api_client::datadogV1::model::SyntheticsTestOptions;
use datadog_api_client::datadogV1::model::SyntheticsTestOptionsRetry;
use datadog_api_client::datadogV1::model::SyntheticsTestOptionsScheduling;
use datadog_api_client::datadogV1::model::SyntheticsTestOptionsSchedulingTimeframe;
use datadog_api_client::datadogV1::model::SyntheticsTestRequest;
use std::collections::BTreeMap;
#[tokio::main]
async fn main() {
let body = SyntheticsBrowserTest::new(
SyntheticsBrowserTestConfig::new(
vec![],
SyntheticsTestRequest::new()
.method("GET".to_string())
.url("https://datadoghq.com".to_string()),
)
.config_variables(vec![SyntheticsConfigVariable::new(
"PROPERTY".to_string(),
SyntheticsConfigVariableType::TEXT,
)
.example("content-type".to_string())
.pattern("content-type".to_string())])
.set_cookie("name:test".to_string()),
vec!["aws:us-east-2".to_string()],
"Test message".to_string(),
"Example-Synthetic".to_string(),
SyntheticsTestOptions::new()
.accept_self_signed(false)
.allow_insecure(true)
.device_ids(vec!["tablet".to_string()])
.disable_cors(true)
.follow_redirects(true)
.min_failure_duration(10)
.min_location_failed(1)
.no_screenshot(true)
.retry(
SyntheticsTestOptionsRetry::new()
.count(2)
.interval(10.0 as f64),
)
.scheduling(SyntheticsTestOptionsScheduling::new(
vec![
SyntheticsTestOptionsSchedulingTimeframe::new(
1,
"07:00".to_string(),
"16:00".to_string(),
),
SyntheticsTestOptionsSchedulingTimeframe::new(
3,
"07:00".to_string(),
"16:00".to_string(),
),
],
"America/New_York".to_string(),
))
.tick_every(300),
SyntheticsBrowserTestType::BROWSER,
)
.steps(vec![SyntheticsStep::new()
.allow_failure(false)
.is_critical(true)
.name("Refresh page".to_string())
.params(BTreeMap::new())
.type_(SyntheticsStepType::REFRESH)])
.tags(vec!["testing:browser".to_string()]);
let configuration = datadog::Configuration::new();
let api = SyntheticsAPI::with_config(configuration);
let resp = api.create_synthetics_browser_test(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Instructions
First install the library and its dependencies and then save the example to src/main.rs and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runCreate a browser test returns "OK - Returns saved rumSettings." response
/**
* Create a browser test returns "OK - Returns saved rumSettings." response
*/
import { client, v1 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
const apiInstance = new v1.SyntheticsApi(configuration);
const params: v1.SyntheticsApiCreateSyntheticsBrowserTestRequest = {
body: {
config: {
assertions: [],
configVariables: [
{
example: "content-type",
name: "PROPERTY",
pattern: "content-type",
type: "text",
},
],
request: {
method: "GET",
url: "https://datadoghq.com",
certificateDomains: ["https://datadoghq.com"],
},
setCookie: "name:test",
},
locations: ["aws:us-east-2"],
message: "Test message",
name: "Example-Synthetic",
options: {
acceptSelfSigned: false,
allowInsecure: true,
deviceIds: ["tablet"],
disableCors: true,
followRedirects: true,
minFailureDuration: 10,
minLocationFailed: 1,
noScreenshot: true,
retry: {
count: 2,
interval: 10,
},
rumSettings: {
isEnabled: true,
applicationId: "mockApplicationId",
clientTokenId: 12345,
},
tickEvery: 300,
ci: {
executionRule: "skipped",
},
ignoreServerCertificateError: true,
disableCsp: true,
initialNavigationTimeout: 200,
},
tags: ["testing:browser"],
type: "browser",
steps: [
{
allowFailure: false,
isCritical: true,
name: "Refresh page",
params: {},
type: "refresh",
},
],
},
};
apiInstance
.createSyntheticsBrowserTest(params)
.then((data: v1.SyntheticsBrowserTest) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
Create a browser test returns "OK - Returns the created test details." response
/**
* Create a browser test returns "OK - Returns the created test details." response
*/
import { client, v1 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
const apiInstance = new v1.SyntheticsApi(configuration);
const params: v1.SyntheticsApiCreateSyntheticsBrowserTestRequest = {
body: {
config: {
assertions: [],
variables: [
{
type: "text",
name: "TEST_VARIABLE",
pattern: "secret",
secure: true,
example: "secret",
},
],
configVariables: [
{
example: "content-type",
name: "PROPERTY",
pattern: "content-type",
type: "text",
secure: true,
},
],
request: {
method: "GET",
url: "https://datadoghq.com",
},
setCookie: "name:test",
},
locations: ["aws:us-east-2"],
message: "Test message",
name: "Example-Synthetic",
options: {
acceptSelfSigned: false,
allowInsecure: true,
deviceIds: ["chrome.laptop_large"],
disableCors: true,
followRedirects: true,
minFailureDuration: 10,
minLocationFailed: 1,
noScreenshot: true,
retry: {
count: 2,
interval: 10,
},
tickEvery: 300,
enableProfiling: true,
enableSecurityTesting: true,
},
tags: ["testing:browser"],
type: "browser",
steps: [
{
allowFailure: false,
alwaysExecute: true,
exitIfSucceed: true,
isCritical: true,
name: "Refresh page",
params: {},
type: "refresh",
},
],
},
};
apiInstance
.createSyntheticsBrowserTest(params)
.then((data: v1.SyntheticsBrowserTest) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
Create a browser test with advanced scheduling options returns "OK - Returns the created test details." response
/**
* Create a browser test with advanced scheduling options returns "OK - Returns the created test details." response
*/
import { client, v1 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
const apiInstance = new v1.SyntheticsApi(configuration);
const params: v1.SyntheticsApiCreateSyntheticsBrowserTestRequest = {
body: {
config: {
assertions: [],
configVariables: [
{
example: "content-type",
name: "PROPERTY",
pattern: "content-type",
type: "text",
},
],
request: {
method: "GET",
url: "https://datadoghq.com",
},
setCookie: "name:test",
},
locations: ["aws:us-east-2"],
message: "Test message",
name: "Example-Synthetic",
options: {
acceptSelfSigned: false,
allowInsecure: true,
deviceIds: ["tablet"],
disableCors: true,
followRedirects: true,
minFailureDuration: 10,
minLocationFailed: 1,
noScreenshot: true,
retry: {
count: 2,
interval: 10,
},
tickEvery: 300,
scheduling: {
timeframes: [
{
day: 1,
from: "07:00",
to: "16:00",
},
{
day: 3,
from: "07:00",
to: "16:00",
},
],
timezone: "America/New_York",
},
},
tags: ["testing:browser"],
type: "browser",
steps: [
{
allowFailure: false,
isCritical: true,
name: "Refresh page",
params: {},
type: "refresh",
},
],
},
};
apiInstance
.createSyntheticsBrowserTest(params)
.then((data: v1.SyntheticsBrowserTest) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
Instructions
First install the library and its dependencies and then save the example to example.ts and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"