API Reference
Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.

API Reference

The Datadog API is an HTTP REST API. The API uses resource-oriented URLs to call the API, uses status codes to indicate the success or failure of requests, returns JSON from all requests, and uses standard HTTP response codes. Use the Datadog API to access the Datadog platform programmatically.

Getting started

Authenticate to the API with an API key, and depending on the endpoint, an Application key.

To try out the API Run in Postman

Using the API is a guide to the endpoints.

Note: cURL code examples assume usage of BASH and GNU coreutils. On macOS, you can install coreutils via the Homebrew package manager: brew install coreutils

Client libraries

By default, the Datadog API Docs show examples in cURL. Select one of our official client libraries languages in each endpoint to see code examples from that library. To install each library:

Installation

Maven - Add this dependency to your project’s POM:

<dependency>
  <groupId>com.datadoghq</groupId>
  <artifactId>datadog-api-client</artifactId>
  <version>1.0.0</version>
  <scope>compile</scope>
</dependency>

Gradle - Add this dependency to your project’s build file:

compile "com.datadoghq:datadog-api-client:1.0.0"

Usage

import com.datadog.api.<VERSION>.client.ApiClient;
import com.datadog.api.<VERSION>.client.ApiException;
import com.datadog.api.<VERSION>.client.Configuration;
import com.datadog.api.v2.client.auth.*;
import com.datadog.api.v2.client.model.*;
import com.datadog.api.<VERSION>.client.api.*;

Note: Replace <VERSION> with v1 or v2, depending on which endpoints you want to use.

Examples

Maven pom.xml for running examples:

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>example</artifactId>
  <version>1</version>
  <dependencies>
    <dependency>
      <groupId>com.datadoghq</groupId>
      <artifactId>datadog-api-client</artifactId>
      <version>1.0.0</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
</project>

Make sure that CLASSPATH variable contains all dependencies.

export CLASSPATH=$(mvn -q exec:exec -Dexec.executable=echo -Dexec.args="%classpath")

Gradle build.gradle for running examples:

plugins {
    id 'java'
    id 'application'
}

repositories {
    jcenter()
}

dependencies {
    implementation 'com.datadoghq:datadog-api-client:1.0.0'
}

application {
    mainClassName = 'Example.java'
}

Execute example by running gradle run command.

Installation

pip install datadog

Usage

import datadog

Installation

pip3 install datadog-api-client

Usage

import datadog_api_client

Installation

gem install dogapi

Usage

require 'dogapi'

Installation

gem install datadog_api_client -v 1.1.0

Usage

require 'datadog_api_client'

Installation

go get github.com/DataDog/datadog-api-client-go

Usage

import "github.com/DataDog/datadog-api-client-go/api/<VERSION>/datadog"

Note: Replace <VERSION> with v1 or v2, depending on which endpoints you want to use.

Installation

The package is under @datadog/datadog-api-client and can be installed through NPM or Yarn:

# NPM
npm install @datadog/datadog-api-client

# Yarn
yarn add @datadog/datadog-api-client

Usage

import { <VERSION> } from 'datadog-api-client';

Note: Replace <VERSION> with v1 or v2, depending on which endpoints you want to use.

Or check out the libraries directly:


Trying to get started with the application instead? Check out our general Getting Started docs.

Further Reading

Documentation, liens et articles supplémentaires utiles: