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

グラフのスナップショットを取得する

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

概要

グラフのスナップショットを取得します。スナップショットは、Web ページ内の指定されたウィジェットをレンダリングし、データが利用可能になった時点でキャプチャして生成される PNG 画像です。画像はその後、クラウドストレージにアップロードされます。

注: スナップショットが作成されてから利用可能になるまで多少の遅延があります。

引数

クエリ文字列

名前
タイプ
説明
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.

応答

OK

Object representing a graph snapshot.

フィールド
タイプ
説明
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.

コード例

グラフのスナップショットを取得する
# 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}"