Installation
Maven - Add this dependency to your project’s POM:
<dependency>
<groupId>com.datadoghq</groupId>
<artifactId>datadog-api-client</artifactId>
<version>2.34.1</version>
<scope>compile</scope>
</dependency>
Gradle - Add this dependency to your project’s build file:
compile "com.datadoghq:datadog-api-client:2.34.1"
Usage
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.Configuration;
import com.datadog.api.<VERSION>.client.api.*;
import com.datadog.api.<VERSION>.client.model.*;
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>2.34.1</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:2.34.1'
}
application {
mainClassName = 'Example.java'
}
Execute example by running gradle run
command.
Installation
pip3 install datadog-api-client
Usage
import datadog_api_client
Installation
gem install datadog_api_client -v 2.32.0
Usage
require 'datadog_api_client'
Installation
go mod init main && go get github.com/DataDog/datadog-api-client-go/v2/api/datadog
Usage
import (
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog<VERSION>"
)
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.
Installation
Run cargo add datadog-api-client
, or add the following to Cargo.toml
under [dependencies]
:
Usage
Try the following snippet to validate your Datadog API key:
use datadog_api_client::datadog::Configuration;
use datadog_api_client::datadogV1::api_authentication::AuthenticationAPI;
#[tokio::main]
async fn main() {
let configuration = Configuration::new();
let api = AuthenticationAPI::with_config(configuration);
let resp = api.validate().await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}