Add Okta account
https://api.datadoghq.com/api/v2/integrations/okta/accountshttps://api.us3.datadoghq.com/api/v2/integrations/okta/accountshttps://api.us5.datadoghq.com/api/v2/integrations/okta/accountshttps://api.datadoghq.eu/api/v2/integrations/okta/accountshttps://api.ap1.datadoghq.com/api/v2/integrations/okta/accountshttps://api.ap2.datadoghq.com/api/v2/integrations/okta/accountshttps://api.uk1.datadoghq.com/api/v2/integrations/okta/accountshttps://api.ddog-gov.com/api/v2/integrations/okta/accountshttps://api.us2.ddog-gov.com/api/v2/integrations/okta/accountsOverview
Create an Okta account.
Request
Body Data (required)
data [required]Schema for an Okta account.
attributes [required]Attributes object for an Okta account.
api_keyThe API key of the Okta account.
auth_method [required]The authorization method for an Okta account.
client_idThe Client ID of an Okta app integration.
client_secretThe client secret of an Okta app integration.
domain [required]The domain of the Okta account.
name [required]The name of the Okta account.
idThe ID of the Okta account, a UUID hash of the account name.
type [required]Account type for an Okta account.
okta-accountsokta-accounts{
"data": {
"attributes": {
"auth_method": "oauth",
"domain": "https://example.okta.com/",
"name": "exampleoktaintegration",
"client_id": "client_id",
"client_secret": "client_secret"
},
"id": "f749daaf-682e-4208-a38d-c9b43162c609",
"type": "okta-accounts"
}
}Response
OK
Response object for an Okta account.
dataSchema for an Okta account.
attributes [required]Attributes object for an Okta account.
auth_method [required]The authorization method for an Okta account.
client_idThe Client ID of an Okta app integration.
domain [required]The domain of the Okta account.
name [required]The name of the Okta account.
idThe ID of the Okta account, a UUID hash of the account name.
type [required]Account type for an Okta account.
okta-accountsokta-accounts{
"data": {
"attributes": {
"auth_method": "oauth",
"client_id": "string",
"domain": "https://example.okta.com/",
"name": "Okta-Prod"
},
"id": "f749daaf-682e-4208-a38d-c9b43162c609",
"type": "okta-accounts"
}
}Bad Request
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Forbidden
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Not Found
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Too many requests
API error response.
errors [required]A list of errors.
{
"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/v2/integrations/okta/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"auth_method": "oauth",
"domain": "https://example.okta.com/",
"name": "exampleoktaintegration",
"client_id": "client_id",
"client_secret": "client_secret"
},
"id": "f749daaf-682e-4208-a38d-c9b43162c609",
"type": "okta-accounts"
}
}
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/v2/integrations/okta/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"auth_method": "oauth",
"domain": "https://example.okta.com/",
"name": "exampleoktaintegration",
"client_id": "client_id",
"client_secret": "client_secret"
},
"id": "f749daaf-682e-4208-a38d-c9b43162c609",
"type": "okta-accounts"
}
}
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/v2/integrations/okta/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"auth_method": "oauth",
"domain": "https://example.okta.com/",
"name": "exampleoktaintegration",
"client_id": "client_id",
"client_secret": "client_secret"
},
"id": "f749daaf-682e-4208-a38d-c9b43162c609",
"type": "okta-accounts"
}
}
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/v2/integrations/okta/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"auth_method": "oauth",
"domain": "https://example.okta.com/",
"name": "exampleoktaintegration",
"client_id": "client_id",
"client_secret": "client_secret"
},
"id": "f749daaf-682e-4208-a38d-c9b43162c609",
"type": "okta-accounts"
}
}
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/v2/integrations/okta/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"auth_method": "oauth",
"domain": "https://example.okta.com/",
"name": "exampleoktaintegration",
"client_id": "client_id",
"client_secret": "client_secret"
},
"id": "f749daaf-682e-4208-a38d-c9b43162c609",
"type": "okta-accounts"
}
}
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/v2/integrations/okta/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"auth_method": "oauth",
"domain": "https://example.okta.com/",
"name": "exampleoktaintegration",
"client_id": "client_id",
"client_secret": "client_secret"
},
"id": "f749daaf-682e-4208-a38d-c9b43162c609",
"type": "okta-accounts"
}
}
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/v2/integrations/okta/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"auth_method": "oauth",
"domain": "https://example.okta.com/",
"name": "exampleoktaintegration",
"client_id": "client_id",
"client_secret": "client_secret"
},
"id": "f749daaf-682e-4208-a38d-c9b43162c609",
"type": "okta-accounts"
}
}
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/v2/integrations/okta/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"auth_method": "oauth",
"domain": "https://example.okta.com/",
"name": "exampleoktaintegration",
"client_id": "client_id",
"client_secret": "client_secret"
},
"id": "f749daaf-682e-4208-a38d-c9b43162c609",
"type": "okta-accounts"
}
}
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/v2/integrations/okta/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"auth_method": "oauth",
"domain": "https://example.okta.com/",
"name": "exampleoktaintegration",
"client_id": "client_id",
"client_secret": "client_secret"
},
"id": "f749daaf-682e-4208-a38d-c9b43162c609",
"type": "okta-accounts"
}
}
EOF// Add Okta account 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/datadogV2"
)
func main() {
body := datadogV2.OktaAccountRequest{
Data: datadogV2.OktaAccount{
Attributes: datadogV2.OktaAccountAttributes{
AuthMethod: "oauth",
Domain: "https://example.okta.com/",
Name: "exampleoktaintegration",
ClientId: datadog.PtrString("client_id"),
ClientSecret: datadog.PtrString("client_secret"),
},
Id: datadog.PtrString("f749daaf-682e-4208-a38d-c9b43162c609"),
Type: datadogV2.OKTAACCOUNTTYPE_OKTA_ACCOUNTS,
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewOktaIntegrationApi(apiClient)
resp, r, err := api.CreateOktaAccount(ctx, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `OktaIntegrationApi.CreateOktaAccount`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `OktaIntegrationApi.CreateOktaAccount`:\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"// Add Okta account returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.OktaIntegrationApi;
import com.datadog.api.client.v2.model.OktaAccount;
import com.datadog.api.client.v2.model.OktaAccountAttributes;
import com.datadog.api.client.v2.model.OktaAccountRequest;
import com.datadog.api.client.v2.model.OktaAccountResponse;
import com.datadog.api.client.v2.model.OktaAccountType;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
OktaIntegrationApi apiInstance = new OktaIntegrationApi(defaultClient);
OktaAccountRequest body =
new OktaAccountRequest()
.data(
new OktaAccount()
.attributes(
new OktaAccountAttributes()
.authMethod("oauth")
.domain("https://example.okta.com/")
.name("exampleoktaintegration")
.clientId("client_id")
.clientSecret("client_secret"))
.id("f749daaf-682e-4208-a38d-c9b43162c609")
.type(OktaAccountType.OKTA_ACCOUNTS));
try {
OktaAccountResponse result = apiInstance.createOktaAccount(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling OktaIntegrationApi#createOktaAccount");
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""""
Add Okta account returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.okta_integration_api import OktaIntegrationApi
from datadog_api_client.v2.model.okta_account import OktaAccount
from datadog_api_client.v2.model.okta_account_attributes import OktaAccountAttributes
from datadog_api_client.v2.model.okta_account_request import OktaAccountRequest
from datadog_api_client.v2.model.okta_account_type import OktaAccountType
body = OktaAccountRequest(
data=OktaAccount(
attributes=OktaAccountAttributes(
auth_method="oauth",
domain="https://example.okta.com/",
name="exampleoktaintegration",
client_id="client_id",
client_secret="client_secret",
),
id="f749daaf-682e-4208-a38d-c9b43162c609",
type=OktaAccountType.OKTA_ACCOUNTS,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = OktaIntegrationApi(api_client)
response = api_instance.create_okta_account(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"# Add Okta account returns "OK" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::OktaIntegrationAPI.new
body = DatadogAPIClient::V2::OktaAccountRequest.new({
data: DatadogAPIClient::V2::OktaAccount.new({
attributes: DatadogAPIClient::V2::OktaAccountAttributes.new({
auth_method: "oauth",
domain: "https://example.okta.com/",
name: "exampleoktaintegration",
client_id: "client_id",
client_secret: "client_secret",
}),
id: "f749daaf-682e-4208-a38d-c9b43162c609",
type: DatadogAPIClient::V2::OktaAccountType::OKTA_ACCOUNTS,
}),
})
p api_instance.create_okta_account(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"// Add Okta account returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_okta_integration::OktaIntegrationAPI;
use datadog_api_client::datadogV2::model::OktaAccount;
use datadog_api_client::datadogV2::model::OktaAccountAttributes;
use datadog_api_client::datadogV2::model::OktaAccountRequest;
use datadog_api_client::datadogV2::model::OktaAccountType;
#[tokio::main]
async fn main() {
let body = OktaAccountRequest::new(
OktaAccount::new(
OktaAccountAttributes::new(
"oauth".to_string(),
"https://example.okta.com/".to_string(),
"exampleoktaintegration".to_string(),
)
.client_id("client_id".to_string())
.client_secret("client_secret".to_string()),
OktaAccountType::OKTA_ACCOUNTS,
)
.id("f749daaf-682e-4208-a38d-c9b43162c609".to_string()),
);
let configuration = datadog::Configuration::new();
let api = OktaIntegrationAPI::with_config(configuration);
let resp = api.create_okta_account(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/**
* Add Okta account returns "OK" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
const apiInstance = new v2.OktaIntegrationApi(configuration);
const params: v2.OktaIntegrationApiCreateOktaAccountRequest = {
body: {
data: {
attributes: {
authMethod: "oauth",
domain: "https://example.okta.com/",
name: "exampleoktaintegration",
clientId: "client_id",
clientSecret: "client_secret",
},
id: "f749daaf-682e-4208-a38d-c9b43162c609",
type: "okta-accounts",
},
},
};
apiInstance
.createOktaAccount(params)
.then((data: v2.OktaAccountResponse) => {
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"