Datadog Synthetic utilise des requêtes utilisateur simulées et le rendu du navigateur pour vous aider à optimiser votre uptime, à identifier les problèmes affectant une région spécifique et à surveiller les performances de l’application. Il existe deux types de tests Datadog Synthetic : les tests API et les tests Browser. Vous pouvez utiliser l’API Datadog pour gérer les deux types de tests automatiquement.
Pour en savoir plus sur Synthetic, consultez la présentation de Synthetic.
POST https://api.datadoghq.eu/api/v1/synthetics/variableshttps://api.datadoghq.com/api/v1/synthetics/variables
Créez une variable globale Synthetic.
Détails de la variable globale à créer.
Champ
Type
Description
description [required]
string
Description of the global variable.
id
string
Unique identifier of the global variable.
name [required]
string
Name of the global variable.
parse_test_options
object
Parser options to use for retrieving a Synthetics global variable from a Synthetics Test. Used in conjunction with parse_test_public_id
.
field
string
When type is http_header
, name of the header to use to extract the value.
parser [required]
object
Details of the parser to use for the global variable.
type [required]
enum
Type of parser for a Synthetics global variable from a synthetics test.
Allowed enum values: raw,json_path,regex
value
string
Regex or JSON path used for the parser. Not used with type raw
.
type [required]
enum
Property of the Synthetics Test Response to use for a Synthetics global variable.
Allowed enum values: http_body,http_header
parse_test_public_id
string
A Synthetic test ID to use as a test to generate the variable value.
tags [required]
[string]
Tags of the global variable.
value [required]
Value of the global variable.
secure
boolean
Determines if the variable is secure.
value [required]
string
Value of the global variable. When reading a global variable, the value will not be present if the variable is secure.
{
"description": "Example description",
"name": "MY_VARIABLE",
"parse_test_options": {
"field": "content-type",
"parser": {
"type": "string",
"value": "string"
},
"type": "string"
},
"parse_test_public_id": "abc-def-123",
"tags": [
"team:front",
"test:workflow-1"
],
"value": {
"secure": false,
"value": "example-value"
}
}
OK
Synthetics global variable.
Champ
Type
Description
description [required]
string
Description of the global variable.
id
string
Unique identifier of the global variable.
name [required]
string
Name of the global variable.
parse_test_options
object
Parser options to use for retrieving a Synthetics global variable from a Synthetics Test. Used in conjunction with parse_test_public_id
.
field
string
When type is http_header
, name of the header to use to extract the value.
parser [required]
object
Details of the parser to use for the global variable.
type [required]
enum
Type of parser for a Synthetics global variable from a synthetics test.
Allowed enum values: raw,json_path,regex
value
string
Regex or JSON path used for the parser. Not used with type raw
.
type [required]
enum
Property of the Synthetics Test Response to use for a Synthetics global variable.
Allowed enum values: http_body,http_header
parse_test_public_id
string
A Synthetic test ID to use as a test to generate the variable value.
tags [required]
[string]
Tags of the global variable.
value [required]
Value of the global variable.
secure
boolean
Determines if the variable is secure.
value [required]
string
Value of the global variable. When reading a global variable, the value will not be present if the variable is secure.
{
"description": "Example description",
"id": "string",
"name": "MY_VARIABLE",
"parse_test_options": {
"field": "content-type",
"parser": {
"type": "string",
"value": "string"
},
"type": "string"
},
"parse_test_public_id": "abc-def-123",
"tags": [
"team:front",
"test:workflow-1"
],
"value": {
"secure": false,
"value": "example-value"
}
}
Invalid request
Error response object.
{
"errors": [
"Bad Request"
]
}
Forbidden
Error response object.
{
"errors": [
"Bad Request"
]
}
# Curl command
curl -X POST "https://api.datadoghq.eu"https://api.datadoghq.com/api/v1/synthetics/variables" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}" \
-d @- << EOF
{
"description": "Example description",
"name": "MY_VARIABLE",
"parse_test_options": {
"parser": {
"type": null
},
"type": null
},
"tags": [
"team:front",
"test:workflow-1"
],
"value": {
"value": "example-value"
}
}
EOF
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
body := *datadog.NewSyntheticsGlobalVariable("Example description", "MY_VARIABLE", []string{"Tags_example"}, *datadog.NewSyntheticsGlobalVariableValue("example-value")) // SyntheticsGlobalVariable | Details of the global variable to create.
configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.SyntheticsApi.CreateGlobalVariable(ctx).Body(body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.CreateGlobalVariable``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreateGlobalVariable`: SyntheticsGlobalVariable
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from SyntheticsApi.CreateGlobalVariable:\n%s\n", response_content)
}
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.SyntheticsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
SyntheticsGlobalVariable body = new SyntheticsGlobalVariable(); // SyntheticsGlobalVariable | Details of the global variable to create.
try {
SyntheticsGlobalVariable result = apiInstance.createGlobalVariable()
.body(body)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#createGlobalVariable");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
import os
from dateutil.parser import parse as dateutil_parser
import datadog_api_client.v1
from datadog_api_client.v1.api import synthetics_api
from datadog_api_client.v1.models import *
from pprint import pprint
# Defining the host is optional and defaults to https://api.datadoghq.com
# See configuration.py for a list of all supported configuration parameters.
configuration = datadog_api_client.v1.Configuration(
host = "https://api.datadoghq.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['appKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with datadog_api_client.v1.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = synthetics_api.SyntheticsApi(api_client)
body = SyntheticsGlobalVariable(
description="Example description",
id="id_example",
name="MY_VARIABLE",
parse_test_options=SyntheticsGlobalVariableParseTestOptions(
field="content-type",
parser=SyntheticsGlobalVariableParseTestOptionsParser(
type=SyntheticsGlobalVariableParserType("raw"),
value="value_example",
),
type=SyntheticsGlobalVariableParseTestOptionsType("http_body"),
),
parse_test_public_id="abc-def-123",
tags=["team:front","test:workflow-1"],
value=SyntheticsGlobalVariableValue(
secure=True,
value="example-value",
),
) # SyntheticsGlobalVariable | Details of the global variable to create.
# example passing only required values which don't have defaults set
try:
# Create a global variable
api_response = api_instance.create_global_variable(body)
pprint(api_response)
except datadog_api_client.v1.ApiException as e:
print("Exception when calling SyntheticsApi->create_global_variable: %s\n" % e)
require 'time'
require 'datadog_api_client/v1'
# setup authorization
DatadogAPIClient::V1.configure do |config|
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['appKeyAuth'] = 'Bearer'
end
api_instance = DatadogAPIClient::V1::SyntheticsApi.new
body = DatadogAPIClient::V1::SyntheticsGlobalVariable.new({description: 'Example description', name: 'MY_VARIABLE', tags: ['tags_example'], value: DatadogAPIClient::V1::SyntheticsGlobalVariableValue.new({value: 'example-value'})}) # SyntheticsGlobalVariable | Details of the global variable to create.
begin
# Create a global variable
result = api_instance.create_global_variable(body)
p result
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling SyntheticsApi->create_global_variable: #{e}"
end
POST https://api.datadoghq.eu/api/v1/synthetics/private-locationshttps://api.datadoghq.com/api/v1/synthetics/private-locations
Créez un emplacement privé Synthetic.
Détails de l’emplacement privé à créer.
Champ
Type
Description
description [required]
string
Description of the private location.
id
string
Unique identifier of the private location.
name [required]
string
Name of the private location.
secrets
object
Secrets for the private location. Only present in the response when creating the private location.
authentication
object
Authentication part of the secrets.
id
string
Access key for the private location.
key
string
Secret access key for the private location.
config_decryption
object
Private key for the private location.
key
string
Private key for the private location.
tags [required]
[string]
Array of tags attached to the private location.
{
"description": "Description of private location",
"name": "New private location",
"tags": [
"team:front"
]
}
OK
Object that contains the new private location, the public key for result encryption, and the configuration skeleton.
Champ
Type
Description
config
object
Configuration skeleton for the private location. See installation instructions of the private location on how to use this configuration.
private_location
object
Object containing information about the private location to create.
description [required]
string
Description of the private location.
id
string
Unique identifier of the private location.
name [required]
string
Name of the private location.
secrets
object
Secrets for the private location. Only present in the response when creating the private location.
authentication
object
Authentication part of the secrets.
id
string
Access key for the private location.
key
string
Secret access key for the private location.
config_decryption
object
Private key for the private location.
key
string
Private key for the private location.
tags [required]
[string]
Array of tags attached to the private location.
result_encryption
object
Public key for the result encryption.
id
string
Fingerprint for the encryption key.
key
string
Public key for result encryption.
{
"config": {},
"private_location": {
"description": "Description of private location",
"id": "string",
"name": "New private location",
"secrets": {
"authentication": {
"id": "string",
"key": "string"
},
"config_decryption": {
"key": "string"
}
},
"tags": [
"team:front"
]
},
"result_encryption": {
"id": "string",
"key": "string"
}
}
Quota reached for private locations
Error response object.
{
"errors": [
"Bad Request"
]
}
Private locations are not activated for the user
Error response object.
{
"errors": [
"Bad Request"
]
}
# Curl command
curl -X POST "https://api.datadoghq.eu"https://api.datadoghq.com/api/v1/synthetics/private-locations" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}" \
-d @- << EOF
{
"description": "Description of private location",
"name": "New private location",
"tags": [
"team:front"
]
}
EOF
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
body := *datadog.NewSyntheticsPrivateLocation("Description of private location", "New private location", []string{"team:front"}) // SyntheticsPrivateLocation | Details of the private location to create.
configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.SyntheticsApi.CreatePrivateLocation(ctx).Body(body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.CreatePrivateLocation``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreatePrivateLocation`: SyntheticsPrivateLocationCreationResponse
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from SyntheticsApi.CreatePrivateLocation:\n%s\n", response_content)
}
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.SyntheticsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
SyntheticsPrivateLocation body = new SyntheticsPrivateLocation(); // SyntheticsPrivateLocation | Details of the private location to create.
try {
SyntheticsPrivateLocationCreationResponse result = apiInstance.createPrivateLocation()
.body(body)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#createPrivateLocation");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
import os
from dateutil.parser import parse as dateutil_parser
import datadog_api_client.v1
from datadog_api_client.v1.api import synthetics_api
from datadog_api_client.v1.models import *
from pprint import pprint
# Defining the host is optional and defaults to https://api.datadoghq.com
# See configuration.py for a list of all supported configuration parameters.
configuration = datadog_api_client.v1.Configuration(
host = "https://api.datadoghq.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['appKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with datadog_api_client.v1.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = synthetics_api.SyntheticsApi(api_client)
body = SyntheticsPrivateLocation(
description="Description of private location",
id="id_example",
name="New private location",
secrets=SyntheticsPrivateLocationSecrets(
authentication=SyntheticsPrivateLocationSecretsAuthentication(
id="id_example",
key="key_example",
),
config_decryption=SyntheticsPrivateLocationSecretsConfigDecryption(
key="key_example",
),
),
tags=["team:front"],
) # SyntheticsPrivateLocation | Details of the private location to create.
# example passing only required values which don't have defaults set
try:
# Create a private location
api_response = api_instance.create_private_location(body)
pprint(api_response)
except datadog_api_client.v1.ApiException as e:
print("Exception when calling SyntheticsApi->create_private_location: %s\n" % e)
require 'time'
require 'datadog_api_client/v1'
# setup authorization
DatadogAPIClient::V1.configure do |config|
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['appKeyAuth'] = 'Bearer'
end
api_instance = DatadogAPIClient::V1::SyntheticsApi.new
body = DatadogAPIClient::V1::SyntheticsPrivateLocation.new({description: 'Description of private location', name: 'New private location', tags: ['team:front']}) # SyntheticsPrivateLocation | Details of the private location to create.
begin
# Create a private location
result = api_instance.create_private_location(body)
p result
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling SyntheticsApi->create_private_location: #{e}"
end
POST https://api.datadoghq.eu/api/v1/synthetics/testshttps://api.datadoghq.com/api/v1/synthetics/tests
Créez un test Synthetic.
Détails du test à créer.
Champ
Type
Description
config
object
Configuration object for a Synthetic test.
assertions [required]
[object]
Array of assertions used for the test.
configVariables
[object]
API tests only - array of variables used for the test.
example [required]
string
Example for the variable.
name [required]
string
Name of the variable.
pattern
string
Pattern of the variable.
type [required]
enum
Type of the configuration variable.
Allowed enum values: text
request [required]
object
Object describing the Synthetic test request.
basicAuth
object
Object to handle basic authentication when performing the test.
password [required]
string
Password to use for the basic authentication.
username [required]
string
Username to use for the basic authentication.
body
string
Body to include in the test.
certificate
object
Client certificate to use when performing the test request.
cert
object
Define a request certificate.
content
string
Content of the certificate or key.
filename
string
File name for the certificate or key.
updatedAt
string
Date of update of the certificate or key, ISO format.
key
object
Define a request certificate.
content
string
Content of the certificate or key.
filename
string
File name for the certificate or key.
updatedAt
string
Date of update of the certificate or key, ISO format.
dnsServer
string
DNS server to use for DNS tests.
headers
object
Headers to include when performing the test.
<any-key>
string
A single Header.
host
string
Host name to perform the test with.
method
enum
The HTTP method.
Allowed enum values: GET,POST,PATCH,PUT,DELETE,HEAD,OPTIONS
port
int64
Port to use when performing the test.
query
object
Query to use for the test.
timeout
double
Timeout in seconds for the test.
url
string
URL to perform the test with.
variables
[object]
Browser tests only - array of variables used for the test steps.
example
string
Example for the variable.
id
string
ID for the variable.
name [required]
string
Name of the variable.
pattern
string
Pattern of the variable.
type [required]
enum
Type of browser test variable.
Allowed enum values: element,email,global,javascript,text
locations
[string]
Array of locations used to run the test.
message
string
Notification message associated with the test.
monitor_id
int64
The associated monitor ID.
name
string
Name of the test.
options
object
Object describing the extra options for a Synthetic test.
accept_self_signed
boolean
For SSL test, whether or not the test should allow self signed certificates.
allow_insecure
boolean
Allows loading insecure content for an HTTP request.
device_ids
[string]
For browser test, array with the different device IDs used to run the test.
follow_redirects
boolean
For API HTTP test, whether or not the test should follow redirects.
min_failure_duration
int64
Minimum amount of time in failure required to trigger an alert.
min_location_failed
int64
Minimum number of locations in failure required to trigger an alert.
monitor_options
object
Object containing the options for a Synthetic test as a monitor (for example, renotification).
renotify_interval
int64
Time interval before renotifying if the test is still failing (in minutes).
retry
object
Object describing the retry strategy to apply to a Synthetic test.
count
int64
Number of times a test needs to be retried before marking a location as failed. Defaults to 0.
interval
double
Time interval between retries (in milliseconds). Defaults to 300ms.
tick_every
enum
The frequency at which to run the Synthetic test (in seconds).
Allowed enum values: 60,300,900,1800,3600,21600,43200,86400,604800
public_id
string
The test public ID.
status
enum
Define whether you want to start (live
) or pause (paused
) a
Synthetic test.
Allowed enum values: live,paused
steps
[object]
For browser test, the steps of the test.
allowFailure
boolean
A boolean set to allow this step to fail.
name
string
The name of the step.
params
object
The parameters of the step.
timeout
int64
The time before declaring a step failed.
type
enum
Step type used in your Synthetic test.
Allowed enum values: assertCurrentUrl,assertElementAttribute,assertElementContent,assertElementPresent,assertEmail,assertFileDownload,assertFromJavascript,assertPageContains,assertPageLacks,click,extractFromJavascript,extractVariable,goToEmailLink,goToUrl,goToUrlAndMeasureTti,hover,playSubTest,pressKey,refresh,runApiTest,scroll,selectOption,typeText,uploadFiles,wait
subtype
enum
The sub-type of the Synthetic API test, http
, ssl
, tcp
or
dns
.
Allowed enum values: http,ssl,tcp,dns
tags
[string]
Array of tags attached to the test.
type
enum
Type of the Synthetic test, either api
or browser
.
Allowed enum values: api,browser
{
"config": {
"assertions": [
[]
],
"configVariables": [
{
"example": "string",
"name": "VARIABLE_NAME",
"pattern": "string",
"type": "string"
}
],
"request": {
"basicAuth": {
"password": "",
"username": ""
},
"body": "string",
"certificate": {
"cert": {
"content": "string",
"filename": "string",
"updatedAt": "string"
},
"key": {
"content": "string",
"filename": "string",
"updatedAt": "string"
}
},
"dnsServer": "string",
"headers": {
"<any-key>": "string"
},
"host": "string",
"method": "string",
"port": "integer",
"query": {},
"timeout": "number",
"url": "string"
},
"variables": [
{
"example": "string",
"id": "string",
"name": "VARIABLE_NAME",
"pattern": "string",
"type": "string"
}
]
},
"locations": [],
"message": "string",
"monitor_id": "integer",
"name": "string",
"options": {
"accept_self_signed": false,
"allow_insecure": false,
"device_ids": [],
"follow_redirects": false,
"min_failure_duration": "integer",
"min_location_failed": "integer",
"monitor_options": {
"renotify_interval": "integer"
},
"retry": {
"count": "integer",
"interval": "number"
},
"tick_every": "integer"
},
"public_id": "string",
"status": "string",
"steps": [
{
"allowFailure": false,
"name": "string",
"params": {},
"timeout": "integer",
"type": "string"
}
],
"subtype": "string",
"tags": [],
"type": "string"
}
OK - Returns the created test details.
Object containing details about your Synthetic test.
Champ
Type
Description
config
object
Configuration object for a Synthetic test.
assertions [required]
[object]
Array of assertions used for the test.
configVariables
[object]
API tests only - array of variables used for the test.
example [required]
string
Example for the variable.
name [required]
string
Name of the variable.
pattern
string
Pattern of the variable.
type [required]
enum
Type of the configuration variable.
Allowed enum values: text
request [required]
object
Object describing the Synthetic test request.
basicAuth
object
Object to handle basic authentication when performing the test.
password [required]
string
Password to use for the basic authentication.
username [required]
string
Username to use for the basic authentication.
body
string
Body to include in the test.
certificate
object
Client certificate to use when performing the test request.
cert
object
Define a request certificate.
content
string
Content of the certificate or key.
filename
string
File name for the certificate or key.
updatedAt
string
Date of update of the certificate or key, ISO format.
key
object
Define a request certificate.
content
string
Content of the certificate or key.
filename
string
File name for the certificate or key.
updatedAt
string
Date of update of the certificate or key, ISO format.
dnsServer
string
DNS server to use for DNS tests.
headers
object
Headers to include when performing the test.
<any-key>
string
A single Header.
host
string
Host name to perform the test with.
method
enum
The HTTP method.
Allowed enum values: GET,POST,PATCH,PUT,DELETE,HEAD,OPTIONS
port
int64
Port to use when performing the test.
query
object
Query to use for the test.
timeout
double
Timeout in seconds for the test.
url
string
URL to perform the test with.
variables
[object]
Browser tests only - array of variables used for the test steps.
example
string
Example for the variable.
id
string
ID for the variable.
name [required]
string
Name of the variable.
pattern
string
Pattern of the variable.
type [required]
enum
Type of browser test variable.
Allowed enum values: element,email,global,javascript,text
locations
[string]
Array of locations used to run the test.
message
string
Notification message associated with the test.
monitor_id
int64
The associated monitor ID.
name
string
Name of the test.
options
object
Object describing the extra options for a Synthetic test.
accept_self_signed
boolean
For SSL test, whether or not the test should allow self signed certificates.
allow_insecure
boolean
Allows loading insecure content for an HTTP request.
device_ids
[string]
For browser test, array with the different device IDs used to run the test.
follow_redirects
boolean
For API HTTP test, whether or not the test should follow redirects.
min_failure_duration
int64
Minimum amount of time in failure required to trigger an alert.
min_location_failed
int64
Minimum number of locations in failure required to trigger an alert.
monitor_options
object
Object containing the options for a Synthetic test as a monitor (for example, renotification).
renotify_interval
int64
Time interval before renotifying if the test is still failing (in minutes).
retry
object
Object describing the retry strategy to apply to a Synthetic test.
count
int64
Number of times a test needs to be retried before marking a location as failed. Defaults to 0.
interval
double
Time interval between retries (in milliseconds). Defaults to 300ms.
tick_every
enum
The frequency at which to run the Synthetic test (in seconds).
Allowed enum values: 60,300,900,1800,3600,21600,43200,86400,604800
public_id
string
The test public ID.
status
enum
Define whether you want to start (live
) or pause (paused
) a
Synthetic test.
Allowed enum values: live,paused
steps
[object]
For browser test, the steps of the test.
allowFailure
boolean
A boolean set to allow this step to fail.
name
string
The name of the step.
params
object
The parameters of the step.
timeout
int64
The time before declaring a step failed.
type
enum
Step type used in your Synthetic test.
Allowed enum values: assertCurrentUrl,assertElementAttribute,assertElementContent,assertElementPresent,assertEmail,assertFileDownload,assertFromJavascript,assertPageContains,assertPageLacks,click,extractFromJavascript,extractVariable,goToEmailLink,goToUrl,goToUrlAndMeasureTti,hover,playSubTest,pressKey,refresh,runApiTest,scroll,selectOption,typeText,uploadFiles,wait
subtype
enum
The sub-type of the Synthetic API test, http
, ssl
, tcp
or
dns
.
Allowed enum values: http,ssl,tcp,dns
tags
[string]
Array of tags attached to the test.
type
enum
Type of the Synthetic test, either api
or browser
.
Allowed enum values: api,browser
{
"config": {
"assertions": [
[]
],
"configVariables": [
{
"example": "string",
"name": "VARIABLE_NAME",
"pattern": "string",
"type": "string"
}
],
"request": {
"basicAuth": {
"password": "",
"username": ""
},
"body": "string",
"certificate": {
"cert": {
"content": "string",
"filename": "string",
"updatedAt": "string"
},
"key": {
"content": "string",
"filename": "string",
"updatedAt": "string"
}
},
"dnsServer": "string",
"headers": {
"<any-key>": "string"
},
"host": "string",
"method": "string",
"port": "integer",
"query": {},
"timeout": "number",
"url": "string"
},
"variables": [
{
"example": "string",
"id": "string",
"name": "VARIABLE_NAME",
"pattern": "string",
"type": "string"
}
]
},
"locations": [],
"message": "string",
"monitor_id": "integer",
"name": "string",
"options": {
"accept_self_signed": false,
"allow_insecure": false,
"device_ids": [],
"follow_redirects": false,
"min_failure_duration": "integer",
"min_location_failed": "integer",
"monitor_options": {
"renotify_interval": "integer"
},
"retry": {
"count": "integer",
"interval": "number"
},
"tick_every": "integer"
},
"public_id": "string",
"status": "string",
"steps": [
{
"allowFailure": false,
"name": "string",
"params": {},
"timeout": "integer",
"type": "string"
}
],
"subtype": "string",
"tags": [],
"type": "string"
}
- JSON format is wrong - Creation failed
Error response object.
{
"errors": [
"Bad Request"
]
}
Test quota is reached
Error response object.
{
"errors": [
"Bad Request"
]
}
Forbidden
Error response object.
{
"errors": [
"Bad Request"
]
}
# Curl command
curl -X POST "https://api.datadoghq.eu"https://api.datadoghq.com/api/v1/synthetics/tests" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}" \
-d @- << EOF
{
"config": {
"assertions": [
null
],
"configVariables": [
{
"example": null,
"name": "VARIABLE_NAME",
"type": null
}
],
"request": {
"basicAuth": {
"password": "",
"username": ""
}
},
"variables": [
{
"name": "VARIABLE_NAME",
"type": null
}
]
}
}
EOF
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
body := *datadog.NewSyntheticsTestDetails() // SyntheticsTestDetails | Details of the test to create.
configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.SyntheticsApi.CreateTest(ctx).Body(body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.CreateTest``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreateTest`: SyntheticsTestDetails
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from SyntheticsApi.CreateTest:\n%s\n", response_content)
}
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.SyntheticsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
SyntheticsTestDetails body = new SyntheticsTestDetails(); // SyntheticsTestDetails | Details of the test to create.
try {
SyntheticsTestDetails result = apiInstance.createTest()
.body(body)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#createTest");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
import os
from dateutil.parser import parse as dateutil_parser
import datadog_api_client.v1
from datadog_api_client.v1.api import synthetics_api
from datadog_api_client.v1.models import *
from pprint import pprint
# Defining the host is optional and defaults to https://api.datadoghq.com
# See configuration.py for a list of all supported configuration parameters.
configuration = datadog_api_client.v1.Configuration(
host = "https://api.datadoghq.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['appKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with datadog_api_client.v1.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = synthetics_api.SyntheticsApi(api_client)
body = SyntheticsTestDetails(
config=SyntheticsTestConfig(
assertions=[],
config_variables=[
SyntheticsConfigVariable(
example="example_example",
name="VARIABLE_NAME",
pattern="pattern_example",
type=SyntheticsConfigVariableType("text"),
),
],
request=SyntheticsTestRequest(
basic_auth=SyntheticsBasicAuth(
password="",
username="",
),
body="body_example",
certificate=SyntheticsTestRequestCertificate(
cert=SyntheticsTestRequestCertificateItem(
content="content_example",
filename="filename_example",
updated_at="updated_at_example",
),
key=SyntheticsTestRequestCertificateItem(
content="content_example",
filename="filename_example",
updated_at="updated_at_example",
),
),
dns_server="dns_server_example",
headers=SyntheticsTestHeaders(
key="key_example",
),
host="host_example",
method=HTTPMethod("GET"),
port=1,
query={},
timeout=3.14,
url="url_example",
),
variables=[
SyntheticsBrowserVariable(
example="example_example",
id="id_example",
name="VARIABLE_NAME",
pattern="pattern_example",
type=SyntheticsBrowserVariableType("element"),
),
],
),
locations=[
"locations_example",
],
message="message_example",
monitor_id=1,
name="name_example",
options=SyntheticsTestOptions(
accept_self_signed=True,
allow_insecure=True,
device_ids=[
SyntheticsDeviceID("laptop_large"),
],
follow_redirects=True,
min_failure_duration=1,
min_location_failed=1,
monitor_options=SyntheticsTestOptionsMonitorOptions(
renotify_interval=0,
),
retry=SyntheticsTestOptionsRetry(
count=1,
interval=3.14,
),
tick_every=SyntheticsTickInterval(60),
),
public_id="public_id_example",
status=SyntheticsTestPauseStatus("live"),
steps=[
SyntheticsStep(
allow_failure=True,
name="name_example",
params={},
timeout=1,
type=SyntheticsStepType("assertCurrentUrl"),
),
],
subtype=SyntheticsTestDetailsSubType("http"),
tags=[
"tags_example",
],
type=SyntheticsTestDetailsType("api"),
) # SyntheticsTestDetails | Details of the test to create.
# example passing only required values which don't have defaults set
try:
# Create a test
api_response = api_instance.create_test(body)
pprint(api_response)
except datadog_api_client.v1.ApiException as e:
print("Exception when calling SyntheticsApi->create_test: %s\n" % e)
require 'time'
require 'datadog_api_client/v1'
# setup authorization
DatadogAPIClient::V1.configure do |config|
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['appKeyAuth'] = 'Bearer'
end
api_instance = DatadogAPIClient::V1::SyntheticsApi.new
body = DatadogAPIClient::V1::SyntheticsTestDetails.new # SyntheticsTestDetails | Details of the test to create.
begin
# Create a test
result = api_instance.create_test(body)
p result
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling SyntheticsApi->create_test: #{e}"
end
DELETE https://api.datadoghq.eu/api/v1/synthetics/variables/{variable_id}https://api.datadoghq.com/api/v1/synthetics/variables/{variable_id}
Supprimez une variable globale Synthetic.
Nom
Type
Description
variable_id [required]
string
The ID of the global variable.
OK
JSON format is wrong
Error response object.
{
"errors": [
"Bad Request"
]
}
Forbidden
Error response object.
{
"errors": [
"Bad Request"
]
}
Not found
Error response object.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export variable_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.datadoghq.eu"https://api.datadoghq.com/api/v1/synthetics/variables/${variable_id}" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main
import (
"context"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
variableId := "variableId_example" // string | The ID of the global variable.
configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
r, err := api_client.SyntheticsApi.DeleteGlobalVariable(ctx, variableId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.DeleteGlobalVariable``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.SyntheticsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
String variableId = "variableId_example"; // String | The ID of the global variable.
try {
apiInstance.deleteGlobalVariable(variableId)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#deleteGlobalVariable");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
import os
from dateutil.parser import parse as dateutil_parser
import datadog_api_client.v1
from datadog_api_client.v1.api import synthetics_api
from datadog_api_client.v1.models import *
from pprint import pprint
# Defining the host is optional and defaults to https://api.datadoghq.com
# See configuration.py for a list of all supported configuration parameters.
configuration = datadog_api_client.v1.Configuration(
host = "https://api.datadoghq.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['appKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with datadog_api_client.v1.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = synthetics_api.SyntheticsApi(api_client)
variable_id = "variable_id_example" # str | The ID of the global variable.
# example passing only required values which don't have defaults set
try:
# Delete a global variable
api_instance.delete_global_variable(variable_id)
except datadog_api_client.v1.ApiException as e:
print("Exception when calling SyntheticsApi->delete_global_variable: %s\n" % e)
require 'time'
require 'datadog_api_client/v1'
# setup authorization
DatadogAPIClient::V1.configure do |config|
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['appKeyAuth'] = 'Bearer'
end
api_instance = DatadogAPIClient::V1::SyntheticsApi.new
variable_id = 'variable_id_example' # String | The ID of the global variable.
begin
# Delete a global variable
api_instance.delete_global_variable(variable_id)
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling SyntheticsApi->delete_global_variable: #{e}"
end
DELETE https://api.datadoghq.eu/api/v1/synthetics/private-locations/{location_id}https://api.datadoghq.com/api/v1/synthetics/private-locations/{location_id}
Supprimez un emplacement privé Synthetic.
Nom
Type
Description
location_id [required]
string
The ID of the private location.
OK
- Private locations are not activated for the user - Private location does not exist
Error response object.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export location_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.datadoghq.eu"https://api.datadoghq.com/api/v1/synthetics/private-locations/${location_id}" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main
import (
"context"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
locationId := "locationId_example" // string | The ID of the private location.
configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
r, err := api_client.SyntheticsApi.DeletePrivateLocation(ctx, locationId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.DeletePrivateLocation``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.SyntheticsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
String locationId = "locationId_example"; // String | The ID of the private location.
try {
apiInstance.deletePrivateLocation(locationId)
.execute();
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#deletePrivateLocation");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
import os
from dateutil.parser import parse as dateutil_parser
import datadog_api_client.v1
from datadog_api_client.v1.api import synthetics_api
from datadog_api_client.v1.models import *
from pprint import pprint
# Defining the host is optional and defaults to https://api.datadoghq.com
# See configuration.py for a list of all supported configuration parameters.
configuration = datadog_api_client.v1.Configuration(
host = "https://api.datadoghq.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['appKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with datadog_api_client.v1.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = synthetics_api.SyntheticsApi(api_client)
location_id = "location_id_example" # str | The ID of the private location.
# example passing only required values which don't have defaults set
try:
# Delete a private location
api_instance.delete_private_location(location_id)
except datadog_api_client.v1.ApiException as e:
print("Exception when calling SyntheticsApi->delete_private_location: %s\n" % e)
require 'time'
require 'datadog_api_client/v1'
# setup authorization
DatadogAPIClient::V1.configure do |config|
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['appKeyAuth'] = 'Bearer'
end
api_instance = DatadogAPIClient::V1::SyntheticsApi.new
location_id = 'location_id_example' # String | The ID of the private location.
begin
# Delete a private location
api_instance.delete_private_location(location_id)
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling SyntheticsApi->delete_private_location: #{e}"
end
POST https://api.datadoghq.eu/api/v1/synthetics/tests/deletehttps://api.datadoghq.com/api/v1/synthetics/tests/delete
Supprimez plusieurs tests Synthetic à l’aide de leurs ID.
Liste des ID publics des tests Synthetic à supprimer.
{
"public_ids": [
[]
]
}
OK.
Response object for deleting Synthetic tests.
Champ
Type
Description
deleted_tests
[object]
Array of objects containing a deleted Synthetic test ID with the associated deletion timestamp.
deleted_at
date-time
Deletion timestamp of the Synthetic test ID.
public_id
string
The Synthetic test ID deleted.
{
"deleted_tests": [
{
"deleted_at": "2019-09-19T10:00:00.000Z",
"public_id": "string"
}
]
}
- JSON format is wrong - Test cannot be deleted as it's used elsewhere (as a sub-test or in an uptime widget) - Some IDs are not owned by the user
Error response object.
{
"errors": [
"Bad Request"
]
}
Forbidden
Error response object.
{
"errors": [
"Bad Request"
]
}
- Tests to be deleted can't be found - Synthetics is not activated for the user
Error response object.
{
"errors": [
"Bad Request"
]
}
# Curl command
curl -X POST "https://api.datadoghq.eu"https://api.datadoghq.com/api/v1/synthetics/tests/delete" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}" \
-d @- << EOF
{}
EOF
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
body := *datadog.NewSyntheticsDeleteTestsPayload() // SyntheticsDeleteTestsPayload | Public ID list of the Synthetic tests to be deleted.
configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.SyntheticsApi.DeleteTests(ctx).Body(body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.DeleteTests``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DeleteTests`: SyntheticsDeleteTestsResponse
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from SyntheticsApi.DeleteTests:\n%s\n", response_content)
}
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.SyntheticsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
SyntheticsDeleteTestsPayload body = new SyntheticsDeleteTestsPayload(); // SyntheticsDeleteTestsPayload | Public ID list of the Synthetic tests to be deleted.
try {
SyntheticsDeleteTestsResponse result = apiInstance.deleteTests()
.body(body)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#deleteTests");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
from datadog import initialize, api
options = {
'api_key': '<DATADOG_API_KEY>',
'app_key': '<DATADOG_APPLICATION_KEY>'
}
test_ids = ['<SYNTHETICS_TEST_PUBLIC_ID_1>','<SYNTHETICS_TEST_PUBLIC_ID_2>']
initialize(**options)
api.Synthetics.delete_test(public_ids=test_ids)
import os
from dateutil.parser import parse as dateutil_parser
import datadog_api_client.v1
from datadog_api_client.v1.api import synthetics_api
from datadog_api_client.v1.models import *
from pprint import pprint
# Defining the host is optional and defaults to https://api.datadoghq.com
# See configuration.py for a list of all supported configuration parameters.
configuration = datadog_api_client.v1.Configuration(
host = "https://api.datadoghq.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['appKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with datadog_api_client.v1.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = synthetics_api.SyntheticsApi(api_client)
body = SyntheticsDeleteTestsPayload(
public_ids=[],
) # SyntheticsDeleteTestsPayload | Public ID list of the Synthetic tests to be deleted.
# example passing only required values which don't have defaults set
try:
# Delete tests
api_response = api_instance.delete_tests(body)
pprint(api_response)
except datadog_api_client.v1.ApiException as e:
print("Exception when calling SyntheticsApi->delete_tests: %s\n" % e)
require 'dogapi'
api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'
dog = Dogapi::Client.new(api_key, app_key)
test_ids = ['<SYNTHETICS_TEST_PUBLIC_ID_1>','<SYNTHETICS_TEST_PUBLIC_ID_2>']
dog.delete_synthetics_tests('test_ids' => test_ids)
require 'time'
require 'datadog_api_client/v1'
# setup authorization
DatadogAPIClient::V1.configure do |config|
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['appKeyAuth'] = 'Bearer'
end
api_instance = DatadogAPIClient::V1::SyntheticsApi.new
body = DatadogAPIClient::V1::SyntheticsDeleteTestsPayload.new # SyntheticsDeleteTestsPayload | Public ID list of the Synthetic tests to be deleted.
begin
# Delete tests
result = api_instance.delete_tests(body)
p result
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling SyntheticsApi->delete_tests: #{e}"
end
PUT https://api.datadoghq.eu/api/v1/synthetics/variables/{variable_id}https://api.datadoghq.com/api/v1/synthetics/variables/{variable_id}
Modifiez une variable globale Synthetic.
Nom
Type
Description
variable_id [required]
string
The ID of the global variable.
Détails de la variable globale à mettre à jour.
Champ
Type
Description
description [required]
string
Description of the global variable.
id
string
Unique identifier of the global variable.
name [required]
string
Name of the global variable.
parse_test_options
object
Parser options to use for retrieving a Synthetics global variable from a Synthetics Test. Used in conjunction with parse_test_public_id
.
field
string
When type is http_header
, name of the header to use to extract the value.
parser [required]
object
Details of the parser to use for the global variable.
type [required]
enum
Type of parser for a Synthetics global variable from a synthetics test.
Allowed enum values: raw,json_path,regex
value
string
Regex or JSON path used for the parser. Not used with type raw
.
type [required]
enum
Property of the Synthetics Test Response to use for a Synthetics global variable.
Allowed enum values: http_body,http_header
parse_test_public_id
string
A Synthetic test ID to use as a test to generate the variable value.
tags [required]
[string]
Tags of the global variable.
value [required]
Value of the global variable.
secure
boolean
Determines if the variable is secure.
value [required]
string
Value of the global variable. When reading a global variable, the value will not be present if the variable is secure.
{
"description": "Example description",
"name": "MY_VARIABLE",
"parse_test_options": {
"field": "content-type",
"parser": {
"type": "string",
"value": "string"
},
"type": "string"
},
"parse_test_public_id": "abc-def-123",
"tags": [
"team:front",
"test:workflow-1"
],
"value": {
"secure": false,
"value": "example-value"
}
}
OK
Synthetics global variable.
Champ
Type
Description
description [required]
string
Description of the global variable.
id
string
Unique identifier of the global variable.
name [required]
string
Name of the global variable.
parse_test_options
object
Parser options to use for retrieving a Synthetics global variable from a Synthetics Test. Used in conjunction with parse_test_public_id
.
field
string
When type is http_header
, name of the header to use to extract the value.
parser [required]
object
Details of the parser to use for the global variable.
type [required]
enum
Type of parser for a Synthetics global variable from a synthetics test.
Allowed enum values: raw,json_path,regex
value
string
Regex or JSON path used for the parser. Not used with type raw
.
type [required]
enum
Property of the Synthetics Test Response to use for a Synthetics global variable.
Allowed enum values: http_body,http_header
parse_test_public_id
string
A Synthetic test ID to use as a test to generate the variable value.
tags [required]
[string]
Tags of the global variable.
value [required]
Value of the global variable.
secure
boolean
Determines if the variable is secure.
value [required]
string
Value of the global variable. When reading a global variable, the value will not be present if the variable is secure.
{
"description": "Example description",
"id": "string",
"name": "MY_VARIABLE",
"parse_test_options": {
"field": "content-type",
"parser": {
"type": "string",
"value": "string"
},
"type": "string"
},
"parse_test_public_id": "abc-def-123",
"tags": [
"team:front",
"test:workflow-1"
],
"value": {
"secure": false,
"value": "example-value"
}
}
Invalid request
Error response object.
{
"errors": [
"Bad Request"
]
}
Forbidden
Error response object.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export variable_id="CHANGE_ME"
# Curl command
curl -X PUT "https://api.datadoghq.eu"https://api.datadoghq.com/api/v1/synthetics/variables/${variable_id}" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}" \
-d @- << EOF
{
"description": "Example description",
"name": "MY_VARIABLE",
"parse_test_options": {
"parser": {
"type": null
},
"type": null
},
"tags": [
"team:front",
"test:workflow-1"
],
"value": {
"value": "example-value"
}
}
EOF
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
variableId := "variableId_example" // string | The ID of the global variable.
body := *datadog.NewSyntheticsGlobalVariable("Example description", "MY_VARIABLE", []string{"Tags_example"}, *datadog.NewSyntheticsGlobalVariableValue("example-value")) // SyntheticsGlobalVariable | Details of the global variable to update.
configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.SyntheticsApi.EditGlobalVariable(ctx, variableId).Body(body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.EditGlobalVariable``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `EditGlobalVariable`: SyntheticsGlobalVariable
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from SyntheticsApi.EditGlobalVariable:\n%s\n", response_content)
}
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.SyntheticsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
String variableId = "variableId_example"; // String | The ID of the global variable.
SyntheticsGlobalVariable body = new SyntheticsGlobalVariable(); // SyntheticsGlobalVariable | Details of the global variable to update.
try {
SyntheticsGlobalVariable result = apiInstance.editGlobalVariable(variableId)
.body(body)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#editGlobalVariable");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
import os
from dateutil.parser import parse as dateutil_parser
import datadog_api_client.v1
from datadog_api_client.v1.api import synthetics_api
from datadog_api_client.v1.models import *
from pprint import pprint
# Defining the host is optional and defaults to https://api.datadoghq.com
# See configuration.py for a list of all supported configuration parameters.
configuration = datadog_api_client.v1.Configuration(
host = "https://api.datadoghq.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['appKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with datadog_api_client.v1.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = synthetics_api.SyntheticsApi(api_client)
variable_id = "variable_id_example" # str | The ID of the global variable.
body = SyntheticsGlobalVariable(
description="Example description",
id="id_example",
name="MY_VARIABLE",
parse_test_options=SyntheticsGlobalVariableParseTestOptions(
field="content-type",
parser=SyntheticsGlobalVariableParseTestOptionsParser(
type=SyntheticsGlobalVariableParserType("raw"),
value="value_example",
),
type=SyntheticsGlobalVariableParseTestOptionsType("http_body"),
),
parse_test_public_id="abc-def-123",
tags=["team:front","test:workflow-1"],
value=SyntheticsGlobalVariableValue(
secure=True,
value="example-value",
),
) # SyntheticsGlobalVariable | Details of the global variable to update.
# example passing only required values which don't have defaults set
try:
# Edit a global variable
api_response = api_instance.edit_global_variable(variable_id, body)
pprint(api_response)
except datadog_api_client.v1.ApiException as e:
print("Exception when calling SyntheticsApi->edit_global_variable: %s\n" % e)
require 'time'
require 'datadog_api_client/v1'
# setup authorization
DatadogAPIClient::V1.configure do |config|
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['appKeyAuth'] = 'Bearer'
end
api_instance = DatadogAPIClient::V1::SyntheticsApi.new
variable_id = 'variable_id_example' # String | The ID of the global variable.
body = DatadogAPIClient::V1::SyntheticsGlobalVariable.new({description: 'Example description', name: 'MY_VARIABLE', tags: ['tags_example'], value: DatadogAPIClient::V1::SyntheticsGlobalVariableValue.new({value: 'example-value'})}) # SyntheticsGlobalVariable | Details of the global variable to update.
begin
# Edit a global variable
result = api_instance.edit_global_variable(variable_id, body)
p result
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling SyntheticsApi->edit_global_variable: #{e}"
end
PUT https://api.datadoghq.eu/api/v1/synthetics/private-locations/{location_id}https://api.datadoghq.com/api/v1/synthetics/private-locations/{location_id}
Modifiez un emplacement privé Synthetic.
Nom
Type
Description
location_id [required]
string
The ID of the private location.
Détails de l’emplacement privé à modifier.
Champ
Type
Description
description [required]
string
Description of the private location.
id
string
Unique identifier of the private location.
name [required]
string
Name of the private location.
secrets
object
Secrets for the private location. Only present in the response when creating the private location.
authentication
object
Authentication part of the secrets.
id
string
Access key for the private location.
key
string
Secret access key for the private location.
config_decryption
object
Private key for the private location.
key
string
Private key for the private location.
tags [required]
[string]
Array of tags attached to the private location.
{
"description": "Description of private location",
"name": "New private location",
"tags": [
"team:front"
]
}
OK
Object containing information about the private location to create.
Champ
Type
Description
description [required]
string
Description of the private location.
id
string
Unique identifier of the private location.
name [required]
string
Name of the private location.
secrets
object
Secrets for the private location. Only present in the response when creating the private location.
authentication
object
Authentication part of the secrets.
id
string
Access key for the private location.
key
string
Secret access key for the private location.
config_decryption
object
Private key for the private location.
key
string
Private key for the private location.
tags [required]
[string]
Array of tags attached to the private location.
{
"description": "Description of private location",
"id": "string",
"name": "New private location",
"secrets": {
"authentication": {
"id": "string",
"key": "string"
},
"config_decryption": {
"key": "string"
}
},
"tags": [
"team:front"
]
}
- Private locations are not activated for the user - Private location does not exist
Error response object.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export location_id="CHANGE_ME"
# Curl command
curl -X PUT "https://api.datadoghq.eu"https://api.datadoghq.com/api/v1/synthetics/private-locations/${location_id}" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}" \
-d @- << EOF
{
"description": "Description of private location",
"name": "New private location",
"tags": [
"team:front"
]
}
EOF
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
locationId := "locationId_example" // string | The ID of the private location.
body := *datadog.NewSyntheticsPrivateLocation("Description of private location", "New private location", []string{"team:front"}) // SyntheticsPrivateLocation | Details of the private location to be updated.
configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.SyntheticsApi.UpdatePrivateLocation(ctx, locationId).Body(body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.UpdatePrivateLocation``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UpdatePrivateLocation`: SyntheticsPrivateLocation
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from SyntheticsApi.UpdatePrivateLocation:\n%s\n", response_content)
}
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.SyntheticsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
String locationId = "locationId_example"; // String | The ID of the private location.
SyntheticsPrivateLocation body = new SyntheticsPrivateLocation(); // SyntheticsPrivateLocation | Details of the private location to be updated.
try {
SyntheticsPrivateLocation result = apiInstance.updatePrivateLocation(locationId)
.body(body)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#updatePrivateLocation");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
import os
from dateutil.parser import parse as dateutil_parser
import datadog_api_client.v1
from datadog_api_client.v1.api import synthetics_api
from datadog_api_client.v1.models import *
from pprint import pprint
# Defining the host is optional and defaults to https://api.datadoghq.com
# See configuration.py for a list of all supported configuration parameters.
configuration = datadog_api_client.v1.Configuration(
host = "https://api.datadoghq.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['appKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with datadog_api_client.v1.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = synthetics_api.SyntheticsApi(api_client)
location_id = "location_id_example" # str | The ID of the private location.
body = SyntheticsPrivateLocation(
description="Description of private location",
id="id_example",
name="New private location",
secrets=SyntheticsPrivateLocationSecrets(
authentication=SyntheticsPrivateLocationSecretsAuthentication(
id="id_example",
key="key_example",
),
config_decryption=SyntheticsPrivateLocationSecretsConfigDecryption(
key="key_example",
),
),
tags=["team:front"],
) # SyntheticsPrivateLocation | Details of the private location to be updated.
# example passing only required values which don't have defaults set
try:
# Edit a private location
api_response = api_instance.update_private_location(location_id, body)
pprint(api_response)
except datadog_api_client.v1.ApiException as e:
print("Exception when calling SyntheticsApi->update_private_location: %s\n" % e)
require 'time'
require 'datadog_api_client/v1'
# setup authorization
DatadogAPIClient::V1.configure do |config|
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['appKeyAuth'] = 'Bearer'
end
api_instance = DatadogAPIClient::V1::SyntheticsApi.new
location_id = 'location_id_example' # String | The ID of the private location.
body = DatadogAPIClient::V1::SyntheticsPrivateLocation.new({description: 'Description of private location', name: 'New private location', tags: ['team:front']}) # SyntheticsPrivateLocation | Details of the private location to be updated.
begin
# Edit a private location
result = api_instance.update_private_location(location_id, body)
p result
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling SyntheticsApi->update_private_location: #{e}"
end
PUT https://api.datadoghq.eu/api/v1/synthetics/tests/{public_id}https://api.datadoghq.com/api/v1/synthetics/tests/{public_id}
Modifiez la configuration d’un test Synthetic.
Nom
Type
Description
public_id [required]
string
The public ID of the test to get details from.
Nouveaux détails du test à enregistrer.
Champ
Type
Description
config
object
Configuration object for a Synthetic test.
assertions [required]
[object]
Array of assertions used for the test.
configVariables
[object]
API tests only - array of variables used for the test.
example [required]
string
Example for the variable.
name [required]
string
Name of the variable.
pattern
string
Pattern of the variable.
type [required]
enum
Type of the configuration variable.
Allowed enum values: text
request [required]
object
Object describing the Synthetic test request.
basicAuth
object
Object to handle basic authentication when performing the test.
password [required]
string
Password to use for the basic authentication.
username [required]
string
Username to use for the basic authentication.
body
string
Body to include in the test.
certificate
object
Client certificate to use when performing the test request.
cert
object
Define a request certificate.
content
string
Content of the certificate or key.
filename
string
File name for the certificate or key.
updatedAt
string
Date of update of the certificate or key, ISO format.
key
object
Define a request certificate.
content
string
Content of the certificate or key.
filename
string
File name for the certificate or key.
updatedAt
string
Date of update of the certificate or key, ISO format.
dnsServer
string
DNS server to use for DNS tests.
headers
object
Headers to include when performing the test.
<any-key>
string
A single Header.
host
string
Host name to perform the test with.
method
enum
The HTTP method.
Allowed enum values: GET,POST,PATCH,PUT,DELETE,HEAD,OPTIONS
port
int64
Port to use when performing the test.
query
object
Query to use for the test.
timeout
double
Timeout in seconds for the test.
url
string
URL to perform the test with.
variables
[object]
Browser tests only - array of variables used for the test steps.
example
string
Example for the variable.
id
string
ID for the variable.
name [required]
string
Name of the variable.
pattern
string
Pattern of the variable.
type [required]
enum
Type of browser test variable.
Allowed enum values: element,email,global,javascript,text
locations
[string]
Array of locations used to run the test.
message
string
Notification message associated with the test.
monitor_id
int64
The associated monitor ID.
name
string
Name of the test.
options
object
Object describing the extra options for a Synthetic test.
accept_self_signed
boolean
For SSL test, whether or not the test should allow self signed certificates.
allow_insecure
boolean
Allows loading insecure content for an HTTP request.
device_ids
[string]
For browser test, array with the different device IDs used to run the test.
follow_redirects
boolean
For API HTTP test, whether or not the test should follow redirects.
min_failure_duration
int64
Minimum amount of time in failure required to trigger an alert.
min_location_failed
int64
Minimum number of locations in failure required to trigger an alert.
monitor_options
object
Object containing the options for a Synthetic test as a monitor (for example, renotification).
renotify_interval
int64
Time interval before renotifying if the test is still failing (in minutes).
retry
object
Object describing the retry strategy to apply to a Synthetic test.
count
int64
Number of times a test needs to be retried before marking a location as failed. Defaults to 0.
interval
double
Time interval between retries (in milliseconds). Defaults to 300ms.
tick_every
enum
The frequency at which to run the Synthetic test (in seconds).
Allowed enum values: 60,300,900,1800,3600,21600,43200,86400,604800
public_id
string
The test public ID.
status
enum
Define whether you want to start (live
) or pause (paused
) a
Synthetic test.
Allowed enum values: live,paused
steps
[object]
For browser test, the steps of the test.
allowFailure
boolean
A boolean set to allow this step to fail.
name
string
The name of the step.
params
object
The parameters of the step.
timeout
int64
The time before declaring a step failed.
type
enum
Step type used in your Synthetic test.
Allowed enum values: assertCurrentUrl,assertElementAttribute,assertElementContent,assertElementPresent,assertEmail,assertFileDownload,assertFromJavascript,assertPageContains,assertPageLacks,click,extractFromJavascript,extractVariable,goToEmailLink,goToUrl,goToUrlAndMeasureTti,hover,playSubTest,pressKey,refresh,runApiTest,scroll,selectOption,typeText,uploadFiles,wait
subtype
enum
The sub-type of the Synthetic API test, http
, ssl
, tcp
or
dns
.
Allowed enum values: http,ssl,tcp,dns
tags
[string]
Array of tags attached to the test.
type
enum
Type of the Synthetic test, either api
or browser
.
Allowed enum values: api,browser
{
"config": {
"assertions": [
[]
],
"configVariables": [
{
"example": "string",
"name": "VARIABLE_NAME",
"pattern": "string",
"type": "string"
}
],
"request": {
"basicAuth": {
"password": "",
"username": ""
},
"body": "string",
"certificate": {
"cert": {
"content": "string",
"filename": "string",
"updatedAt": "string"
},
"key": {
"content": "string",
"filename": "string",
"updatedAt": "string"
}
},
"dnsServer": "string",
"headers": {
"<any-key>": "string"
},
"host": "string",
"method": "string",
"port": "integer",
"query": {},
"timeout": "number",
"url": "string"
},
"variables": [
{
"example": "string",
"id": "string",
"name": "VARIABLE_NAME",
"pattern": "string",
"type": "string"
}
]
},
"locations": [],
"message": "string",
"monitor_id": "integer",
"name": "string",
"options": {
"accept_self_signed": false,
"allow_insecure": false,
"device_ids": [],
"follow_redirects": false,
"min_failure_duration": "integer",
"min_location_failed": "integer",
"monitor_options": {
"renotify_interval": "integer"
},
"retry": {
"count": "integer",
"interval": "number"
},
"tick_every": "integer"
},
"public_id": "string",
"status": "string",
"steps": [
{
"allowFailure": false,
"name": "string",
"params": {},
"timeout": "integer",
"type": "string"
}
],
"subtype": "string",
"tags": [],
"type": "string"
}
OK
Object containing details about your Synthetic test.
Champ
Type
Description
config
object
Configuration object for a Synthetic test.
assertions [required]
[object]
Array of assertions used for the test.
configVariables
[object]
API tests only - array of variables used for the test.
example [required]
string
Example for the variable.
name [required]
string
Name of the variable.
pattern
string
Pattern of the variable.
type [required]
enum
Type of the configuration variable.
Allowed enum values: text
request [required]
object
Object describing the Synthetic test request.
basicAuth
object
Object to handle basic authentication when performing the test.
password [required]
string
Password to use for the basic authentication.
username [required]
string
Username to use for the basic authentication.
body
string
Body to include in the test.
certificate
object
Client certificate to use when performing the test request.
cert
object
Define a request certificate.
content
string
Content of the certificate or key.
filename
string
File name for the certificate or key.
updatedAt
string
Date of update of the certificate or key, ISO format.
key
object
Define a request certificate.
content
string
Content of the certificate or key.
filename
string
File name for the certificate or key.
updatedAt
string
Date of update of the certificate or key, ISO format.
dnsServer
string
DNS server to use for DNS tests.
headers
object
Headers to include when performing the test.
<any-key>
string
A single Header.
host
string
Host name to perform the test with.
method
enum
The HTTP method.
Allowed enum values: GET,POST,PATCH,PUT,DELETE,HEAD,OPTIONS
port
int64
Port to use when performing the test.
query
object
Query to use for the test.
timeout
double
Timeout in seconds for the test.
url
string
URL to perform the test with.
variables
[object]
Browser tests only - array of variables used for the test steps.
example
string
Example for the variable.
id
string
ID for the variable.
name [required]
string
Name of the variable.
pattern
string
Pattern of the variable.
type [required]
enum
Type of browser test variable.
Allowed enum values: element,email,global,javascript,text
locations
[string]
Array of locations used to run the test.
message
string
Notification message associated with the test.
monitor_id
int64
The associated monitor ID.
name
string
Name of the test.
options
object
Object describing the extra options for a Synthetic test.
accept_self_signed
boolean
For SSL test, whether or not the test should allow self signed certificates.
allow_insecure
boolean
Allows loading insecure content for an HTTP request.
device_ids
[string]
For browser test, array with the different device IDs used to run the test.
follow_redirects
boolean
For API HTTP test, whether or not the test should follow redirects.
min_failure_duration
int64
Minimum amount of time in failure required to trigger an alert.
min_location_failed
int64
Minimum number of locations in failure required to trigger an alert.
monitor_options
object
Object containing the options for a Synthetic test as a monitor (for example, renotification).
renotify_interval
int64
Time interval before renotifying if the test is still failing (in minutes).
retry
object
Object describing the retry strategy to apply to a Synthetic test.
count
int64
Number of times a test needs to be retried before marking a location as failed. Defaults to 0.
interval
double
Time interval between retries (in milliseconds). Defaults to 300ms.
tick_every
enum
The frequency at which to run the Synthetic test (in seconds).
Allowed enum values: 60,300,900,1800,3600,21600,43200,86400,604800
public_id
string
The test public ID.
status
enum
Define whether you want to start (live
) or pause (paused
) a
Synthetic test.
Allowed enum values: live,paused
steps
[object]
For browser test, the steps of the test.
allowFailure
boolean
A boolean set to allow this step to fail.
name
string
The name of the step.
params
object
The parameters of the step.
timeout
int64
The time before declaring a step failed.
type
enum
Step type used in your Synthetic test.
Allowed enum values: assertCurrentUrl,assertElementAttribute,assertElementContent,assertElementPresent,assertEmail,assertFileDownload,assertFromJavascript,assertPageContains,assertPageLacks,click,extractFromJavascript,extractVariable,goToEmailLink,goToUrl,goToUrlAndMeasureTti,hover,playSubTest,pressKey,refresh,runApiTest,scroll,selectOption,typeText,uploadFiles,wait
subtype
enum
The sub-type of the Synthetic API test, http
, ssl
, tcp
or
dns
.
Allowed enum values: http,ssl,tcp,dns
tags
[string]
Array of tags attached to the test.
type
enum
Type of the Synthetic test, either api
or browser
.
Allowed enum values: api,browser
{
"config": {
"assertions": [
[]
],
"configVariables": [
{
"example": "string",
"name": "VARIABLE_NAME",
"pattern": "string",
"type": "string"
}
],
"request": {
"basicAuth": {
"password": "",
"username": ""
},
"body": "string",
"certificate": {
"cert": {
"content": "string",
"filename": "string",
"updatedAt": "string"
},
"key": {
"content": "string",
"filename": "string",
"updatedAt": "string"
}
},
"dnsServer": "string",
"headers": {
"<any-key>": "string"
},
"host": "string",
"method": "string",
"port": "integer",
"query": {},
"timeout": "number",
"url": "string"
},
"variables": [
{
"example": "string",
"id": "string",
"name": "VARIABLE_NAME",
"pattern": "string",
"type": "string"
}
]
},
"locations": [],
"message": "string",
"monitor_id": "integer",
"name": "string",
"options": {
"accept_self_signed": false,
"allow_insecure": false,
"device_ids": [],
"follow_redirects": false,
"min_failure_duration": "integer",
"min_location_failed": "integer",
"monitor_options": {
"renotify_interval": "integer"
},
"retry": {
"count": "integer",
"interval": "number"
},
"tick_every": "integer"
},
"public_id": "string",
"status": "string",
"steps": [
{
"allowFailure": false,
"name": "string",
"params": {},
"timeout": "integer",
"type": "string"
}
],
"subtype": "string",
"tags": [],
"type": "string"
}
- JSON format is wrong - Updating sub-type is forbidden
Error response object.
{
"errors": [
"Bad Request"
]
}
Forbidden
Error response object.
{
"errors": [
"Bad Request"
]
}
- Synthetic is not activated for the user - Test is not owned by the user - Test can't be found
Error response object.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export public_id="CHANGE_ME"
# Curl command
curl -X PUT "https://api.datadoghq.eu"https://api.datadoghq.com/api/v1/synthetics/tests/${public_id}" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}" \
-d @- << EOF
{
"config": {
"assertions": [
null
],
"configVariables": [
{
"example": null,
"name": "VARIABLE_NAME",
"type": null
}
],
"request": {
"basicAuth": {
"password": "",
"username": ""
}
},
"variables": [
{
"name": "VARIABLE_NAME",
"type": null
}
]
}
}
EOF
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
publicId := "publicId_example" // string | The public ID of the test to get details from.
body := *datadog.NewSyntheticsTestDetails() // SyntheticsTestDetails | New test details to be saved.
configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.SyntheticsApi.UpdateTest(ctx, publicId).Body(body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.UpdateTest``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UpdateTest`: SyntheticsTestDetails
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from SyntheticsApi.UpdateTest:\n%s\n", response_content)
}
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.SyntheticsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
String publicId = "publicId_example"; // String | The public ID of the test to get details from.
SyntheticsTestDetails body = new SyntheticsTestDetails(); // SyntheticsTestDetails | New test details to be saved.
try {
SyntheticsTestDetails result = apiInstance.updateTest(publicId)
.body(body)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#updateTest");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
import os
from dateutil.parser import parse as dateutil_parser
import datadog_api_client.v1
from datadog_api_client.v1.api import synthetics_api
from datadog_api_client.v1.models import *
from pprint import pprint
# Defining the host is optional and defaults to https://api.datadoghq.com
# See configuration.py for a list of all supported configuration parameters.
configuration = datadog_api_client.v1.Configuration(
host = "https://api.datadoghq.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['appKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with datadog_api_client.v1.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = synthetics_api.SyntheticsApi(api_client)
public_id = "public_id_example" # str | The public ID of the test to get details from.
body = SyntheticsTestDetails(
config=SyntheticsTestConfig(
assertions=[],
config_variables=[
SyntheticsConfigVariable(
example="example_example",
name="VARIABLE_NAME",
pattern="pattern_example",
type=SyntheticsConfigVariableType("text"),
),
],
request=SyntheticsTestRequest(
basic_auth=SyntheticsBasicAuth(
password="",
username="",
),
body="body_example",
certificate=SyntheticsTestRequestCertificate(
cert=SyntheticsTestRequestCertificateItem(
content="content_example",
filename="filename_example",
updated_at="updated_at_example",
),
key=SyntheticsTestRequestCertificateItem(
content="content_example",
filename="filename_example",
updated_at="updated_at_example",
),
),
dns_server="dns_server_example",
headers=SyntheticsTestHeaders(
key="key_example",
),
host="host_example",
method=HTTPMethod("GET"),
port=1,
query={},
timeout=3.14,
url="url_example",
),
variables=[
SyntheticsBrowserVariable(
example="example_example",
id="id_example",
name="VARIABLE_NAME",
pattern="pattern_example",
type=SyntheticsBrowserVariableType("element"),
),
],
),
locations=[
"locations_example",
],
message="message_example",
monitor_id=1,
name="name_example",
options=SyntheticsTestOptions(
accept_self_signed=True,
allow_insecure=True,
device_ids=[
SyntheticsDeviceID("laptop_large"),
],
follow_redirects=True,
min_failure_duration=1,
min_location_failed=1,
monitor_options=SyntheticsTestOptionsMonitorOptions(
renotify_interval=0,
),
retry=SyntheticsTestOptionsRetry(
count=1,
interval=3.14,
),
tick_every=SyntheticsTickInterval(60),
),
public_id="public_id_example",
status=SyntheticsTestPauseStatus("live"),
steps=[
SyntheticsStep(
allow_failure=True,
name="name_example",
params={},
timeout=1,
type=SyntheticsStepType("assertCurrentUrl"),
),
],
subtype=SyntheticsTestDetailsSubType("http"),
tags=[
"tags_example",
],
type=SyntheticsTestDetailsType("api"),
) # SyntheticsTestDetails | New test details to be saved.
# example passing only required values which don't have defaults set
try:
# Edit a test
api_response = api_instance.update_test(public_id, body)
pprint(api_response)
except datadog_api_client.v1.ApiException as e:
print("Exception when calling SyntheticsApi->update_test: %s\n" % e)
require 'time'
require 'datadog_api_client/v1'
# setup authorization
DatadogAPIClient::V1.configure do |config|
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['appKeyAuth'] = 'Bearer'
end
api_instance = DatadogAPIClient::V1::SyntheticsApi.new
public_id = 'public_id_example' # String | The public ID of the test to get details from.
body = DatadogAPIClient::V1::SyntheticsTestDetails.new # SyntheticsTestDetails | New test details to be saved.
begin
# Edit a test
result = api_instance.update_test(public_id, body)
p result
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling SyntheticsApi->update_test: #{e}"
end
GET https://api.datadoghq.eu/api/v1/synthetics/variables/{variable_id}https://api.datadoghq.com/api/v1/synthetics/variables/{variable_id}
Récupérez la configuration détaillée d’une variable globale.
Nom
Type
Description
variable_id [required]
string
The ID of the global variable.
OK
Synthetics global variable.
Champ
Type
Description
description [required]
string
Description of the global variable.
id
string
Unique identifier of the global variable.
name [required]
string
Name of the global variable.
parse_test_options
object
Parser options to use for retrieving a Synthetics global variable from a Synthetics Test. Used in conjunction with parse_test_public_id
.
field
string
When type is http_header
, name of the header to use to extract the value.
parser [required]
object
Details of the parser to use for the global variable.
type [required]
enum
Type of parser for a Synthetics global variable from a synthetics test.
Allowed enum values: raw,json_path,regex
value
string
Regex or JSON path used for the parser. Not used with type raw
.
type [required]
enum
Property of the Synthetics Test Response to use for a Synthetics global variable.
Allowed enum values: http_body,http_header
parse_test_public_id
string
A Synthetic test ID to use as a test to generate the variable value.
tags [required]
[string]
Tags of the global variable.
value [required]
Value of the global variable.
secure
boolean
Determines if the variable is secure.
value [required]
string
Value of the global variable. When reading a global variable, the value will not be present if the variable is secure.
{
"description": "Example description",
"id": "string",
"name": "MY_VARIABLE",
"parse_test_options": {
"field": "content-type",
"parser": {
"type": "string",
"value": "string"
},
"type": "string"
},
"parse_test_public_id": "abc-def-123",
"tags": [
"team:front",
"test:workflow-1"
],
"value": {
"secure": false,
"value": "example-value"
}
}
Forbidden
Error response object.
{
"errors": [
"Bad Request"
]
}
Not found
Error response object.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export variable_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.datadoghq.eu"https://api.datadoghq.com/api/v1/synthetics/variables/${variable_id}" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
variableId := "variableId_example" // string | The ID of the global variable.
configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.SyntheticsApi.GetGlobalVariable(ctx, variableId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.GetGlobalVariable``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetGlobalVariable`: SyntheticsGlobalVariable
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from SyntheticsApi.GetGlobalVariable:\n%s\n", response_content)
}
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.SyntheticsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
String variableId = "variableId_example"; // String | The ID of the global variable.
try {
SyntheticsGlobalVariable result = apiInstance.getGlobalVariable(variableId)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#getGlobalVariable");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
import os
from dateutil.parser import parse as dateutil_parser
import datadog_api_client.v1
from datadog_api_client.v1.api import synthetics_api
from datadog_api_client.v1.models import *
from pprint import pprint
# Defining the host is optional and defaults to https://api.datadoghq.com
# See configuration.py for a list of all supported configuration parameters.
configuration = datadog_api_client.v1.Configuration(
host = "https://api.datadoghq.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['appKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with datadog_api_client.v1.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = synthetics_api.SyntheticsApi(api_client)
variable_id = "variable_id_example" # str | The ID of the global variable.
# example passing only required values which don't have defaults set
try:
# Get a global variable
api_response = api_instance.get_global_variable(variable_id)
pprint(api_response)
except datadog_api_client.v1.ApiException as e:
print("Exception when calling SyntheticsApi->get_global_variable: %s\n" % e)
require 'time'
require 'datadog_api_client/v1'
# setup authorization
DatadogAPIClient::V1.configure do |config|
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['appKeyAuth'] = 'Bearer'
end
api_instance = DatadogAPIClient::V1::SyntheticsApi.new
variable_id = 'variable_id_example' # String | The ID of the global variable.
begin
# Get a global variable
result = api_instance.get_global_variable(variable_id)
p result
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling SyntheticsApi->get_global_variable: #{e}"
end
GET https://api.datadoghq.eu/api/v1/synthetics/private-locations/{location_id}https://api.datadoghq.com/api/v1/synthetics/private-locations/{location_id}
Récupérez un emplacement privé Synthetic.
Nom
Type
Description
location_id [required]
string
The ID of the private location.
OK
Object containing information about the private location to create.
Champ
Type
Description
description [required]
string
Description of the private location.
id
string
Unique identifier of the private location.
name [required]
string
Name of the private location.
secrets
object
Secrets for the private location. Only present in the response when creating the private location.
authentication
object
Authentication part of the secrets.
id
string
Access key for the private location.
key
string
Secret access key for the private location.
config_decryption
object
Private key for the private location.
key
string
Private key for the private location.
tags [required]
[string]
Array of tags attached to the private location.
{
"description": "Description of private location",
"id": "string",
"name": "New private location",
"secrets": {
"authentication": {
"id": "string",
"key": "string"
},
"config_decryption": {
"key": "string"
}
},
"tags": [
"team:front"
]
}
- Synthetic private locations are not activated for the user - Private location does not exist
Error response object.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export location_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.datadoghq.eu"https://api.datadoghq.com/api/v1/synthetics/private-locations/${location_id}" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
locationId := "locationId_example" // string | The ID of the private location.
configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.SyntheticsApi.GetPrivateLocation(ctx, locationId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.GetPrivateLocation``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetPrivateLocation`: SyntheticsPrivateLocation
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from SyntheticsApi.GetPrivateLocation:\n%s\n", response_content)
}
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.SyntheticsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
String locationId = "locationId_example"; // String | The ID of the private location.
try {
SyntheticsPrivateLocation result = apiInstance.getPrivateLocation(locationId)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#getPrivateLocation");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
import os
from dateutil.parser import parse as dateutil_parser
import datadog_api_client.v1
from datadog_api_client.v1.api import synthetics_api
from datadog_api_client.v1.models import *
from pprint import pprint
# Defining the host is optional and defaults to https://api.datadoghq.com
# See configuration.py for a list of all supported configuration parameters.
configuration = datadog_api_client.v1.Configuration(
host = "https://api.datadoghq.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['appKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with datadog_api_client.v1.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = synthetics_api.SyntheticsApi(api_client)
location_id = "location_id_example" # str | The ID of the private location.
# example passing only required values which don't have defaults set
try:
# Get a private location
api_response = api_instance.get_private_location(location_id)
pprint(api_response)
except datadog_api_client.v1.ApiException as e:
print("Exception when calling SyntheticsApi->get_private_location: %s\n" % e)
require 'time'
require 'datadog_api_client/v1'
# setup authorization
DatadogAPIClient::V1.configure do |config|
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['appKeyAuth'] = 'Bearer'
end
api_instance = DatadogAPIClient::V1::SyntheticsApi.new
location_id = 'location_id_example' # String | The ID of the private location.
begin
# Get a private location
result = api_instance.get_private_location(location_id)
p result
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling SyntheticsApi->get_private_location: #{e}"
end
GET https://api.datadoghq.eu/api/v1/synthetics/tests/{public_id}https://api.datadoghq.com/api/v1/synthetics/tests/{public_id}
Récupérez la configuration détaillée associée à un test Synthetic.
Nom
Type
Description
public_id [required]
string
The public ID of the test to get details from.
OK
Object containing details about your Synthetic test.
Champ
Type
Description
config
object
Configuration object for a Synthetic test.
assertions [required]
[object]
Array of assertions used for the test.
configVariables
[object]
API tests only - array of variables used for the test.
example [required]
string
Example for the variable.
name [required]
string
Name of the variable.
pattern
string
Pattern of the variable.
type [required]
enum
Type of the configuration variable.
Allowed enum values: text
request [required]
object
Object describing the Synthetic test request.
basicAuth
object
Object to handle basic authentication when performing the test.
password [required]
string
Password to use for the basic authentication.
username [required]
string
Username to use for the basic authentication.
body
string
Body to include in the test.
certificate
object
Client certificate to use when performing the test request.
cert
object
Define a request certificate.
content
string
Content of the certificate or key.
filename
string
File name for the certificate or key.
updatedAt
string
Date of update of the certificate or key, ISO format.
key
object
Define a request certificate.
content
string
Content of the certificate or key.
filename
string
File name for the certificate or key.
updatedAt
string
Date of update of the certificate or key, ISO format.
dnsServer
string
DNS server to use for DNS tests.
headers
object
Headers to include when performing the test.
<any-key>
string
A single Header.
host
string
Host name to perform the test with.
method
enum
The HTTP method.
Allowed enum values: GET,POST,PATCH,PUT,DELETE,HEAD,OPTIONS
port
int64
Port to use when performing the test.
query
object
Query to use for the test.
timeout
double
Timeout in seconds for the test.
url
string
URL to perform the test with.
variables
[object]
Browser tests only - array of variables used for the test steps.
example
string
Example for the variable.
id
string
ID for the variable.
name [required]
string
Name of the variable.
pattern
string
Pattern of the variable.
type [required]
enum
Type of browser test variable.
Allowed enum values: element,email,global,javascript,text
locations
[string]
Array of locations used to run the test.
message
string
Notification message associated with the test.
monitor_id
int64
The associated monitor ID.
name
string
Name of the test.
options
object
Object describing the extra options for a Synthetic test.
accept_self_signed
boolean
For SSL test, whether or not the test should allow self signed certificates.
allow_insecure
boolean
Allows loading insecure content for an HTTP request.
device_ids
[string]
For browser test, array with the different device IDs used to run the test.
follow_redirects
boolean
For API HTTP test, whether or not the test should follow redirects.
min_failure_duration
int64
Minimum amount of time in failure required to trigger an alert.
min_location_failed
int64
Minimum number of locations in failure required to trigger an alert.
monitor_options
object
Object containing the options for a Synthetic test as a monitor (for example, renotification).
renotify_interval
int64
Time interval before renotifying if the test is still failing (in minutes).
retry
object
Object describing the retry strategy to apply to a Synthetic test.
count
int64
Number of times a test needs to be retried before marking a location as failed. Defaults to 0.
interval
double
Time interval between retries (in milliseconds). Defaults to 300ms.
tick_every
enum
The frequency at which to run the Synthetic test (in seconds).
Allowed enum values: 60,300,900,1800,3600,21600,43200,86400,604800
public_id
string
The test public ID.
status
enum
Define whether you want to start (live
) or pause (paused
) a
Synthetic test.
Allowed enum values: live,paused
steps
[object]
For browser test, the steps of the test.
allowFailure
boolean
A boolean set to allow this step to fail.
name
string
The name of the step.
params
object
The parameters of the step.
timeout
int64
The time before declaring a step failed.
type
enum
Step type used in your Synthetic test.
Allowed enum values: assertCurrentUrl,assertElementAttribute,assertElementContent,assertElementPresent,assertEmail,assertFileDownload,assertFromJavascript,assertPageContains,assertPageLacks,click,extractFromJavascript,extractVariable,goToEmailLink,goToUrl,goToUrlAndMeasureTti,hover,playSubTest,pressKey,refresh,runApiTest,scroll,selectOption,typeText,uploadFiles,wait
subtype
enum
The sub-type of the Synthetic API test, http
, ssl
, tcp
or
dns
.
Allowed enum values: http,ssl,tcp,dns
tags
[string]
Array of tags attached to the test.
type
enum
Type of the Synthetic test, either api
or browser
.
Allowed enum values: api,browser
{
"config": {
"assertions": [
[]
],
"configVariables": [
{
"example": "string",
"name": "VARIABLE_NAME",
"pattern": "string",
"type": "string"
}
],
"request": {
"basicAuth": {
"password": "",
"username": ""
},
"body": "string",
"certificate": {
"cert": {
"content": "string",
"filename": "string",
"updatedAt": "string"
},
"key": {
"content": "string",
"filename": "string",
"updatedAt": "string"
}
},
"dnsServer": "string",
"headers": {
"<any-key>": "string"
},
"host": "string",
"method": "string",
"port": "integer",
"query": {},
"timeout": "number",
"url": "string"
},
"variables": [
{
"example": "string",
"id": "string",
"name": "VARIABLE_NAME",
"pattern": "string",
"type": "string"
}
]
},
"locations": [],
"message": "string",
"monitor_id": "integer",
"name": "string",
"options": {
"accept_self_signed": false,
"allow_insecure": false,
"device_ids": [],
"follow_redirects": false,
"min_failure_duration": "integer",
"min_location_failed": "integer",
"monitor_options": {
"renotify_interval": "integer"
},
"retry": {
"count": "integer",
"interval": "number"
},
"tick_every": "integer"
},
"public_id": "string",
"status": "string",
"steps": [
{
"allowFailure": false,
"name": "string",
"params": {},
"timeout": "integer",
"type": "string"
}
],
"subtype": "string",
"tags": [],
"type": "string"
}
Forbidden
Error response object.
{
"errors": [
"Bad Request"
]
}
- Synthetic is not activated for the user - Test is not owned by the user
Error response object.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export public_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.datadoghq.eu"https://api.datadoghq.com/api/v1/synthetics/tests/${public_id}" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
publicId := "publicId_example" // string | The public ID of the test to get details from.
configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.SyntheticsApi.GetTest(ctx, publicId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.GetTest``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetTest`: SyntheticsTestDetails
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from SyntheticsApi.GetTest:\n%s\n", response_content)
}
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.SyntheticsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
String publicId = "publicId_example"; // String | The public ID of the test to get details from.
try {
SyntheticsTestDetails result = apiInstance.getTest(publicId)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#getTest");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
from datadog import initialize, api
options = {
'api_key': '<DATADOG_API_KEY>',
'app_key': '<DATADOG_APPLICATION_KEY>'
}
test_id = '<SYNTHETICS_TEST_PUBLIC_ID>'
initialize(**options)
api.Synthetics.get_test(id=test_id)
import os
from dateutil.parser import parse as dateutil_parser
import datadog_api_client.v1
from datadog_api_client.v1.api import synthetics_api
from datadog_api_client.v1.models import *
from pprint import pprint
# Defining the host is optional and defaults to https://api.datadoghq.com
# See configuration.py for a list of all supported configuration parameters.
configuration = datadog_api_client.v1.Configuration(
host = "https://api.datadoghq.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['appKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with datadog_api_client.v1.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = synthetics_api.SyntheticsApi(api_client)
public_id = "public_id_example" # str | The public ID of the test to get details from.
# example passing only required values which don't have defaults set
try:
# Get a test configuration (API)
api_response = api_instance.get_test(public_id)
pprint(api_response)
except datadog_api_client.v1.ApiException as e:
print("Exception when calling SyntheticsApi->get_test: %s\n" % e)
require 'dogapi'
api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'
test_id = '<SYNTHETICS_TEST_PUBLIC_ID>'
dog = Dogapi::Client.new(api_key, app_key)
dog.get_synthetics_test('test_id' => test_id)
require 'time'
require 'datadog_api_client/v1'
# setup authorization
DatadogAPIClient::V1.configure do |config|
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['appKeyAuth'] = 'Bearer'
end
api_instance = DatadogAPIClient::V1::SyntheticsApi.new
public_id = 'public_id_example' # String | The public ID of the test to get details from.
begin
# Get a test configuration (API)
result = api_instance.get_test(public_id)
p result
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling SyntheticsApi->get_test: #{e}"
end
GET https://api.datadoghq.eu/api/v1/synthetics/tests/browser/{public_id}https://api.datadoghq.com/api/v1/synthetics/tests/browser/{public_id}
Récupérez la configuration détaillée (y compris les étapes) associée à un test Browser Synthetic.
Nom
Type
Description
public_id [required]
string
The public ID of the test to get details from.
OK
Object containing details about your Synthetic test.
Champ
Type
Description
config
object
Configuration object for a Synthetic test.
assertions [required]
[object]
Array of assertions used for the test.
configVariables
[object]
API tests only - array of variables used for the test.
example [required]
string
Example for the variable.
name [required]
string
Name of the variable.
pattern
string
Pattern of the variable.
type [required]
enum
Type of the configuration variable.
Allowed enum values: text
request [required]
object
Object describing the Synthetic test request.
basicAuth
object
Object to handle basic authentication when performing the test.
password [required]
string
Password to use for the basic authentication.
username [required]
string
Username to use for the basic authentication.
body
string
Body to include in the test.
certificate
object
Client certificate to use when performing the test request.
cert
object
Define a request certificate.
content
string
Content of the certificate or key.
filename
string
File name for the certificate or key.
updatedAt
string
Date of update of the certificate or key, ISO format.
key
object
Define a request certificate.
content
string
Content of the certificate or key.
filename
string
File name for the certificate or key.
updatedAt
string
Date of update of the certificate or key, ISO format.
dnsServer
string
DNS server to use for DNS tests.
headers
object
Headers to include when performing the test.
<any-key>
string
A single Header.
host
string
Host name to perform the test with.
method
enum
The HTTP method.
Allowed enum values: GET,POST,PATCH,PUT,DELETE,HEAD,OPTIONS
port
int64
Port to use when performing the test.
query
object
Query to use for the test.
timeout
double
Timeout in seconds for the test.
url
string
URL to perform the test with.
variables
[object]
Browser tests only - array of variables used for the test steps.
example
string
Example for the variable.
id
string
ID for the variable.
name [required]
string
Name of the variable.
pattern
string
Pattern of the variable.
type [required]
enum
Type of browser test variable.
Allowed enum values: element,email,global,javascript,text
locations
[string]
Array of locations used to run the test.
message
string
Notification message associated with the test.
monitor_id
int64
The associated monitor ID.
name
string
Name of the test.
options
object
Object describing the extra options for a Synthetic test.
accept_self_signed
boolean
For SSL test, whether or not the test should allow self signed certificates.
allow_insecure
boolean
Allows loading insecure content for an HTTP request.
device_ids
[string]
For browser test, array with the different device IDs used to run the test.
follow_redirects
boolean
For API HTTP test, whether or not the test should follow redirects.
min_failure_duration
int64
Minimum amount of time in failure required to trigger an alert.
min_location_failed
int64
Minimum number of locations in failure required to trigger an alert.
monitor_options
object
Object containing the options for a Synthetic test as a monitor (for example, renotification).
renotify_interval
int64
Time interval before renotifying if the test is still failing (in minutes).
retry
object
Object describing the retry strategy to apply to a Synthetic test.
count
int64
Number of times a test needs to be retried before marking a location as failed. Defaults to 0.
interval
double
Time interval between retries (in milliseconds). Defaults to 300ms.
tick_every
enum
The frequency at which to run the Synthetic test (in seconds).
Allowed enum values: 60,300,900,1800,3600,21600,43200,86400,604800
public_id
string
The test public ID.
status
enum
Define whether you want to start (live
) or pause (paused
) a
Synthetic test.
Allowed enum values: live,paused
steps
[object]
For browser test, the steps of the test.
allowFailure
boolean
A boolean set to allow this step to fail.
name
string
The name of the step.
params
object
The parameters of the step.
timeout
int64
The time before declaring a step failed.
type
enum
Step type used in your Synthetic test.
Allowed enum values: assertCurrentUrl,assertElementAttribute,assertElementContent,assertElementPresent,assertEmail,assertFileDownload,assertFromJavascript,assertPageContains,assertPageLacks,click,extractFromJavascript,extractVariable,goToEmailLink,goToUrl,goToUrlAndMeasureTti,hover,playSubTest,pressKey,refresh,runApiTest,scroll,selectOption,typeText,uploadFiles,wait
subtype
enum
The sub-type of the Synthetic API test, http
, ssl
, tcp
or
dns
.
Allowed enum values: http,ssl,tcp,dns
tags
[string]
Array of tags attached to the test.
type
enum
Type of the Synthetic test, either api
or browser
.
Allowed enum values: api,browser
{
"config": {
"assertions": [
[]
],
"configVariables": [
{
"example": "string",
"name": "VARIABLE_NAME",
"pattern": "string",
"type": "string"
}
],
"request": {
"basicAuth": {
"password": "",
"username": ""
},
"body": "string",
"certificate": {
"cert": {
"content": "string",
"filename": "string",
"updatedAt": "string"
},
"key": {
"content": "string",
"filename": "string",
"updatedAt": "string"
}
},
"dnsServer": "string",
"headers": {
"<any-key>": "string"
},
"host": "string",
"method": "string",
"port": "integer",
"query": {},
"timeout": "number",
"url": "string"
},
"variables": [
{
"example": "string",
"id": "string",
"name": "VARIABLE_NAME",
"pattern": "string",
"type": "string"
}
]
},
"locations": [],
"message": "string",
"monitor_id": "integer",
"name": "string",
"options": {
"accept_self_signed": false,
"allow_insecure": false,
"device_ids": [],
"follow_redirects": false,
"min_failure_duration": "integer",
"min_location_failed": "integer",
"monitor_options": {
"renotify_interval": "integer"
},
"retry": {
"count": "integer",
"interval": "number"
},
"tick_every": "integer"
},
"public_id": "string",
"status": "string",
"steps": [
{
"allowFailure": false,
"name": "string",
"params": {},
"timeout": "integer",
"type": "string"
}
],
"subtype": "string",
"tags": [],
"type": "string"
}
Forbidden
Error response object.
{
"errors": [
"Bad Request"
]
}
- Synthetic is not activated for the user - Test is not owned by the user
Error response object.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export public_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.datadoghq.eu"https://api.datadoghq.com/api/v1/synthetics/tests/browser/${public_id}" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
publicId := "publicId_example" // string | The public ID of the test to get details from.
configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.SyntheticsApi.GetBrowserTest(ctx, publicId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.GetBrowserTest``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetBrowserTest`: SyntheticsTestDetails
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from SyntheticsApi.GetBrowserTest:\n%s\n", response_content)
}
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.SyntheticsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
String publicId = "publicId_example"; // String | The public ID of the test to get details from.
try {
SyntheticsTestDetails result = apiInstance.getBrowserTest(publicId)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#getBrowserTest");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
import os
from dateutil.parser import parse as dateutil_parser
import datadog_api_client.v1
from datadog_api_client.v1.api import synthetics_api
from datadog_api_client.v1.models import *
from pprint import pprint
# Defining the host is optional and defaults to https://api.datadoghq.com
# See configuration.py for a list of all supported configuration parameters.
configuration = datadog_api_client.v1.Configuration(
host = "https://api.datadoghq.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['appKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with datadog_api_client.v1.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = synthetics_api.SyntheticsApi(api_client)
public_id = "public_id_example" # str | The public ID of the test to get details from.
# example passing only required values which don't have defaults set
try:
# Get a test configuration (browser)
api_response = api_instance.get_browser_test(public_id)
pprint(api_response)
except datadog_api_client.v1.ApiException as e:
print("Exception when calling SyntheticsApi->get_browser_test: %s\n" % e)
require 'time'
require 'datadog_api_client/v1'
# setup authorization
DatadogAPIClient::V1.configure do |config|
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['appKeyAuth'] = 'Bearer'
end
api_instance = DatadogAPIClient::V1::SyntheticsApi.new
public_id = 'public_id_example' # String | The public ID of the test to get details from.
begin
# Get a test configuration (browser)
result = api_instance.get_browser_test(public_id)
p result
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling SyntheticsApi->get_browser_test: #{e}"
end
GET https://api.datadoghq.eu/api/v1/synthetics/tests/{public_id}/results/{result_id}https://api.datadoghq.com/api/v1/synthetics/tests/{public_id}/results/{result_id}
Récupérez un résultat complet spécifique pour un test Synthetic (API) donné.
Nom
Type
Description
public_id [required]
string
The public ID of the API test to which the target result belongs.
result_id [required]
string
The ID of the result to get.
OK
Object returned describing a API test result.
Champ
Type
Description
check
object
Object describing the API test configuration.
config [required]
object
Configuration object for a Synthetic test.
assertions [required]
[object]
Array of assertions used for the test.
configVariables
[object]
API tests only - array of variables used for the test.
example [required]
string
Example for the variable.
name [required]
string
Name of the variable.
pattern
string
Pattern of the variable.
type [required]
enum
Type of the configuration variable.
Allowed enum values: text
request [required]
object
Object describing the Synthetic test request.
basicAuth
object
Object to handle basic authentication when performing the test.
password [required]
string
Password to use for the basic authentication.
username [required]
string
Username to use for the basic authentication.
body
string
Body to include in the test.
certificate
object
Client certificate to use when performing the test request.
cert
object
Define a request certificate.
content
string
Content of the certificate or key.
filename
string
File name for the certificate or key.
updatedAt
string
Date of update of the certificate or key, ISO format.
key
object
Define a request certificate.
content
string
Content of the certificate or key.
filename
string
File name for the certificate or key.
updatedAt
string
Date of update of the certificate or key, ISO format.
dnsServer
string
DNS server to use for DNS tests.
headers
object
Headers to include when performing the test.
<any-key>
string
A single Header.
host
string
Host name to perform the test with.
method
enum
The HTTP method.
Allowed enum values: GET,POST,PATCH,PUT,DELETE,HEAD,OPTIONS
port
int64
Port to use when performing the test.
query
object
Query to use for the test.
timeout
double
Timeout in seconds for the test.
url
string
URL to perform the test with.
variables
[object]
Browser tests only - array of variables used for the test steps.
example
string
Example for the variable.
id
string
ID for the variable.
name [required]
string
Name of the variable.
pattern
string
Pattern of the variable.
type [required]
enum
Type of browser test variable.
Allowed enum values: element,email,global,javascript,text
check_time
double
When the API test was conducted.
check_version
int64
Version of the API test used.
probe_dc
string
Locations for which to query the API test results.
result
object
Object containing results for your Synthetic API test.
cert
object
Object describing the SSL certificate used for a Synthetic test.
cipher
string
Cipher used for the connection.
exponent
double
Exponent associated to the certificate.
extKeyUsage
[string]
Array of extensions and details used for the certificate.
fingerprint
string
MD5 digest of the DER-encoded Certificate information.
fingerprint256
string
SHA-1 digest of the DER-encoded Certificate information.
issuer
object
Object describing the issuer of a SSL certificate.
C
string
Country Name that issued the certificate.
CN
string
Common Name that issued certificate.
L
string
Locality that issued the certificate.
O
string
Organization that issued the certificate.
OU
string
Organizational Unit that issued the certificate.
ST
string
State Or Province Name that issued the certificate.
modulus
string
Modulus associated to the SSL certificate private key.
protocol
string
TLS protocol used for the test.
serialNumber
string
Serial Number assigned by Symantec to the SSL certificate.
subject
object
Object describing the SSL certificate used for the test.
C
string
Country Name associated with the certificate.
CN
string
Common Name that associated with the certificate.
L
string
Locality associated with the certificate.
O
string
Organization associated with the certificate.
OU
string
Organizational Unit associated with the certificate.
ST
string
State Or Province Name associated with the certificate.
altName
string
Subject Alternative Name associated with the certificate.
validFrom
date-time
Date from which the SSL certificate is valid.
validTo
date-time
Date until which the SSL certificate is valid.
errorCode
enum
Error code that can be returned by a Synthetic test.
Allowed enum values: NO_ERROR,UNKNOWN,DNS,SSL,TIMEOUT,DENIED,INCORRECT_ASSERTION
errorMessage
string
The API test error message.
eventType
enum
Status of a Synthetic test.
Allowed enum values: not_scheduled,scheduled,started,finished,finished_with_error
httpStatusCode
int64
The API test HTTP status code.
requestHeaders
object
Request header object used for the API test.
<any-key>
object
Requested request header.
responseBody
string
Response body returned for the API test.
responseHeaders
object
Response headers returned for the API test.
<any-key>
object
Returned request header.
responseSize
int64
Global size in byte of the API test response.
timings
object
Object containing all metrics and their values collected for a Synthetic API test. Learn more about those metrics in Synthetics documentation.
dns
double
The duration in millisecond of the DNS lookup.
download
double
The time in millisecond to download the response.
firstByte
double
The time in millisecond to first byte.
handshake
double
The duration in millisecond of the TLS handshake.
redirect
double
The time in millisecond spent during redirections.
ssl
double
The duration in millisecond of the TLS handshake.
tcp
double
Time in millisecond to establish the TCP connection.
total
double
The overall time in millisecond the request took to be processed.
wait
double
Time spent in millisecond waiting for a response.
result_id
string
ID of the API test result.
status
enum
The status of your Synthetic monitor.
O
for not triggered1
for triggered2
for no data
Allowed enum values: 0,1,2
{
"check": {
"config": {
"assertions": [
[]
],
"configVariables": [
{
"example": "string",
"name": "VARIABLE_NAME",
"pattern": "string",
"type": "string"
}
],
"request": {
"basicAuth": {
"password": "",
"username": ""
},
"body": "string",
"certificate": {
"cert": {
"content": "string",
"filename": "string",
"updatedAt": "string"
},
"key": {
"content": "string",
"filename": "string",
"updatedAt": "string"
}
},
"dnsServer": "string",
"headers": {
"<any-key>": "string"
},
"host": "string",
"method": "string",
"port": "integer",
"query": {},
"timeout": "number",
"url": "string"
},
"variables": [
{
"example": "string",
"id": "string",
"name": "VARIABLE_NAME",
"pattern": "string",
"type": "string"
}
]
}
},
"check_time": "number",
"check_version": "integer",
"probe_dc": "string",
"result": {
"cert": {
"cipher": "string",
"exponent": "number",
"extKeyUsage": [],
"fingerprint": "string",
"fingerprint256": "string",
"issuer": {
"C": "string",
"CN": "string",
"L": "string",
"O": "string",
"OU": "string",
"ST": "string"
},
"modulus": "string",
"protocol": "string",
"serialNumber": "string",
"subject": {
"C": "string",
"CN": "string",
"L": "string",
"O": "string",
"OU": "string",
"ST": "string",
"altName": "string"
},
"validFrom": "2019-09-19T10:00:00.000Z",
"validTo": "2019-09-19T10:00:00.000Z"
},
"errorCode": "string",
"errorMessage": "string",
"eventType": "string",
"httpStatusCode": "integer",
"requestHeaders": {
"<any-key>": {}
},
"responseBody": "string",
"responseHeaders": {
"<any-key>": {}
},
"responseSize": "integer",
"timings": {
"dns": "number",
"download": "number",
"firstByte": "number",
"handshake": "number",
"redirect": "number",
"ssl": "number",
"tcp": "number",
"total": "number",
"wait": "number"
}
},
"result_id": "string",
"status": "integer"
}
Forbidden
Error response object.
{
"errors": [
"Bad Request"
]
}
- Synthetic is not activated for the user - Test or result is not owned by the user
Error response object.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export public_id="CHANGE_ME"
export result_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.datadoghq.eu"https://api.datadoghq.com/api/v1/synthetics/tests/${public_id}/results/${result_id}" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
publicId := "publicId_example" // string | The public ID of the API test to which the target result belongs.
resultId := "resultId_example" // string | The ID of the result to get.
configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.SyntheticsApi.GetAPITestResult(ctx, publicId, resultId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.GetAPITestResult``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetAPITestResult`: SyntheticsAPITestResultFull
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from SyntheticsApi.GetAPITestResult:\n%s\n", response_content)
}
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.SyntheticsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
String publicId = "publicId_example"; // String | The public ID of the API test to which the target result belongs.
String resultId = "resultId_example"; // String | The ID of the result to get.
try {
SyntheticsAPITestResultFull result = apiInstance.getAPITestResult(publicId, resultId)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#getAPITestResult");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
from datadog import initialize, api
options = {
'api_key': '<DATADOG_API_KEY>',
'app_key': '<DATADOG_APPLICATION_KEY>'
}
test_id = '<SYNTHETICS_TEST_PUBLIC_ID>'
result_id = '<TEST_RESULT_ID>'
initialize(**options)
api.Synthetics.get_result(id=test_id, result_id=result_id)
require 'dogapi'
api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'
test_id = '<SYNTHETICS_TEST_PUBLIC_ID>'
result_id = '<TEST_RESULT_ID>'
dog = Dogapi::Client.new(api_key, app_key)
dog.get_synthetics_result('test_id' => test_id , 'result_id' => result_id)
import os
from dateutil.parser import parse as dateutil_parser
import datadog_api_client.v1
from datadog_api_client.v1.api import synthetics_api
from datadog_api_client.v1.models import *
from pprint import pprint
# Defining the host is optional and defaults to https://api.datadoghq.com
# See configuration.py for a list of all supported configuration parameters.
configuration = datadog_api_client.v1.Configuration(
host = "https://api.datadoghq.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['appKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with datadog_api_client.v1.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = synthetics_api.SyntheticsApi(api_client)
public_id = "public_id_example" # str | The public ID of the API test to which the target result belongs.
result_id = "result_id_example" # str | The ID of the result to get.
# example passing only required values which don't have defaults set
try:
# Get a test result (API)
api_response = api_instance.get_api_test_result(public_id, result_id)
pprint(api_response)
except datadog_api_client.v1.ApiException as e:
print("Exception when calling SyntheticsApi->get_api_test_result: %s\n" % e)
require 'time'
require 'datadog_api_client/v1'
# setup authorization
DatadogAPIClient::V1.configure do |config|
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['appKeyAuth'] = 'Bearer'
end
api_instance = DatadogAPIClient::V1::SyntheticsApi.new
public_id = 'public_id_example' # String | The public ID of the API test to which the target result belongs.
result_id = 'result_id_example' # String | The ID of the result to get.
begin
# Get a test result (API)
result = api_instance.get_api_test_result(public_id, result_id)
p result
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling SyntheticsApi->get_api_test_result: #{e}"
end
GET https://api.datadoghq.eu/api/v1/synthetics/tests/browser/{public_id}/results/{result_id}https://api.datadoghq.com/api/v1/synthetics/tests/browser/{public_id}/results/{result_id}
Récupérez un résultat complet spécifique pour un test Synthetic (Browser) donné.
Nom
Type
Description
public_id [required]
string
The public ID of the browser test to which the target result belongs.
result_id [required]
string
The ID of the result to get.
OK
Object returned describing a browser test result.
Champ
Type
Description
check
object
Object describing the browser test configuration.
config [required]
object
Configuration object for a Synthetic test.
assertions [required]
[object]
Array of assertions used for the test.
configVariables
[object]
API tests only - array of variables used for the test.
example [required]
string
Example for the variable.
name [required]
string
Name of the variable.
pattern
string
Pattern of the variable.
type [required]
enum
Type of the configuration variable.
Allowed enum values: text
request [required]
object
Object describing the Synthetic test request.
basicAuth
object
Object to handle basic authentication when performing the test.
password [required]
string
Password to use for the basic authentication.
username [required]
string
Username to use for the basic authentication.
body
string
Body to include in the test.
certificate
object
Client certificate to use when performing the test request.
cert
object
Define a request certificate.
content
string
Content of the certificate or key.
filename
string
File name for the certificate or key.
updatedAt
string
Date of update of the certificate or key, ISO format.
key
object
Define a request certificate.
content
string
Content of the certificate or key.
filename
string
File name for the certificate or key.
updatedAt
string
Date of update of the certificate or key, ISO format.
dnsServer
string
DNS server to use for DNS tests.
headers
object
Headers to include when performing the test.
<any-key>
string
A single Header.
host
string
Host name to perform the test with.
method
enum
The HTTP method.
Allowed enum values: GET,POST,PATCH,PUT,DELETE,HEAD,OPTIONS
port
int64
Port to use when performing the test.
query
object
Query to use for the test.
timeout
double
Timeout in seconds for the test.
url
string
URL to perform the test with.
variables
[object]
Browser tests only - array of variables used for the test steps.
example
string
Example for the variable.
id
string
ID for the variable.
name [required]
string
Name of the variable.
pattern
string
Pattern of the variable.
type [required]
enum
Type of browser test variable.
Allowed enum values: element,email,global,javascript,text
check_time
double
When the browser test was conducted.
check_version
int64
Version of the browser test used.
probe_dc
string
Location from which the browser test was performed.
result
object
Object containing results for your Synthetic browser test.
browserType
string
Type of browser device used for the browser test.
browserVersion
string
Browser version used for the browser test.
device
object
Object describing the device used to perform the Synthetic test.
height [required]
int64
Screen height of the device.
id [required]
enum
The device ID.
Allowed enum values: laptop_large,tablet,mobile_small,chrome.laptop_large,chrome.tablet,chrome.mobile_small,firefox.laptop_large,firefox.tablet,firefox.mobile_small
isMobile
boolean
Whether or not the device is a mobile.
name [required]
string
The device name.
width [required]
int64
Screen width of the device.
duration
double
Global duration in second of the browser test.
error
string
Error returned for the browser test.
passed
boolean
Whether or not the browser test was conducted.
receivedEmailCount
int64
The amount of email received during the browser test.
startUrl
string
Starting URL for the browser test.
stepDetails
[object]
Array containing the different browser test steps.
browserErrors
[object]
Array of errors collected for a browser test.
description [required]
string
Description of the error.
name [required]
string
Name of the error.
statusCode
int64
Status Code of the error.
type [required]
enum
Error type returned by a browser test.
Allowed enum values: network,js
checkType
enum
Type of assertion to apply in an API test.
Allowed enum values: equals,notEquals,contains,notContains,startsWith,notStartsWith,greater,lower,greaterEquals,lowerEquals,matchRegex
description
string
Description of the test.
duration
double
Total duration in millisecond of the test.
error
string
Error returned by the test.
playingTab
enum
Navigate between different tabs for your browser test.
Allowed enum values: -1,0,1,2,3
screenshotBucketKey
boolean
Whether or not screenshots where collected by the test.
skipped
boolean
Whether or not to skip this step.
snapshotBucketKey
boolean
Whether or not snapshots where collected by the test.
stepId
int64
The step ID.
timeToInteractive
double
Time before starting the step.
type
enum
Step type used in your Synthetic test.
Allowed enum values: assertCurrentUrl,assertElementAttribute,assertElementContent,assertElementPresent,assertEmail,assertFileDownload,assertFromJavascript,assertPageContains,assertPageLacks,click,extractFromJavascript,extractVariable,goToEmailLink,goToUrl,goToUrlAndMeasureTti,hover,playSubTest,pressKey,refresh,runApiTest,scroll,selectOption,typeText,uploadFiles,wait
url
string
URL to perform the step against.
value
object
Value for the step.
warnings
[object]
Warning collected that didn't failed the step.
message [required]
string
Message for the warning.
type [required]
enum
User locator used.
Allowed enum values: user_locator
thumbnailsBucketKey
boolean
Whether or not a thumbnail is associated with the browser test.
timeToInteractive
double
Time in second to wait before the browser test starts after reaching the start URL.
result_id
string
ID of the browser test result.
status
enum
The status of your Synthetic monitor.
O
for not triggered1
for triggered2
for no data
Allowed enum values: 0,1,2
{
"check": {
"config": {
"assertions": [
[]
],
"configVariables": [
{
"example": "string",
"name": "VARIABLE_NAME",
"pattern": "string",
"type": "string"
}
],
"request": {
"basicAuth": {
"password": "",
"username": ""
},
"body": "string",
"certificate": {
"cert": {
"content": "string",
"filename": "string",
"updatedAt": "string"
},
"key": {
"content": "string",
"filename": "string",
"updatedAt": "string"
}
},
"dnsServer": "string",
"headers": {
"<any-key>": "string"
},
"host": "string",
"method": "string",
"port": "integer",
"query": {},
"timeout": "number",
"url": "string"
},
"variables": [
{
"example": "string",
"id": "string",
"name": "VARIABLE_NAME",
"pattern": "string",
"type": "string"
}
]
}
},
"check_time": "number",
"check_version": "integer",
"probe_dc": "string",
"result": {
"browserType": "string",
"browserVersion": "string",
"device": {
"height": 0,
"id": "string",
"isMobile": false,
"name": "",
"width": 0
},
"duration": "number",
"error": "string",
"passed": false,
"receivedEmailCount": "integer",
"startUrl": "string",
"stepDetails": [
{
"browserErrors": [
{
"description": "",
"name": "",
"statusCode": "integer",
"type": "string"
}
],
"checkType": "string",
"description": "string",
"duration": "number",
"error": "string",
"playingTab": "integer",
"screenshotBucketKey": false,
"skipped": false,
"snapshotBucketKey": false,
"stepId": "integer",
"subTestStepDetails": [],
"timeToInteractive": "number",
"type": "string",
"url": "string",
"value": {},
"warnings": [
{
"message": "",
"type": "string"
}
]
}
],
"thumbnailsBucketKey": false,
"timeToInteractive": "number"
},
"result_id": "string",
"status": "integer"
}
Forbidden
Error response object.
{
"errors": [
"Bad Request"
]
}
- Synthetic is not activated for the user - Test or result is not owned by the user
Error response object.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export public_id="CHANGE_ME"
export result_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.datadoghq.eu"https://api.datadoghq.com/api/v1/synthetics/tests/browser/${public_id}/results/${result_id}" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
publicId := "publicId_example" // string | The public ID of the browser test to which the target result belongs.
resultId := "resultId_example" // string | The ID of the result to get.
configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.SyntheticsApi.GetBrowserTestResult(ctx, publicId, resultId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.GetBrowserTestResult``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetBrowserTestResult`: SyntheticsBrowserTestResultFull
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from SyntheticsApi.GetBrowserTestResult:\n%s\n", response_content)
}
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.SyntheticsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
String publicId = "publicId_example"; // String | The public ID of the browser test to which the target result belongs.
String resultId = "resultId_example"; // String | The ID of the result to get.
try {
SyntheticsBrowserTestResultFull result = apiInstance.getBrowserTestResult(publicId, resultId)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#getBrowserTestResult");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
import os
from dateutil.parser import parse as dateutil_parser
import datadog_api_client.v1
from datadog_api_client.v1.api import synthetics_api
from datadog_api_client.v1.models import *
from pprint import pprint
# Defining the host is optional and defaults to https://api.datadoghq.com
# See configuration.py for a list of all supported configuration parameters.
configuration = datadog_api_client.v1.Configuration(
host = "https://api.datadoghq.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['appKeyAuth'] = 'Bearer'
# Enter a context with an instance of the API client
with datadog_api_client.v1.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = synthetics_api.SyntheticsApi(api_client)
public_id = "public_id_example" # str | The public ID of the browser test to which the target result belongs.
result_id = "result_id_example" # str | The ID of the result to get.
# example passing only required values which don't have defaults set
try:
# Get a test result (browser)
api_response = api_instance.get_browser_test_result(public_id, result_id)
pprint(api_response)
except datadog_api_client.v1.ApiException as e:
print("Exception when calling SyntheticsApi->get_browser_test_result: %s\n" % e)
require 'time'
require 'datadog_api_client/v1'
# setup authorization
DatadogAPIClient::V1.configure do |config|
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['apiKeyAuth'] = 'Bearer'
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['appKeyAuth'] = 'Bearer'
end
api_instance = DatadogAPIClient::V1::SyntheticsApi.new
public_id = 'public_id_example' # String | The public ID of the browser test to which the target result belongs.
result_id = 'result_id_example' # String | The ID of the result to get.
begin
# Get a test result (browser)
result = api_instance.get_browser_test_result(public_id, result_id)
p result
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling SyntheticsApi->get_browser_test_result: #{e}"
end
GET https://api.datadoghq.eu/api/v1/synthetics/locationshttps://api.datadoghq.com/api/v1/synthetics/locations
Récupérez la liste des emplacements publics et privés disponibles pour les tests Synthetic. Aucun argument n’est nécessaire.
OK
List of Synthetics locations.
Champ
Type
Description
locations