Graphiques intégrables
Rapport de recherche Datadog : Bilan sur l'adoption de l'informatique sans serveur Rapport : Bilan sur l'adoption de l'informatique sans serveur

Graphiques intégrables

Interagissez avec les graphiques intégrables via l’API.

Créer un embed

POST https://api.datadoghq.eu/api/v1/graph/embedhttps://api.datadoghq.com/api/v1/graph/embed

Présentation

Crée 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

Expand All

Champ

Type

Description

graph_json [required]

string

The graph definition in JSON.

Same format that is available on the JSON tab of the graph editor.

legend

enum

The flag determining if the graph includes a legend. Allowed enum values: yes,no

size

enum

The size of the graph. Allowed enum values: small,medium,large,xlarge

timeframe

enum

The timeframe for the graph. Allowed enum values: 1_hour,4_hours,1_day,2_days,1_week

title

string

Determines graph title. Must be at least 1 character.

{
  "graph_json": "",
  "legend": "string",
  "size": "string",
  "timeframe": "string",
  "title": "string"
}

Réponse

Payload accepted

Embeddable graph.

Expand All

Champ

Type

Description

dash_name

string

Name of the dashboard the graph is on (null if none).

dash_url

string

URL of the dashboard the graph is on (null if none).

embed_id

string

ID of the embed.

graph_title

string

Title of the graph.

html

string

HTML fragment for the embed (iframe).

revoked

boolean

Boolean flag for whether or not the embed is revoked.

shared_by

int64

ID 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.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Authentication Error

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Curl command
curl -X POST "https://api.datadoghq.eu"https://api.datadoghq.com/api/v1/graph/embed" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}" \
-d @- << EOF
{
  "graph_json": ""
}
EOF

Activer un embed

GET https://api.datadoghq.eu/api/v1/graph/embed/{embed_id}/enablehttps://api.datadoghq.com/api/v1/graph/embed/{embed_id}/enable

Présentation

Active un embed spécifié.

Arguments

Paramètres du chemin

Nom

Type

Description

embed_id [required]

string

ID of the embed.

Réponse

OK

A JSON containing the success message

Expand All

Champ

Type

Description

success

string

Message.

{
  "success": "Embed 00000000000 successfully enabled."
}

Authentication Error

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Not found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Path parameters
export embed_id="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.eu"https://api.datadoghq.com/api/v1/graph/embed/${embed_id}/enable" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"

Récupérer tous les embeds

GET https://api.datadoghq.eu/api/v1/graph/embedhttps://api.datadoghq.com/api/v1/graph/embed

Présentation

Récupère la liste des graphiques intégrables précédemment créés.

Réponse

OK

Response with embeddable graphs.

Expand All

Champ

Type

Description

embedded_graphs

[object]

List of embeddable graphs.

dash_name

string

Name of the dashboard the graph is on (null if none).

dash_url

string

URL of the dashboard the graph is on (null if none).

embed_id

string

ID of the embed.

graph_title

string

Title of the graph.

html

string

HTML fragment for the embed (iframe).

revoked

boolean

Boolean flag for whether or not the embed is revoked.

shared_by

int64

ID of the use who shared the embed.

{
  "embedded_graphs": [
    {
      "dash_name": "string",
      "dash_url": "string",
      "embed_id": "string",
      "graph_title": "string",
      "html": "string",
      "revoked": false,
      "shared_by": "integer"
    }
  ]
}

Authentication Error

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Curl command
curl -X GET "https://api.datadoghq.eu"https://api.datadoghq.com/api/v1/graph/embed" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"

Récupérer un embed spécifique

GET https://api.datadoghq.eu/api/v1/graph/embed/{embed_id}https://api.datadoghq.com/api/v1/graph/embed/{embed_id}

Présentation

Récupérez le fragment HTML d’un embed généré précédemment avec embed_id.

Arguments

Paramètres du chemin

Nom

Type

Description

embed_id [required]

string

Token of the embed.

Réponse

OK

Embeddable graph.

Expand All

Champ

Type

Description

dash_name

string

Name of the dashboard the graph is on (null if none).

dash_url

string

URL of the dashboard the graph is on (null if none).

embed_id

string

ID of the embed.

graph_title

string

Title of the graph.

html

string

HTML fragment for the embed (iframe).

revoked

boolean

Boolean flag for whether or not the embed is revoked.

shared_by

int64

ID 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"
}

Authentication Error

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Not found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Path parameters
export embed_id="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.eu"https://api.datadoghq.com/api/v1/graph/embed/${embed_id}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"

Révoquer un embed

GET https://api.datadoghq.eu/api/v1/graph/embed/{embed_id}/revokehttps://api.datadoghq.com/api/v1/graph/embed/{embed_id}/revoke

Présentation

Révoque un embed spécifié.

Arguments

Paramètres du chemin

Nom

Type

Description

embed_id [required]

string

ID of the embed.

Réponse

OK

A JSON containing the success message

Expand All

Champ

Type

Description

success

string

Message.

{
  "success": "Embed 0000000000000 successfully revoked."
}

Authentication Error

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Not found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Path parameters
export embed_id="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.eu"https://api.datadoghq.com/api/v1/graph/embed/${embed_id}/revoke" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"