For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/fr/api/latest/snapshots/take-graph-snapshots.md. A documentation index is available at /llms.txt.
Language
Datadog site

Prendre des snapshots de graphiques

GEThttps://api.datadoghq.com/api/v1/graph/snapshothttps://api.us3.datadoghq.com/api/v1/graph/snapshothttps://api.us5.datadoghq.com/api/v1/graph/snapshothttps://api.datadoghq.eu/api/v1/graph/snapshothttps://api.ap1.datadoghq.com/api/v1/graph/snapshothttps://api.ap2.datadoghq.com/api/v1/graph/snapshothttps://api.uk1.datadoghq.com/api/v1/graph/snapshothttps://api.ddog-gov.com/api/v1/graph/snapshothttps://api.us2.ddog-gov.com/api/v1/graph/snapshot

Présentation

Prenez des snapshots de graphiques. Les snapshots correspondent à des images PNG générées en affichant un widget spécifique sur une page web et en capturant le rendu une fois les données disponibles. L'image est ensuite téléchargée vers le stockage cloud.

Remarque : lorsqu'un snapshot est créé, il n'est pas disponible de suite.

Arguments

Chaînes de requête

Name
Type
Description
metric_query
string

The metric query.

start [required]
integer

The POSIX timestamp of the start of the query in seconds.

end [required]
integer

The POSIX timestamp of the end of the query in seconds.

event_query
string

A query that adds event bands to the graph.

graph_def
string

A JSON document defining the graph. graph_def can be used instead of metric_query. The JSON document uses the grammar defined here and should be formatted to a single line then URL encoded.

title
string

A title for the graph. If no title is specified, the graph does not have a title.

height
integer

The height of the graph. If no height is specified, the graph's original height is used.

width
integer

The width of the graph. If no width is specified, the graph's original width is used.

Réponse

OK

Object representing a graph snapshot.

Champ
Type
Description
graph_def
string

A JSON document defining the graph. graph_def can be used instead of metric_query. The JSON document uses the grammar defined here and should be formatted to a single line then URL encoded.

metric_query
string

The metric query. One of metric_query or graph_def is required.

snapshot_url
string

URL of your graph snapshot.

Exemple de code

Prendre des snapshots de graphiques
# Required query arguments
export metric_query="CHANGE_ME"
export start="CHANGE_ME"
export end="CHANGE_ME"

# 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 GET "https://api.${DD_SITE}/api/v1/graph/snapshot?metric_query=${metric_query}&start=${start}&end=${end}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export metric_query="CHANGE_ME"
export start="CHANGE_ME"
export end="CHANGE_ME"

# 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 GET "https://api.${DD_SITE}/api/v1/graph/snapshot?metric_query=${metric_query}&start=${start}&end=${end}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export metric_query="CHANGE_ME"
export start="CHANGE_ME"
export end="CHANGE_ME"

# 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 GET "https://api.${DD_SITE}/api/v1/graph/snapshot?metric_query=${metric_query}&start=${start}&end=${end}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export metric_query="CHANGE_ME"
export start="CHANGE_ME"
export end="CHANGE_ME"

# 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 GET "https://api.${DD_SITE}/api/v1/graph/snapshot?metric_query=${metric_query}&start=${start}&end=${end}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export metric_query="CHANGE_ME"
export start="CHANGE_ME"
export end="CHANGE_ME"

# 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 GET "https://api.${DD_SITE}/api/v1/graph/snapshot?metric_query=${metric_query}&start=${start}&end=${end}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export metric_query="CHANGE_ME"
export start="CHANGE_ME"
export end="CHANGE_ME"

# 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 GET "https://api.${DD_SITE}/api/v1/graph/snapshot?metric_query=${metric_query}&start=${start}&end=${end}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export metric_query="CHANGE_ME"
export start="CHANGE_ME"
export end="CHANGE_ME"

# 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 GET "https://api.${DD_SITE}/api/v1/graph/snapshot?metric_query=${metric_query}&start=${start}&end=${end}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export metric_query="CHANGE_ME"
export start="CHANGE_ME"
export end="CHANGE_ME"

# 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 GET "https://api.${DD_SITE}/api/v1/graph/snapshot?metric_query=${metric_query}&start=${start}&end=${end}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export metric_query="CHANGE_ME"
export start="CHANGE_ME"
export end="CHANGE_ME"

# 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 GET "https://api.${DD_SITE}/api/v1/graph/snapshot?metric_query=${metric_query}&start=${start}&end=${end}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"