Create a child organization
https://api.datadoghq.com/api/v1/orghttps://api.us3.datadoghq.com/api/v1/orghttps://api.us5.datadoghq.com/api/v1/orghttps://api.datadoghq.eu/api/v1/orghttps://api.ap1.datadoghq.com/api/v1/orghttps://api.ap2.datadoghq.com/api/v1/orghttps://api.uk1.datadoghq.com/api/v1/orghttps://api.ddog-gov.com/api/v1/orghttps://api.us2.ddog-gov.com/api/v1/orgOverview
Create a child organization.
This endpoint requires the multi-organization account feature and must be enabled by contacting support.
Once a new child organization is created, you can interact with it
by using the org.public_id, api_key.key, and
application_key.hash provided in the response.
Request
Body Data (required)
Organization object that needs to be created
billingDEPRECATED A JSON array of billing type.
typeThe type of billing. Only parent_billing is supported.
name [required]The name of the new child-organization, limited to 32 characters.
subscriptionDEPRECATED Subscription definition.
typeThe subscription type. Types available are trial, free, and pro.
{
"billing": {
"type": "parent_billing"
},
"name": "New child org",
"subscription": {
"type": "pro"
}
}Response
OK
Response object for an organization creation.
api_keyDatadog API key.
createdDate of creation of the API key.
created_byDatadog user handle that created the API key.
keyAPI key.
nameName of your API key.
application_keyAn application key with its associated metadata.
hashHash of an application key.
nameName of an application key.
ownerOwner of an application key.
orgCreate, edit, and manage organizations.
billingDEPRECATED A JSON array of billing type.
typeThe type of billing. Only parent_billing is supported.
createdDate of the organization creation.
descriptionDescription of the organization.
nameThe name of the child organization, limited to 32 characters.
public_idThe public_id of the organization you are operating within.
settingsA JSON array of settings.
private_widget_shareWhether or not the organization users can share widgets outside of Datadog.
samlSet the boolean property enabled to enable or disable single sign on with SAML. See the SAML documentation for more information about all SAML settings.
enabledWhether or not SAML is enabled for this organization.
saml_autocreate_access_roleThe access role of the user. Options are st (standard user), adm (admin user), or ro (read-only user).
st, adm, ro, ERRORsaml_autocreate_users_domainsHas two properties, enabled (boolean) and domains, which is a list of domains without the @ symbol.
domainsList of domains where the SAML automated user creation is enabled.
enabledWhether or not the automated user creation based on SAML domain is enabled.
saml_can_be_enabledWhether or not SAML can be enabled for this organization.
saml_idp_endpointIdentity provider endpoint for SAML authentication.
saml_idp_initiated_loginHas one property enabled (boolean).
saml_idp_metadata_uploadedWhether or not a SAML identity provider metadata file was provided to the Datadog organization.
saml_login_urlURL for SAML logging.
saml_strict_modeHas one property enabled (boolean).
enabledWhether or not the SAML strict mode is enabled. If true, all users must log in with SAML. Learn more on the SAML Strict documentation.
subscriptionDEPRECATED Subscription definition.
typeThe subscription type. Types available are trial, free, and pro.
trialOnly available for MSP customers. Allows child organizations to be created on a trial plan.
userCreate, edit, and disable users.
access_roleThe access role of the user. Options are st (standard user), adm (admin user), or ro (read-only user).
st, adm, ro, ERRORdisabledThe new disabled status of the user.
emailThe new email of the user.
handleThe user handle, must be a valid email.
iconGravatar icon associated to the user.
nameThe name of the user.
verifiedWhether or not the user logged in Datadog at least once.
{
"api_key": {
"created": "2019-08-02 15:31:07",
"created_by": "john@example.com",
"key": "1234512345123456abcabc912349abcd",
"name": "example user"
},
"application_key": {
"hash": "1234512345123459cda4eb9ced49a3d84fd0138c",
"name": "example user",
"owner": "example.com"
},
"org": {
"billing": {
"type": "string"
},
"created": "2019-09-26T17:28:28Z",
"description": "some description",
"name": "New child org",
"public_id": "abcdef12345",
"settings": {
"private_widget_share": false,
"saml": {
"enabled": false
},
"saml_autocreate_access_role": "ro",
"saml_autocreate_users_domains": {
"domains": [
"example.com"
],
"enabled": false
},
"saml_can_be_enabled": false,
"saml_idp_endpoint": "https://my.saml.endpoint",
"saml_idp_initiated_login": {
"enabled": false
},
"saml_idp_metadata_uploaded": false,
"saml_login_url": "https://my.saml.login.url",
"saml_strict_mode": {
"enabled": false
}
},
"subscription": {
"type": "string"
},
"trial": false
},
"user": {
"access_role": "ro",
"disabled": false,
"email": "test@datadoghq.com",
"handle": "test@datadoghq.com",
"icon": "/path/to/matching/gravatar/icon",
"name": "test user",
"verified": true
}
}Bad Request
Error response object.
errors [required]Array of errors returned by the API.
{
"errors": [
"Bad Request"
]
}Forbidden
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"
]
}Code Example
# 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/org" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"billing": {
"type": "parent_billing"
},
"name": "New child org",
"subscription": {
"type": "pro"
}
}
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/org" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"billing": {
"type": "parent_billing"
},
"name": "New child org",
"subscription": {
"type": "pro"
}
}
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/org" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"billing": {
"type": "parent_billing"
},
"name": "New child org",
"subscription": {
"type": "pro"
}
}
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/org" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"billing": {
"type": "parent_billing"
},
"name": "New child org",
"subscription": {
"type": "pro"
}
}
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/org" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"billing": {
"type": "parent_billing"
},
"name": "New child org",
"subscription": {
"type": "pro"
}
}
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/org" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"billing": {
"type": "parent_billing"
},
"name": "New child org",
"subscription": {
"type": "pro"
}
}
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/org" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"billing": {
"type": "parent_billing"
},
"name": "New child org",
"subscription": {
"type": "pro"
}
}
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/org" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"billing": {
"type": "parent_billing"
},
"name": "New child org",
"subscription": {
"type": "pro"
}
}
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/org" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"billing": {
"type": "parent_billing"
},
"name": "New child org",
"subscription": {
"type": "pro"
}
}
EOF// Create a child organization returns "OK" response
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
)
func main() {
body := datadogV1.OrganizationCreateBody{
Billing: &datadogV1.OrganizationBilling{
Type: datadog.PtrString("parent_billing"),
},
Name: "New child org",
Subscription: &datadogV1.OrganizationSubscription{
Type: datadog.PtrString("pro"),
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV1.NewOrganizationsApi(apiClient)
resp, r, err := api.CreateChildOrg(ctx, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `OrganizationsApi.CreateChildOrg`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `OrganizationsApi.CreateChildOrg`:\n%s\n", responseContent)
}
Instructions
First install the library and its dependencies and then save the example to main.go and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"// Create a child organization returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.OrganizationsApi;
import com.datadog.api.client.v1.model.OrganizationBilling;
import com.datadog.api.client.v1.model.OrganizationCreateBody;
import com.datadog.api.client.v1.model.OrganizationCreateResponse;
import com.datadog.api.client.v1.model.OrganizationSubscription;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
OrganizationsApi apiInstance = new OrganizationsApi(defaultClient);
OrganizationCreateBody body =
new OrganizationCreateBody()
.billing(new OrganizationBilling().type("parent_billing"))
.name("New child org")
.subscription(new OrganizationSubscription().type("pro"));
try {
OrganizationCreateResponse result = apiInstance.createChildOrg(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling OrganizationsApi#createChildOrg");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Instructions
First install the library and its dependencies and then save the example to Example.java and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java""""
Create a child organization returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.organizations_api import OrganizationsApi
from datadog_api_client.v1.model.organization_billing import OrganizationBilling
from datadog_api_client.v1.model.organization_create_body import OrganizationCreateBody
from datadog_api_client.v1.model.organization_subscription import OrganizationSubscription
body = OrganizationCreateBody(
billing=OrganizationBilling(
type="parent_billing",
),
name="New child org",
subscription=OrganizationSubscription(
type="pro",
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = OrganizationsApi(api_client)
response = api_instance.create_child_org(body=body)
print(response)
Instructions
First install the library and its dependencies and then save the example to example.py and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"# Create a child organization returns "OK" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V1::OrganizationsAPI.new
body = DatadogAPIClient::V1::OrganizationCreateBody.new({
billing: DatadogAPIClient::V1::OrganizationBilling.new({
type: "parent_billing",
}),
name: "New child org",
subscription: DatadogAPIClient::V1::OrganizationSubscription.new({
type: "pro",
}),
})
p api_instance.create_child_org(body)
Instructions
First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"// Create a child organization returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_organizations::OrganizationsAPI;
use datadog_api_client::datadogV1::model::OrganizationBilling;
use datadog_api_client::datadogV1::model::OrganizationCreateBody;
use datadog_api_client::datadogV1::model::OrganizationSubscription;
#[tokio::main]
async fn main() {
let body = OrganizationCreateBody::new("New child org".to_string())
.billing(OrganizationBilling::new().type_("parent_billing".to_string()))
.subscription(OrganizationSubscription::new().type_("pro".to_string()));
let configuration = datadog::Configuration::new();
let api = OrganizationsAPI::with_config(configuration);
let resp = api.create_child_org(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Instructions
First install the library and its dependencies and then save the example to src/main.rs and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run/**
* Create a child organization returns "OK" response
*/
import { client, v1 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
const apiInstance = new v1.OrganizationsApi(configuration);
const params: v1.OrganizationsApiCreateChildOrgRequest = {
body: {
billing: {
type: "parent_billing",
},
name: "New child org",
subscription: {
type: "pro",
},
},
};
apiInstance
.createChildOrg(params)
.then((data: v1.OrganizationCreateResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
Instructions
First install the library and its dependencies and then save the example to example.ts and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"