For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/fr/api/latest/synthetics/fetch-uptime-for-multiple-tests.md. A documentation index is available at /llms.txt.
Language
Datadog site

Récupérer la durée de fonctionnement de plusieurs tests

POSThttps://api.datadoghq.com/api/v1/synthetics/tests/uptimeshttps://api.us3.datadoghq.com/api/v1/synthetics/tests/uptimeshttps://api.us5.datadoghq.com/api/v1/synthetics/tests/uptimeshttps://api.datadoghq.eu/api/v1/synthetics/tests/uptimeshttps://api.ap1.datadoghq.com/api/v1/synthetics/tests/uptimeshttps://api.ap2.datadoghq.com/api/v1/synthetics/tests/uptimeshttps://api.uk1.datadoghq.com/api/v1/synthetics/tests/uptimeshttps://api.ddog-gov.com/api/v1/synthetics/tests/uptimeshttps://api.us2.ddog-gov.com/api/v1/synthetics/tests/uptimes

Présentation

Récupérez la durée de fonctionnement de plusieurs tests Synthetic par ID.

This endpoint requires the synthetics_read permission.

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

Requête

Body Data (required)

Liste des ID publics des tests Synthetic et leur intervalle.

Champ
Type
Description
from_ts [required]
int64

Objet contenant les ID de tests Synthetic et un intervalle.

public_ids [required]
[string]

An array of Synthetic test IDs you want uptimes for.

to_ts [required]
int64

Timestamp in seconds (Unix epoch) for the end of uptime.

Réponse

OK.

Champ
Type
Description
from_ts
int64

Timestamp in seconds for the start of uptime.

overall
object

Object containing the uptime information.

public_id
string

A Synthetic test ID.

to_ts
int64

Timestamp in seconds for the end of uptime.

Exemple de code

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/uptimes" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "from_ts": 1726041488,
  "public_ids": [
    "abc-def-123"
  ],
  "to_ts": 1726127888
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/uptimes" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "from_ts": 1726041488,
  "public_ids": [
    "abc-def-123"
  ],
  "to_ts": 1726127888
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/uptimes" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "from_ts": 1726041488,
  "public_ids": [
    "abc-def-123"
  ],
  "to_ts": 1726127888
}
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/uptimes" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "from_ts": 1726041488,
  "public_ids": [
    "abc-def-123"
  ],
  "to_ts": 1726127888
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/uptimes" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "from_ts": 1726041488,
  "public_ids": [
    "abc-def-123"
  ],
  "to_ts": 1726127888
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/uptimes" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "from_ts": 1726041488,
  "public_ids": [
    "abc-def-123"
  ],
  "to_ts": 1726127888
}
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/uptimes" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "from_ts": 1726041488,
  "public_ids": [
    "abc-def-123"
  ],
  "to_ts": 1726127888
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/uptimes" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "from_ts": 1726041488,
  "public_ids": [
    "abc-def-123"
  ],
  "to_ts": 1726127888
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/synthetics/tests/uptimes" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "from_ts": 1726041488,
  "public_ids": [
    "abc-def-123"
  ],
  "to_ts": 1726127888
}
EOF