Créer un embed
https://api.datadoghq.com/api/v1/graph/embedhttps://api.us3.datadoghq.com/api/v1/graph/embedhttps://api.us5.datadoghq.com/api/v1/graph/embedhttps://api.datadoghq.eu/api/v1/graph/embedhttps://api.ap1.datadoghq.com/api/v1/graph/embedhttps://api.ap2.datadoghq.com/api/v1/graph/embedhttps://api.uk1.datadoghq.com/api/v1/graph/embedhttps://api.ddog-gov.com/api/v1/graph/embedhttps://api.us2.ddog-gov.com/api/v1/graph/embedPrésentation
Créez un nouveau graphique intégrable.
Remarque : si un embed existe déjà pour la même requête dans une organisation donnée, au lieu de créer un nouvel embed, l'embed existant est renvoyé. Si vous souhaitez utiliser des template variables, consultez la section [Graphiques intégrables avec des template variables] (https://docs.datadoghq.com/dashboards/faq/embeddable-graphs-with-template-variables).
Requête
Body Data (required)
Corps de graphique intégrable
graph_json [required]Charge utile pour créer un nouveau graphique intégrable.
legendThe flag determining if the graph includes a legend.
noyes, nosizeThe size of the graph.
mediumsmall, medium, large, xlargetimeframeThe timeframe for the graph.
1_hour1_hour, 4_hours, 1_day, 2_days, 1_weektitleDetermines graph title. Must be at least 1 character.
Embed created through API{
"graph_json": "",
"legend": "string",
"size": "string",
"timeframe": "string",
"title": "string"
}Réponse
Payload accepted
Embeddable graph.
dash_nameName of the dashboard the graph is on (null if none).
dash_urlURL of the dashboard the graph is on (null if none).
embed_idID of the embed.
graph_titleTitle of the graph.
htmlHTML fragment for the embed (iframe).
revokedBoolean flag for whether or not the embed is revoked.
shared_byID of the use who shared the embed.
{
"dash_name": "string",
"dash_url": "string",
"embed_id": "string",
"graph_title": "string",
"html": "string",
"revoked": false,
"shared_by": "integer"
}Bad Request
Error response object.
errors [required]Array of errors returned by the API.
{
"errors": [
"Bad Request"
]
}Authentication Error
Error response object.
errors [required]Array of errors returned by the API.
{
"errors": [
"Bad Request"
]
}Too many requests
Error response object.
errors [required]Array of errors returned by the API.
{
"errors": [
"Bad Request"
]
}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/graph/embed" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"graph_json": "{\"viz\":\"timeseries\",\"requests\":[{\"q\":\"avg:system.load.1{*}\",\"type\":\"line\"}]}",
"legend": "yes",
"size": "medium",
"timeframe": "1_hour",
"title": "System Load Average"
}
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/graph/embed" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"graph_json": "{\"viz\":\"timeseries\",\"requests\":[{\"q\":\"avg:system.load.1{*}\",\"type\":\"line\"}]}",
"legend": "yes",
"size": "medium",
"timeframe": "1_hour",
"title": "System Load Average"
}
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/graph/embed" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"graph_json": "{\"viz\":\"timeseries\",\"requests\":[{\"q\":\"avg:system.load.1{*}\",\"type\":\"line\"}]}",
"legend": "yes",
"size": "medium",
"timeframe": "1_hour",
"title": "System Load Average"
}
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/graph/embed" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"graph_json": "{\"viz\":\"timeseries\",\"requests\":[{\"q\":\"avg:system.load.1{*}\",\"type\":\"line\"}]}",
"legend": "yes",
"size": "medium",
"timeframe": "1_hour",
"title": "System Load Average"
}
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/graph/embed" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"graph_json": "{\"viz\":\"timeseries\",\"requests\":[{\"q\":\"avg:system.load.1{*}\",\"type\":\"line\"}]}",
"legend": "yes",
"size": "medium",
"timeframe": "1_hour",
"title": "System Load Average"
}
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/graph/embed" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"graph_json": "{\"viz\":\"timeseries\",\"requests\":[{\"q\":\"avg:system.load.1{*}\",\"type\":\"line\"}]}",
"legend": "yes",
"size": "medium",
"timeframe": "1_hour",
"title": "System Load Average"
}
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/graph/embed" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"graph_json": "{\"viz\":\"timeseries\",\"requests\":[{\"q\":\"avg:system.load.1{*}\",\"type\":\"line\"}]}",
"legend": "yes",
"size": "medium",
"timeframe": "1_hour",
"title": "System Load Average"
}
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/graph/embed" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"graph_json": "{\"viz\":\"timeseries\",\"requests\":[{\"q\":\"avg:system.load.1{*}\",\"type\":\"line\"}]}",
"legend": "yes",
"size": "medium",
"timeframe": "1_hour",
"title": "System Load Average"
}
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/graph/embed" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"graph_json": "{\"viz\":\"timeseries\",\"requests\":[{\"q\":\"avg:system.load.1{*}\",\"type\":\"line\"}]}",
"legend": "yes",
"size": "medium",
"timeframe": "1_hour",
"title": "System Load Average"
}
EOF