키 관리

Datadog API와 애플리케이션 키를 관리하세요. 다음 엔드포인트와 상호 작용하려면 필요한 권한이 있는 사용자에게 API 키와 애플리케이션 키가 필요합니다. API와 애플리케이션 키 전체 목록은 Datadog API 페이지에서 확인할 수 있습니다.

GET https://api.ap1.datadoghq.com/api/v1/api_keyhttps://api.ap2.datadoghq.com/api/v1/api_keyhttps://api.datadoghq.eu/api/v1/api_keyhttps://api.ddog-gov.com/api/v1/api_keyhttps://api.us2.ddog-gov.com/api/v1/api_keyhttps://api.datadoghq.com/api/v1/api_keyhttps://api.us3.datadoghq.com/api/v1/api_keyhttps://api.us5.datadoghq.com/api/v1/api_key

개요

Get all API keys available for your account. This endpoint requires the api_keys_read permission.

응답

OK

List of API and application keys available for a given organization.

Expand All

항목

유형

설명

api_keys

[object]

Array of API keys.

created

string

Date of creation of the API key.

created_by

string

Datadog user handle that created the API key.

key

string

API key.

name

string

Name of your API key.

{
  "api_keys": [
    {
      "created_by": "test_user",
      "key": "1234512345123456abcabc912349abcd",
      "name": "app_key"
    }
  ]
}

Forbidden

Error response object.

Expand All

항목

유형

설명

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

항목

유형

설명

errors [required]

[string]

Array of errors returned by the API.

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

코드 사례

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/api_key" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get all API keys returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.key_management_api import KeyManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = KeyManagementApi(api_client)
    response = api_instance.list_api_keys()

    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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Get all API keys returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::KeyManagementAPI.new
p api_instance.list_api_keys()

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
// Get all API keys 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() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewKeyManagementApi(apiClient)
	resp, r, err := api.ListAPIKeys(ctx)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.ListAPIKeys`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.ListAPIKeys`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Get all API keys returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.KeyManagementApi;
import com.datadog.api.client.v1.model.ApiKeyListResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);

    try {
      ApiKeyListResponse result = apiInstance.listAPIKeys();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling KeyManagementApi#listAPIKeys");
      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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
// Get all API keys returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_key_management::KeyManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = KeyManagementAPI::with_config(configuration);
    let resp = api.list_api_keys().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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
/**
 * Get all API keys returns "OK" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.KeyManagementApi(configuration);

apiInstance
  .listAPIKeys()
  .then((data: v1.ApiKeyListResponse) => {
    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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v2/api_keyshttps://api.ap2.datadoghq.com/api/v2/api_keyshttps://api.datadoghq.eu/api/v2/api_keyshttps://api.ddog-gov.com/api/v2/api_keyshttps://api.us2.ddog-gov.com/api/v2/api_keyshttps://api.datadoghq.com/api/v2/api_keyshttps://api.us3.datadoghq.com/api/v2/api_keyshttps://api.us5.datadoghq.com/api/v2/api_keys

개요

List all API keys available for your account. This endpoint requires the api_keys_read permission.

인수

쿼리 문자열

이름

유형

설명

page[size]

integer

Size for a given page. The maximum allowed value is 100.

page[number]

integer

Specific page number to return.

sort

enum

API key attribute used to sort results. Sort order is ascending by default. In order to specify a descending sort, prefix the attribute with a minus sign.
Allowed enum values: created_at, -created_at, last4, -last4, modified_at, -modified_at, name, -name

filter

string

Filter API keys by the specified string.

filter[created_at][start]

string

Only include API keys created on or after the specified date.

filter[created_at][end]

string

Only include API keys created on or before the specified date.

filter[modified_at][start]

string

Only include API keys modified on or after the specified date.

filter[modified_at][end]

string

Only include API keys modified on or before the specified date.

include

string

Comma separated list of resource paths for related resources to include in the response. Supported resource paths are created_by and modified_by.

filter[remote_config_read_enabled]

boolean

Filter API keys by remote config read enabled status.

filter[category]

string

Filter API keys by category.

응답

OK

Response for a list of API keys.

Expand All

항목

유형

설명

data

[object]

Array of API keys.

attributes

object

Attributes of a partial API key.

category

string

The category of the API key.

created_at

string

Creation date of the API key.

date_last_used

date-time

Date the API Key was last used.

last4

string

The last four characters of the API key.

modified_at

string

Date the API key was last modified.

name

string

Name of the API key.

remote_config_read_enabled

boolean

The remote config read enabled status.

id

string

ID of the API key.

relationships

object

Resources related to the API key.

created_by

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

default: users

modified_by

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

default: users

type

enum

API Keys resource type. Allowed enum values: api_keys

default: api_keys

included

[ <oneOf>]

Array of objects related to the API key.

Option 1

object

User object returned by the API.

attributes

object

Attributes of user object returned by the API.

created_at

date-time

The ISO 8601 timestamp of when the user account was created.

disabled

boolean

Whether the user account is deactivated. Disabled users cannot log in.

email

string

The email address of the user, used for login and notifications.

handle

string

The unique handle (username) of the user, typically matching their email prefix.

icon

string

URL of the user's profile icon, typically a Gravatar URL derived from the email address.

last_login_time

date-time

The ISO 8601 timestamp of the user's most recent login, or null if the user has never logged in.

mfa_enabled

boolean

Whether multi-factor authentication (MFA) is enabled for the user's account.

modified_at

date-time

The ISO 8601 timestamp of when the user account was last modified.

name

string

The full display name of the user as shown in the Datadog UI.

service_account

boolean

Whether this is a service account rather than a human user. Service accounts are used for programmatic API access.

status

string

The current status of the user account (for example, Active, Pending, or Disabled).

title

string

The job title of the user (for example, "Senior Engineer" or "Product Manager").

uuid

string

The globally unique identifier (UUID) of the user.

verified

boolean

Whether the user's email address has been verified.

id

string

ID of the user.

relationships

object

Relationships of the user object returned by the API.

org

object

Relationship to an organization.

data [required]

object

Relationship to organization object.

id [required]

string

ID of the organization.

type [required]

enum

Organizations resource type. Allowed enum values: orgs

default: orgs

other_orgs

object

Relationship to organizations.

data [required]

[object]

Relationships to organization objects.

id [required]

string

ID of the organization.

type [required]

enum

Organizations resource type. Allowed enum values: orgs

default: orgs

other_users

object

Relationship to users.

data [required]

[object]

Relationships to user objects.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

default: users

roles

object

Relationship to roles.

data

[object]

An array containing type and the unique identifier of a role.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

default: roles

type

enum

Users resource type. Allowed enum values: users

default: users

Option 2

object

The definition of LeakedKey object.

attributes [required]

object

The definition of LeakedKeyAttributes object.

date [required]

date-time

The LeakedKeyAttributes date.

leak_source

string

The LeakedKeyAttributes leak_source.

id [required]

string

The LeakedKey id.

type [required]

enum

The definition of LeakedKeyType object. Allowed enum values: leaked_keys

default: leaked_keys

meta

object

Additional information related to api keys response.

max_allowed

int64

Max allowed number of API keys.

page

object

Additional information related to the API keys response.

total_filtered_count

int64

Total filtered application key count.

{
  "data": [
    {
      "attributes": {
        "category": "string",
        "created_at": "2020-11-23T10:00:00.000Z",
        "date_last_used": "2020-11-27T10:00:00.000Z",
        "last4": "abcd",
        "modified_at": "2020-11-23T10:00:00.000Z",
        "name": "API Key for submitting metrics",
        "remote_config_read_enabled": false
      },
      "id": "string",
      "relationships": {
        "created_by": {
          "data": {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "users"
          }
        },
        "modified_by": {
          "data": {
            "id": "00000000-0000-0000-0000-000000000000",
            "type": "users"
          }
        }
      },
      "type": "api_keys"
    }
  ],
  "included": [
    {
      "attributes": {
        "created_at": "2019-09-19T10:00:00.000Z",
        "disabled": false,
        "email": "string",
        "handle": "string",
        "icon": "string",
        "last_login_time": "2019-09-19T10:00:00.000Z",
        "mfa_enabled": false,
        "modified_at": "2019-09-19T10:00:00.000Z",
        "name": "string",
        "service_account": false,
        "status": "string",
        "title": "string",
        "uuid": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-beef-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-beef-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              "type": "roles"
            }
          ]
        }
      },
      "type": "users"
    }
  ],
  "meta": {
    "max_allowed": "integer",
    "page": {
      "total_filtered_count": "integer"
    }
  }
}

Bad Request

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

코드 사례

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/api_keys" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get all API keys returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.key_management_api import KeyManagementApi

# there is a valid "api_key" in the system
API_KEY_DATA_ATTRIBUTES_NAME = environ["API_KEY_DATA_ATTRIBUTES_NAME"]

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = KeyManagementApi(api_client)
    response = api_instance.list_api_keys(
        filter=API_KEY_DATA_ATTRIBUTES_NAME,
    )

    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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Get all API keys returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::KeyManagementAPI.new

# there is a valid "api_key" in the system
API_KEY_DATA_ATTRIBUTES_NAME = ENV["API_KEY_DATA_ATTRIBUTES_NAME"]
opts = {
  filter: API_KEY_DATA_ATTRIBUTES_NAME,
}
p api_instance.list_api_keys(opts)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
// Get all API keys 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() {
	// there is a valid "api_key" in the system
	APIKeyDataAttributesName := os.Getenv("API_KEY_DATA_ATTRIBUTES_NAME")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewKeyManagementApi(apiClient)
	resp, r, err := api.ListAPIKeys(ctx, *datadogV2.NewListAPIKeysOptionalParameters().WithFilter(APIKeyDataAttributesName))

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.ListAPIKeys`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.ListAPIKeys`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Get all API keys returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.KeyManagementApi;
import com.datadog.api.client.v2.api.KeyManagementApi.ListAPIKeysOptionalParameters;
import com.datadog.api.client.v2.model.APIKeysResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);

    // there is a valid "api_key" in the system
    String API_KEY_DATA_ATTRIBUTES_NAME = System.getenv("API_KEY_DATA_ATTRIBUTES_NAME");

    try {
      APIKeysResponse result =
          apiInstance.listAPIKeys(
              new ListAPIKeysOptionalParameters().filter(API_KEY_DATA_ATTRIBUTES_NAME));
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling KeyManagementApi#listAPIKeys");
      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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
// Get all API keys returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;
use datadog_api_client::datadogV2::api_key_management::ListAPIKeysOptionalParams;

#[tokio::main]
async fn main() {
    // there is a valid "api_key" in the system
    let api_key_data_attributes_name = std::env::var("API_KEY_DATA_ATTRIBUTES_NAME").unwrap();
    let configuration = datadog::Configuration::new();
    let api = KeyManagementAPI::with_config(configuration);
    let resp = api
        .list_api_keys(
            ListAPIKeysOptionalParams::default().filter(api_key_data_attributes_name.clone()),
        )
        .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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
/**
 * Get all API keys returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.KeyManagementApi(configuration);

// there is a valid "api_key" in the system
const API_KEY_DATA_ATTRIBUTES_NAME = process.env
  .API_KEY_DATA_ATTRIBUTES_NAME as string;

const params: v2.KeyManagementApiListAPIKeysRequest = {
  filter: API_KEY_DATA_ATTRIBUTES_NAME,
};

apiInstance
  .listAPIKeys(params)
  .then((data: v2.APIKeysResponse) => {
    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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v1/api_keyhttps://api.ap2.datadoghq.com/api/v1/api_keyhttps://api.datadoghq.eu/api/v1/api_keyhttps://api.ddog-gov.com/api/v1/api_keyhttps://api.us2.ddog-gov.com/api/v1/api_keyhttps://api.datadoghq.com/api/v1/api_keyhttps://api.us3.datadoghq.com/api/v1/api_keyhttps://api.us5.datadoghq.com/api/v1/api_key

개요

Creates an API key with a given name. This endpoint requires the api_keys_write permission.

요청

Body Data (required)

Expand All

항목

유형

설명

created

string

Date of creation of the API key.

created_by

string

Datadog user handle that created the API key.

key

string

API key.

name

string

Name of your API key.

{
  "name": "example user"
}

응답

OK

An API key with its associated metadata.

Expand All

항목

유형

설명

api_key

object

Datadog API key.

created

string

Date of creation of the API key.

created_by

string

Datadog user handle that created the API key.

key

string

API key.

name

string

Name of your API key.

{
  "api_key": {
    "created_by": "test_user",
    "key": "1234512345123456abcabc912349abcd",
    "name": "app_key"
  }
}

Bad Request

Error response object.

Expand All

항목

유형

설명

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

항목

유형

설명

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

항목

유형

설명

errors [required]

[string]

Array of errors returned by the API.

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

코드 사례

                  ## default
# 

# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/api_key" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "name": "example key" } EOF
"""
Create an API key returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.key_management_api import KeyManagementApi
from datadog_api_client.v1.model.api_key import ApiKey

body = ApiKey(
    name="example user",
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = KeyManagementApi(api_client)
    response = api_instance.create_api_key(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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Create an API key returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::KeyManagementAPI.new

body = DatadogAPIClient::V1::ApiKey.new({
  name: "example user",
})
p api_instance.create_api_key(body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
// Create an API key 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.ApiKey{
		Name: datadog.PtrString("example user"),
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewKeyManagementApi(apiClient)
	resp, r, err := api.CreateAPIKey(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.CreateAPIKey`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.CreateAPIKey`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Create an API key returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.KeyManagementApi;
import com.datadog.api.client.v1.model.ApiKey;
import com.datadog.api.client.v1.model.ApiKeyResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);

    ApiKey body = new ApiKey().name("example user");

    try {
      ApiKeyResponse result = apiInstance.createAPIKey(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling KeyManagementApi#createAPIKey");
      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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
// Create an API key returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_key_management::KeyManagementAPI;
use datadog_api_client::datadogV1::model::ApiKey;

#[tokio::main]
async fn main() {
    let body = ApiKey::new().name("example user".to_string());
    let configuration = datadog::Configuration::new();
    let api = KeyManagementAPI::with_config(configuration);
    let resp = api.create_api_key(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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
/**
 * Create an API key returns "OK" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.KeyManagementApi(configuration);

const params: v1.KeyManagementApiCreateAPIKeyRequest = {
  body: {
    name: "example user",
  },
};

apiInstance
  .createAPIKey(params)
  .then((data: v1.ApiKeyResponse) => {
    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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v2/api_keyshttps://api.ap2.datadoghq.com/api/v2/api_keyshttps://api.datadoghq.eu/api/v2/api_keyshttps://api.ddog-gov.com/api/v2/api_keyshttps://api.us2.ddog-gov.com/api/v2/api_keyshttps://api.datadoghq.com/api/v2/api_keyshttps://api.us3.datadoghq.com/api/v2/api_keyshttps://api.us5.datadoghq.com/api/v2/api_keys

개요

Create an API key. This endpoint requires the api_keys_write permission.

요청

Body Data (required)

Expand All

항목

유형

설명

data [required]

object

Object used to create an API key.

attributes [required]

object

Attributes used to create an API Key.

category

string

The APIKeyCreateAttributes category.

name [required]

string

Name of the API key.

remote_config_read_enabled

boolean

The APIKeyCreateAttributes remote_config_read_enabled.

type [required]

enum

API Keys resource type. Allowed enum values: api_keys

default: api_keys

{
  "data": {
    "type": "api_keys",
    "attributes": {
      "name": "Example-Key-Management"
    }
  }
}

응답

Created

Response for retrieving an API key.

Expand All

항목

유형

설명

data

object

Datadog API key.

attributes

object

Attributes of a full API key.

category

string

The category of the API key.

created_at

date-time

Creation date of the API key.

date_last_used

date-time

Date the API Key was last used

key

string

The API key.

last4

string

The last four characters of the API key.

modified_at

date-time

Date the API key was last modified.

name

string

Name of the API key.

remote_config_read_enabled

boolean

The remote config read enabled status.

id

string

ID of the API key.

relationships

object

Resources related to the API key.

created_by

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

default: users

modified_by

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

default: users

type

enum

API Keys resource type. Allowed enum values: api_keys

default: api_keys

included

[ <oneOf>]

Array of objects related to the API key.

Option 1

object

User object returned by the API.

attributes

object

Attributes of user object returned by the API.

created_at

date-time

The ISO 8601 timestamp of when the user account was created.

disabled

boolean

Whether the user account is deactivated. Disabled users cannot log in.

email

string

The email address of the user, used for login and notifications.

handle

string

The unique handle (username) of the user, typically matching their email prefix.

icon

string

URL of the user's profile icon, typically a Gravatar URL derived from the email address.

last_login_time

date-time

The ISO 8601 timestamp of the user's most recent login, or null if the user has never logged in.

mfa_enabled

boolean

Whether multi-factor authentication (MFA) is enabled for the user's account.

modified_at

date-time

The ISO 8601 timestamp of when the user account was last modified.

name

string

The full display name of the user as shown in the Datadog UI.

service_account

boolean

Whether this is a service account rather than a human user. Service accounts are used for programmatic API access.

status

string

The current status of the user account (for example, Active, Pending, or Disabled).

title

string

The job title of the user (for example, "Senior Engineer" or "Product Manager").

uuid

string

The globally unique identifier (UUID) of the user.

verified

boolean

Whether the user's email address has been verified.

id

string

ID of the user.

relationships

object

Relationships of the user object returned by the API.

org

object

Relationship to an organization.

data [required]

object

Relationship to organization object.

id [required]

string

ID of the organization.

type [required]

enum

Organizations resource type. Allowed enum values: orgs

default: orgs

other_orgs

object

Relationship to organizations.

data [required]

[object]

Relationships to organization objects.

id [required]

string

ID of the organization.

type [required]

enum

Organizations resource type. Allowed enum values: orgs

default: orgs

other_users

object

Relationship to users.

data [required]

[object]

Relationships to user objects.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

default: users

roles

object

Relationship to roles.

data

[object]

An array containing type and the unique identifier of a role.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

default: roles

type

enum

Users resource type. Allowed enum values: users

default: users

Option 2

object

The definition of LeakedKey object.

attributes [required]

object

The definition of LeakedKeyAttributes object.

date [required]

date-time

The LeakedKeyAttributes date.

leak_source

string

The LeakedKeyAttributes leak_source.

id [required]

string

The LeakedKey id.

type [required]

enum

The definition of LeakedKeyType object. Allowed enum values: leaked_keys

default: leaked_keys

{
  "data": {
    "attributes": {
      "category": "string",
      "created_at": "2020-11-23T10:00:00.000Z",
      "date_last_used": "2020-11-27T10:00:00.000Z",
      "key": "string",
      "last4": "abcd",
      "modified_at": "2020-11-23T10:00:00.000Z",
      "name": "API Key for submitting metrics",
      "remote_config_read_enabled": false
    },
    "id": "string",
    "relationships": {
      "created_by": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      },
      "modified_by": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "users"
        }
      }
    },
    "type": "api_keys"
  },
  "included": [
    {
      "attributes": {
        "created_at": "2019-09-19T10:00:00.000Z",
        "disabled": false,
        "email": "string",
        "handle": "string",
        "icon": "string",
        "last_login_time": "2019-09-19T10:00:00.000Z",
        "mfa_enabled": false,
        "modified_at": "2019-09-19T10:00:00.000Z",
        "name": "string",
        "service_account": false,
        "status": "string",
        "title": "string",
        "uuid": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-beef-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-beef-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              "type": "roles"
            }
          ]
        }
      },
      "type": "users"
    }
  ]
}

Bad Request

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

코드 사례

                          ## default
# 

# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/api_keys" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "name": "API Key for submitting metrics" }, "type": "api_keys" } } EOF
// Create an API key returns "Created" 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.APIKeyCreateRequest{
		Data: datadogV2.APIKeyCreateData{
			Type: datadogV2.APIKEYSTYPE_API_KEYS,
			Attributes: datadogV2.APIKeyCreateAttributes{
				Name: "Example-Key-Management",
			},
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewKeyManagementApi(apiClient)
	resp, r, err := api.CreateAPIKey(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.CreateAPIKey`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.CreateAPIKey`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Create an API key returns "Created" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.KeyManagementApi;
import com.datadog.api.client.v2.model.APIKeyCreateAttributes;
import com.datadog.api.client.v2.model.APIKeyCreateData;
import com.datadog.api.client.v2.model.APIKeyCreateRequest;
import com.datadog.api.client.v2.model.APIKeyResponse;
import com.datadog.api.client.v2.model.APIKeysType;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);

    APIKeyCreateRequest body =
        new APIKeyCreateRequest()
            .data(
                new APIKeyCreateData()
                    .type(APIKeysType.API_KEYS)
                    .attributes(new APIKeyCreateAttributes().name("Example-Key-Management")));

    try {
      APIKeyResponse result = apiInstance.createAPIKey(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling KeyManagementApi#createAPIKey");
      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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
"""
Create an API key returns "Created" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.key_management_api import KeyManagementApi
from datadog_api_client.v2.model.api_key_create_attributes import APIKeyCreateAttributes
from datadog_api_client.v2.model.api_key_create_data import APIKeyCreateData
from datadog_api_client.v2.model.api_key_create_request import APIKeyCreateRequest
from datadog_api_client.v2.model.api_keys_type import APIKeysType

body = APIKeyCreateRequest(
    data=APIKeyCreateData(
        type=APIKeysType.API_KEYS,
        attributes=APIKeyCreateAttributes(
            name="Example-Key-Management",
        ),
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = KeyManagementApi(api_client)
    response = api_instance.create_api_key(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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Create an API key returns "Created" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::KeyManagementAPI.new

body = DatadogAPIClient::V2::APIKeyCreateRequest.new({
  data: DatadogAPIClient::V2::APIKeyCreateData.new({
    type: DatadogAPIClient::V2::APIKeysType::API_KEYS,
    attributes: DatadogAPIClient::V2::APIKeyCreateAttributes.new({
      name: "Example-Key-Management",
    }),
  }),
})
p api_instance.create_api_key(body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
// Create an API key returns "Created" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;
use datadog_api_client::datadogV2::model::APIKeyCreateAttributes;
use datadog_api_client::datadogV2::model::APIKeyCreateData;
use datadog_api_client::datadogV2::model::APIKeyCreateRequest;
use datadog_api_client::datadogV2::model::APIKeysType;

#[tokio::main]
async fn main() {
    let body = APIKeyCreateRequest::new(APIKeyCreateData::new(
        APIKeyCreateAttributes::new("Example-Key-Management".to_string()),
        APIKeysType::API_KEYS,
    ));
    let configuration = datadog::Configuration::new();
    let api = KeyManagementAPI::with_config(configuration);
    let resp = api.create_api_key(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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
/**
 * Create an API key returns "Created" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.KeyManagementApi(configuration);

const params: v2.KeyManagementApiCreateAPIKeyRequest = {
  body: {
    data: {
      type: "api_keys",
      attributes: {
        name: "Example-Key-Management",
      },
    },
  },
};

apiInstance
  .createAPIKey(params)
  .then((data: v2.APIKeyResponse) => {
    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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v1/api_key/{key}https://api.ap2.datadoghq.com/api/v1/api_key/{key}https://api.datadoghq.eu/api/v1/api_key/{key}https://api.ddog-gov.com/api/v1/api_key/{key}https://api.us2.ddog-gov.com/api/v1/api_key/{key}https://api.datadoghq.com/api/v1/api_key/{key}https://api.us3.datadoghq.com/api/v1/api_key/{key}https://api.us5.datadoghq.com/api/v1/api_key/{key}

개요

Get a given API key. This endpoint requires the api_keys_read permission.

인수

경로 파라미터

이름

유형

설명

key [required]

string

The specific API key you are working with.

응답

OK

An API key with its associated metadata.

Expand All

항목

유형

설명

api_key

object

Datadog API key.

created

string

Date of creation of the API key.

created_by

string

Datadog user handle that created the API key.

key

string

API key.

name

string

Name of your API key.

{
  "api_key": {
    "created_by": "test_user",
    "key": "1234512345123456abcabc912349abcd",
    "name": "app_key"
  }
}

Forbidden

Error response object.

Expand All

항목

유형

설명

errors [required]

[string]

Array of errors returned by the API.

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

Not Found

Error response object.

Expand All

항목

유형

설명

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

항목

유형

설명

errors [required]

[string]

Array of errors returned by the API.

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

코드 사례

                  # Path parameters
export key="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/api_key/${key}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get API key returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.key_management_api import KeyManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = KeyManagementApi(api_client)
    response = api_instance.get_api_key(
        key="key",
    )

    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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Get API key returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::KeyManagementAPI.new
p api_instance.get_api_key("key")

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
// Get API key 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() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewKeyManagementApi(apiClient)
	resp, r, err := api.GetAPIKey(ctx, "key")

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.GetAPIKey`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.GetAPIKey`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Get API key returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.KeyManagementApi;
import com.datadog.api.client.v1.model.ApiKeyResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);

    try {
      ApiKeyResponse result = apiInstance.getAPIKey("key");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling KeyManagementApi#getAPIKey");
      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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
// Get API key returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_key_management::KeyManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = KeyManagementAPI::with_config(configuration);
    let resp = api.get_api_key("key".to_string()).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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
/**
 * Get API key returns "OK" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.KeyManagementApi(configuration);

const params: v1.KeyManagementApiGetAPIKeyRequest = {
  key: "key",
};

apiInstance
  .getAPIKey(params)
  .then((data: v1.ApiKeyResponse) => {
    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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v2/api_keys/{api_key_id}https://api.ap2.datadoghq.com/api/v2/api_keys/{api_key_id}https://api.datadoghq.eu/api/v2/api_keys/{api_key_id}https://api.ddog-gov.com/api/v2/api_keys/{api_key_id}https://api.us2.ddog-gov.com/api/v2/api_keys/{api_key_id}https://api.datadoghq.com/api/v2/api_keys/{api_key_id}https://api.us3.datadoghq.com/api/v2/api_keys/{api_key_id}https://api.us5.datadoghq.com/api/v2/api_keys/{api_key_id}

개요

Get an API key. This endpoint requires the api_keys_read permission.

인수

경로 파라미터

이름

유형

설명

api_key_id [required]

string

The ID of the API key.

쿼리 문자열

이름

유형

설명

include

string

Comma separated list of resource paths for related resources to include in the response. Supported resource paths are created_by and modified_by.

응답

OK

Response for retrieving an API key.

Expand All

항목

유형

설명

data

object

Datadog API key.

attributes

object

Attributes of a full API key.

category

string

The category of the API key.

created_at

date-time

Creation date of the API key.

date_last_used

date-time

Date the API Key was last used

key

string

The API key.

last4

string

The last four characters of the API key.

modified_at

date-time

Date the API key was last modified.

name

string

Name of the API key.

remote_config_read_enabled

boolean

The remote config read enabled status.

id

string

ID of the API key.

relationships

object

Resources related to the API key.

created_by

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

default: users

modified_by

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

default: users

type

enum

API Keys resource type. Allowed enum values: api_keys

default: api_keys

included

[ <oneOf>]

Array of objects related to the API key.

Option 1

object

User object returned by the API.

attributes

object

Attributes of user object returned by the API.

created_at

date-time

The ISO 8601 timestamp of when the user account was created.

disabled

boolean

Whether the user account is deactivated. Disabled users cannot log in.

email

string

The email address of the user, used for login and notifications.

handle

string

The unique handle (username) of the user, typically matching their email prefix.

icon

string

URL of the user's profile icon, typically a Gravatar URL derived from the email address.

last_login_time

date-time

The ISO 8601 timestamp of the user's most recent login, or null if the user has never logged in.

mfa_enabled

boolean

Whether multi-factor authentication (MFA) is enabled for the user's account.

modified_at

date-time

The ISO 8601 timestamp of when the user account was last modified.

name

string

The full display name of the user as shown in the Datadog UI.

service_account

boolean

Whether this is a service account rather than a human user. Service accounts are used for programmatic API access.

status

string

The current status of the user account (for example, Active, Pending, or Disabled).

title

string

The job title of the user (for example, "Senior Engineer" or "Product Manager").

uuid

string

The globally unique identifier (UUID) of the user.

verified

boolean

Whether the user's email address has been verified.

id

string

ID of the user.

relationships

object

Relationships of the user object returned by the API.

org

object

Relationship to an organization.

data [required]

object

Relationship to organization object.

id [required]

string

ID of the organization.

type [required]

enum

Organizations resource type. Allowed enum values: orgs

default: orgs

other_orgs

object

Relationship to organizations.

data [required]

[object]

Relationships to organization objects.

id [required]

string

ID of the organization.

type [required]

enum

Organizations resource type. Allowed enum values: orgs

default: orgs

other_users

object

Relationship to users.

data [required]

[object]

Relationships to user objects.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

default: users

roles

object

Relationship to roles.

data

[object]

An array containing type and the unique identifier of a role.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

default: roles

type

enum

Users resource type. Allowed enum values: users

default: users

Option 2

object

The definition of LeakedKey object.

attributes [required]

object

The definition of LeakedKeyAttributes object.

date [required]

date-time

The LeakedKeyAttributes date.

leak_source

string

The LeakedKeyAttributes leak_source.

id [required]

string

The LeakedKey id.

type [required]

enum

The definition of LeakedKeyType object. Allowed enum values: leaked_keys

default: leaked_keys

{
  "data": {
    "attributes": {
      "category": "string",
      "created_at": "2020-11-23T10:00:00.000Z",
      "date_last_used": "2020-11-27T10:00:00.000Z",
      "key": "string",
      "last4": "abcd",
      "modified_at": "2020-11-23T10:00:00.000Z",
      "name": "API Key for submitting metrics",
      "remote_config_read_enabled": false
    },
    "id": "string",
    "relationships": {
      "created_by": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      },
      "modified_by": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "users"
        }
      }
    },
    "type": "api_keys"
  },
  "included": [
    {
      "attributes": {
        "created_at": "2019-09-19T10:00:00.000Z",
        "disabled": false,
        "email": "string",
        "handle": "string",
        "icon": "string",
        "last_login_time": "2019-09-19T10:00:00.000Z",
        "mfa_enabled": false,
        "modified_at": "2019-09-19T10:00:00.000Z",
        "name": "string",
        "service_account": false,
        "status": "string",
        "title": "string",
        "uuid": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-beef-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-beef-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              "type": "roles"
            }
          ]
        }
      },
      "type": "users"
    }
  ]
}

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

코드 사례

                  # Path parameters
export api_key_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/api_keys/${api_key_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get API key returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.key_management_api import KeyManagementApi

# there is a valid "api_key" in the system
API_KEY_DATA_ID = environ["API_KEY_DATA_ID"]

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = KeyManagementApi(api_client)
    response = api_instance.get_api_key(
        api_key_id=API_KEY_DATA_ID,
    )

    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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Get API key returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::KeyManagementAPI.new

# there is a valid "api_key" in the system
API_KEY_DATA_ID = ENV["API_KEY_DATA_ID"]
p api_instance.get_api_key(API_KEY_DATA_ID)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
// Get API key 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() {
	// there is a valid "api_key" in the system
	APIKeyDataID := os.Getenv("API_KEY_DATA_ID")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewKeyManagementApi(apiClient)
	resp, r, err := api.GetAPIKey(ctx, APIKeyDataID, *datadogV2.NewGetAPIKeyOptionalParameters())

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.GetAPIKey`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.GetAPIKey`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Get API key returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.KeyManagementApi;
import com.datadog.api.client.v2.model.APIKeyResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);

    // there is a valid "api_key" in the system
    String API_KEY_DATA_ID = System.getenv("API_KEY_DATA_ID");

    try {
      APIKeyResponse result = apiInstance.getAPIKey(API_KEY_DATA_ID);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling KeyManagementApi#getAPIKey");
      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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
// Get API key returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_key_management::GetAPIKeyOptionalParams;
use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;

#[tokio::main]
async fn main() {
    // there is a valid "api_key" in the system
    let api_key_data_id = std::env::var("API_KEY_DATA_ID").unwrap();
    let configuration = datadog::Configuration::new();
    let api = KeyManagementAPI::with_config(configuration);
    let resp = api
        .get_api_key(api_key_data_id.clone(), GetAPIKeyOptionalParams::default())
        .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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
/**
 * Get API key returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.KeyManagementApi(configuration);

// there is a valid "api_key" in the system
const API_KEY_DATA_ID = process.env.API_KEY_DATA_ID as string;

const params: v2.KeyManagementApiGetAPIKeyRequest = {
  apiKeyId: API_KEY_DATA_ID,
};

apiInstance
  .getAPIKey(params)
  .then((data: v2.APIKeyResponse) => {
    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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

PUT https://api.ap1.datadoghq.com/api/v1/api_key/{key}https://api.ap2.datadoghq.com/api/v1/api_key/{key}https://api.datadoghq.eu/api/v1/api_key/{key}https://api.ddog-gov.com/api/v1/api_key/{key}https://api.us2.ddog-gov.com/api/v1/api_key/{key}https://api.datadoghq.com/api/v1/api_key/{key}https://api.us3.datadoghq.com/api/v1/api_key/{key}https://api.us5.datadoghq.com/api/v1/api_key/{key}

개요

Edit an API key name. This endpoint requires the api_keys_write permission.

인수

경로 파라미터

이름

유형

설명

key [required]

string

The specific API key you are working with.

요청

Body Data (required)

Expand All

항목

유형

설명

created

string

Date of creation of the API key.

created_by

string

Datadog user handle that created the API key.

key

string

API key.

name

string

Name of your API key.

{
  "name": "example user"
}

응답

OK

An API key with its associated metadata.

Expand All

항목

유형

설명

api_key

object

Datadog API key.

created

string

Date of creation of the API key.

created_by

string

Datadog user handle that created the API key.

key

string

API key.

name

string

Name of your API key.

{
  "api_key": {
    "created_by": "test_user",
    "key": "1234512345123456abcabc912349abcd",
    "name": "app_key"
  }
}

Bad Request

Error response object.

Expand All

항목

유형

설명

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

항목

유형

설명

errors [required]

[string]

Array of errors returned by the API.

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

Not Found

Error response object.

Expand All

항목

유형

설명

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

항목

유형

설명

errors [required]

[string]

Array of errors returned by the API.

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

코드 사례

                  ## default
# 

# Path parameters
export key="CHANGE_ME"
# Curl command
curl -X PUT "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/api_key/${key}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "name": "example key" } EOF
"""
Edit an API key returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.key_management_api import KeyManagementApi
from datadog_api_client.v1.model.api_key import ApiKey

body = ApiKey(
    name="example user",
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = KeyManagementApi(api_client)
    response = api_instance.update_api_key(key="key", 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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Edit an API key returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::KeyManagementAPI.new

body = DatadogAPIClient::V1::ApiKey.new({
  name: "example user",
})
p api_instance.update_api_key("key", body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
// Edit an API key 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.ApiKey{
		Name: datadog.PtrString("example user"),
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewKeyManagementApi(apiClient)
	resp, r, err := api.UpdateAPIKey(ctx, "key", body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.UpdateAPIKey`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.UpdateAPIKey`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Edit an API key returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.KeyManagementApi;
import com.datadog.api.client.v1.model.ApiKey;
import com.datadog.api.client.v1.model.ApiKeyResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);

    ApiKey body = new ApiKey().name("example user");

    try {
      ApiKeyResponse result = apiInstance.updateAPIKey("key", body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling KeyManagementApi#updateAPIKey");
      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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
// Edit an API key returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_key_management::KeyManagementAPI;
use datadog_api_client::datadogV1::model::ApiKey;

#[tokio::main]
async fn main() {
    let body = ApiKey::new().name("example user".to_string());
    let configuration = datadog::Configuration::new();
    let api = KeyManagementAPI::with_config(configuration);
    let resp = api.update_api_key("key".to_string(), 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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
/**
 * Edit an API key returns "OK" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.KeyManagementApi(configuration);

const params: v1.KeyManagementApiUpdateAPIKeyRequest = {
  body: {
    name: "example user",
  },
  key: "key",
};

apiInstance
  .updateAPIKey(params)
  .then((data: v1.ApiKeyResponse) => {
    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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

PATCH https://api.ap1.datadoghq.com/api/v2/api_keys/{api_key_id}https://api.ap2.datadoghq.com/api/v2/api_keys/{api_key_id}https://api.datadoghq.eu/api/v2/api_keys/{api_key_id}https://api.ddog-gov.com/api/v2/api_keys/{api_key_id}https://api.us2.ddog-gov.com/api/v2/api_keys/{api_key_id}https://api.datadoghq.com/api/v2/api_keys/{api_key_id}https://api.us3.datadoghq.com/api/v2/api_keys/{api_key_id}https://api.us5.datadoghq.com/api/v2/api_keys/{api_key_id}

개요

Update an API key. This endpoint requires the api_keys_write permission.

인수

경로 파라미터

이름

유형

설명

api_key_id [required]

string

The ID of the API key.

요청

Body Data (required)

Expand All

항목

유형

설명

data [required]

object

Object used to update an API key.

attributes [required]

object

Attributes used to update an API Key.

category

string

The APIKeyUpdateAttributes category.

name [required]

string

Name of the API key.

remote_config_read_enabled

boolean

The APIKeyUpdateAttributes remote_config_read_enabled.

id [required]

string

ID of the API key.

type [required]

enum

API Keys resource type. Allowed enum values: api_keys

default: api_keys

{
  "data": {
    "type": "api_keys",
    "id": "string",
    "attributes": {
      "name": "Example-Key-Management"
    }
  }
}

응답

OK

Response for retrieving an API key.

Expand All

항목

유형

설명

data

object

Datadog API key.

attributes

object

Attributes of a full API key.

category

string

The category of the API key.

created_at

date-time

Creation date of the API key.

date_last_used

date-time

Date the API Key was last used

key

string

The API key.

last4

string

The last four characters of the API key.

modified_at

date-time

Date the API key was last modified.

name

string

Name of the API key.

remote_config_read_enabled

boolean

The remote config read enabled status.

id

string

ID of the API key.

relationships

object

Resources related to the API key.

created_by

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

default: users

modified_by

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

default: users

type

enum

API Keys resource type. Allowed enum values: api_keys

default: api_keys

included

[ <oneOf>]

Array of objects related to the API key.

Option 1

object

User object returned by the API.

attributes

object

Attributes of user object returned by the API.

created_at

date-time

The ISO 8601 timestamp of when the user account was created.

disabled

boolean

Whether the user account is deactivated. Disabled users cannot log in.

email

string

The email address of the user, used for login and notifications.

handle

string

The unique handle (username) of the user, typically matching their email prefix.

icon

string

URL of the user's profile icon, typically a Gravatar URL derived from the email address.

last_login_time

date-time

The ISO 8601 timestamp of the user's most recent login, or null if the user has never logged in.

mfa_enabled

boolean

Whether multi-factor authentication (MFA) is enabled for the user's account.

modified_at

date-time

The ISO 8601 timestamp of when the user account was last modified.

name

string

The full display name of the user as shown in the Datadog UI.

service_account

boolean

Whether this is a service account rather than a human user. Service accounts are used for programmatic API access.

status

string

The current status of the user account (for example, Active, Pending, or Disabled).

title

string

The job title of the user (for example, "Senior Engineer" or "Product Manager").

uuid

string

The globally unique identifier (UUID) of the user.

verified

boolean

Whether the user's email address has been verified.

id

string

ID of the user.

relationships

object

Relationships of the user object returned by the API.

org

object

Relationship to an organization.

data [required]

object

Relationship to organization object.

id [required]

string

ID of the organization.

type [required]

enum

Organizations resource type. Allowed enum values: orgs

default: orgs

other_orgs

object

Relationship to organizations.

data [required]

[object]

Relationships to organization objects.

id [required]

string

ID of the organization.

type [required]

enum

Organizations resource type. Allowed enum values: orgs

default: orgs

other_users

object

Relationship to users.

data [required]

[object]

Relationships to user objects.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

default: users

roles

object

Relationship to roles.

data

[object]

An array containing type and the unique identifier of a role.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

default: roles

type

enum

Users resource type. Allowed enum values: users

default: users

Option 2

object

The definition of LeakedKey object.

attributes [required]

object

The definition of LeakedKeyAttributes object.

date [required]

date-time

The LeakedKeyAttributes date.

leak_source

string

The LeakedKeyAttributes leak_source.

id [required]

string

The LeakedKey id.

type [required]

enum

The definition of LeakedKeyType object. Allowed enum values: leaked_keys

default: leaked_keys

{
  "data": {
    "attributes": {
      "category": "string",
      "created_at": "2020-11-23T10:00:00.000Z",
      "date_last_used": "2020-11-27T10:00:00.000Z",
      "key": "string",
      "last4": "abcd",
      "modified_at": "2020-11-23T10:00:00.000Z",
      "name": "API Key for submitting metrics",
      "remote_config_read_enabled": false
    },
    "id": "string",
    "relationships": {
      "created_by": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      },
      "modified_by": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "users"
        }
      }
    },
    "type": "api_keys"
  },
  "included": [
    {
      "attributes": {
        "created_at": "2019-09-19T10:00:00.000Z",
        "disabled": false,
        "email": "string",
        "handle": "string",
        "icon": "string",
        "last_login_time": "2019-09-19T10:00:00.000Z",
        "mfa_enabled": false,
        "modified_at": "2019-09-19T10:00:00.000Z",
        "name": "string",
        "service_account": false,
        "status": "string",
        "title": "string",
        "uuid": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-beef-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-beef-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              "type": "roles"
            }
          ]
        }
      },
      "type": "users"
    }
  ]
}

Bad Request

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

코드 사례

                          ## default
# 

# Path parameters
export api_key_id="CHANGE_ME"
# Curl command
curl -X PATCH "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/api_keys/${api_key_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "name": "API Key for submitting metrics" }, "id": "00112233-4455-6677-8899-aabbccddeeff", "type": "api_keys" } } EOF
// Edit an API key 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() {
	// there is a valid "api_key" in the system
	APIKeyDataID := os.Getenv("API_KEY_DATA_ID")

	body := datadogV2.APIKeyUpdateRequest{
		Data: datadogV2.APIKeyUpdateData{
			Type: datadogV2.APIKEYSTYPE_API_KEYS,
			Id:   APIKeyDataID,
			Attributes: datadogV2.APIKeyUpdateAttributes{
				Name: "Example-Key-Management",
			},
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewKeyManagementApi(apiClient)
	resp, r, err := api.UpdateAPIKey(ctx, APIKeyDataID, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.UpdateAPIKey`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.UpdateAPIKey`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Edit an API key returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.KeyManagementApi;
import com.datadog.api.client.v2.model.APIKeyResponse;
import com.datadog.api.client.v2.model.APIKeyUpdateAttributes;
import com.datadog.api.client.v2.model.APIKeyUpdateData;
import com.datadog.api.client.v2.model.APIKeyUpdateRequest;
import com.datadog.api.client.v2.model.APIKeysType;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);

    // there is a valid "api_key" in the system
    String API_KEY_DATA_ID = System.getenv("API_KEY_DATA_ID");

    APIKeyUpdateRequest body =
        new APIKeyUpdateRequest()
            .data(
                new APIKeyUpdateData()
                    .type(APIKeysType.API_KEYS)
                    .id(API_KEY_DATA_ID)
                    .attributes(new APIKeyUpdateAttributes().name("Example-Key-Management")));

    try {
      APIKeyResponse result = apiInstance.updateAPIKey(API_KEY_DATA_ID, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling KeyManagementApi#updateAPIKey");
      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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
"""
Edit an API key returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.key_management_api import KeyManagementApi
from datadog_api_client.v2.model.api_key_update_attributes import APIKeyUpdateAttributes
from datadog_api_client.v2.model.api_key_update_data import APIKeyUpdateData
from datadog_api_client.v2.model.api_key_update_request import APIKeyUpdateRequest
from datadog_api_client.v2.model.api_keys_type import APIKeysType

# there is a valid "api_key" in the system
API_KEY_DATA_ID = environ["API_KEY_DATA_ID"]

body = APIKeyUpdateRequest(
    data=APIKeyUpdateData(
        type=APIKeysType.API_KEYS,
        id=API_KEY_DATA_ID,
        attributes=APIKeyUpdateAttributes(
            name="Example-Key-Management",
        ),
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = KeyManagementApi(api_client)
    response = api_instance.update_api_key(api_key_id=API_KEY_DATA_ID, 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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Edit an API key returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::KeyManagementAPI.new

# there is a valid "api_key" in the system
API_KEY_DATA_ID = ENV["API_KEY_DATA_ID"]

body = DatadogAPIClient::V2::APIKeyUpdateRequest.new({
  data: DatadogAPIClient::V2::APIKeyUpdateData.new({
    type: DatadogAPIClient::V2::APIKeysType::API_KEYS,
    id: API_KEY_DATA_ID,
    attributes: DatadogAPIClient::V2::APIKeyUpdateAttributes.new({
      name: "Example-Key-Management",
    }),
  }),
})
p api_instance.update_api_key(API_KEY_DATA_ID, body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
// Edit an API key returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;
use datadog_api_client::datadogV2::model::APIKeyUpdateAttributes;
use datadog_api_client::datadogV2::model::APIKeyUpdateData;
use datadog_api_client::datadogV2::model::APIKeyUpdateRequest;
use datadog_api_client::datadogV2::model::APIKeysType;

#[tokio::main]
async fn main() {
    // there is a valid "api_key" in the system
    let api_key_data_id = std::env::var("API_KEY_DATA_ID").unwrap();
    let body = APIKeyUpdateRequest::new(APIKeyUpdateData::new(
        APIKeyUpdateAttributes::new("Example-Key-Management".to_string()),
        api_key_data_id.clone(),
        APIKeysType::API_KEYS,
    ));
    let configuration = datadog::Configuration::new();
    let api = KeyManagementAPI::with_config(configuration);
    let resp = api.update_api_key(api_key_data_id.clone(), 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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
/**
 * Edit an API key returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.KeyManagementApi(configuration);

// there is a valid "api_key" in the system
const API_KEY_DATA_ID = process.env.API_KEY_DATA_ID as string;

const params: v2.KeyManagementApiUpdateAPIKeyRequest = {
  body: {
    data: {
      type: "api_keys",
      id: API_KEY_DATA_ID,
      attributes: {
        name: "Example-Key-Management",
      },
    },
  },
  apiKeyId: API_KEY_DATA_ID,
};

apiInstance
  .updateAPIKey(params)
  .then((data: v2.APIKeyResponse) => {
    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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

DELETE https://api.ap1.datadoghq.com/api/v1/api_key/{key}https://api.ap2.datadoghq.com/api/v1/api_key/{key}https://api.datadoghq.eu/api/v1/api_key/{key}https://api.ddog-gov.com/api/v1/api_key/{key}https://api.us2.ddog-gov.com/api/v1/api_key/{key}https://api.datadoghq.com/api/v1/api_key/{key}https://api.us3.datadoghq.com/api/v1/api_key/{key}https://api.us5.datadoghq.com/api/v1/api_key/{key}

개요

Delete a given API key. This endpoint requires the api_keys_delete permission.

인수

경로 파라미터

이름

유형

설명

key [required]

string

The specific API key you are working with.

응답

OK

An API key with its associated metadata.

Expand All

항목

유형

설명

api_key

object

Datadog API key.

created

string

Date of creation of the API key.

created_by

string

Datadog user handle that created the API key.

key

string

API key.

name

string

Name of your API key.

{
  "api_key": {
    "created_by": "test_user",
    "key": "1234512345123456abcabc912349abcd",
    "name": "app_key"
  }
}

Bad Request

Error response object.

Expand All

항목

유형

설명

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

항목

유형

설명

errors [required]

[string]

Array of errors returned by the API.

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

Not Found

Error response object.

Expand All

항목

유형

설명

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

항목

유형

설명

errors [required]

[string]

Array of errors returned by the API.

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

코드 사례

                  # Path parameters
export key="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/api_key/${key}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Delete an API key returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.key_management_api import KeyManagementApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = KeyManagementApi(api_client)
    response = api_instance.delete_api_key(
        key="key",
    )

    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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Delete an API key returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::KeyManagementAPI.new
p api_instance.delete_api_key("key")

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
// Delete an API key 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() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewKeyManagementApi(apiClient)
	resp, r, err := api.DeleteAPIKey(ctx, "key")

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.DeleteAPIKey`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.DeleteAPIKey`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Delete an API key returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.KeyManagementApi;
import com.datadog.api.client.v1.model.ApiKeyResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);

    try {
      ApiKeyResponse result = apiInstance.deleteAPIKey("key");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling KeyManagementApi#deleteAPIKey");
      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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
// Delete an API key returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_key_management::KeyManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = KeyManagementAPI::with_config(configuration);
    let resp = api.delete_api_key("key".to_string()).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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
/**
 * Delete an API key returns "OK" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.KeyManagementApi(configuration);

const params: v1.KeyManagementApiDeleteAPIKeyRequest = {
  key: "key",
};

apiInstance
  .deleteAPIKey(params)
  .then((data: v1.ApiKeyResponse) => {
    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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

DELETE https://api.ap1.datadoghq.com/api/v2/api_keys/{api_key_id}https://api.ap2.datadoghq.com/api/v2/api_keys/{api_key_id}https://api.datadoghq.eu/api/v2/api_keys/{api_key_id}https://api.ddog-gov.com/api/v2/api_keys/{api_key_id}https://api.us2.ddog-gov.com/api/v2/api_keys/{api_key_id}https://api.datadoghq.com/api/v2/api_keys/{api_key_id}https://api.us3.datadoghq.com/api/v2/api_keys/{api_key_id}https://api.us5.datadoghq.com/api/v2/api_keys/{api_key_id}

개요

Delete an API key. This endpoint requires the api_keys_delete permission.

인수

경로 파라미터

이름

유형

설명

api_key_id [required]

string

The ID of the API key.

응답

No Content

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

코드 사례

                  # Path parameters
export api_key_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/api_keys/${api_key_id}" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Delete an API key returns "No Content" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.key_management_api import KeyManagementApi

# there is a valid "api_key" in the system
API_KEY_DATA_ID = environ["API_KEY_DATA_ID"]

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = KeyManagementApi(api_client)
    api_instance.delete_api_key(
        api_key_id=API_KEY_DATA_ID,
    )

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Delete an API key returns "No Content" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::KeyManagementAPI.new

# there is a valid "api_key" in the system
API_KEY_DATA_ID = ENV["API_KEY_DATA_ID"]
api_instance.delete_api_key(API_KEY_DATA_ID)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
// Delete an API key returns "No Content" response

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "api_key" in the system
	APIKeyDataID := os.Getenv("API_KEY_DATA_ID")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewKeyManagementApi(apiClient)
	r, err := api.DeleteAPIKey(ctx, APIKeyDataID)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.DeleteAPIKey`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Delete an API key returns "No Content" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.KeyManagementApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);

    // there is a valid "api_key" in the system
    String API_KEY_DATA_ID = System.getenv("API_KEY_DATA_ID");

    try {
      apiInstance.deleteAPIKey(API_KEY_DATA_ID);
    } catch (ApiException e) {
      System.err.println("Exception when calling KeyManagementApi#deleteAPIKey");
      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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
// Delete an API key returns "No Content" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;

#[tokio::main]
async fn main() {
    // there is a valid "api_key" in the system
    let api_key_data_id = std::env::var("API_KEY_DATA_ID").unwrap();
    let configuration = datadog::Configuration::new();
    let api = KeyManagementAPI::with_config(configuration);
    let resp = api.delete_api_key(api_key_data_id.clone()).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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
/**
 * Delete an API key returns "No Content" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.KeyManagementApi(configuration);

// there is a valid "api_key" in the system
const API_KEY_DATA_ID = process.env.API_KEY_DATA_ID as string;

const params: v2.KeyManagementApiDeleteAPIKeyRequest = {
  apiKeyId: API_KEY_DATA_ID,
};

apiInstance
  .deleteAPIKey(params)
  .then((data: any) => {
    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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v1/application_keyhttps://api.ap2.datadoghq.com/api/v1/application_keyhttps://api.datadoghq.eu/api/v1/application_keyhttps://api.ddog-gov.com/api/v1/application_keyhttps://api.us2.ddog-gov.com/api/v1/application_keyhttps://api.datadoghq.com/api/v1/application_keyhttps://api.us3.datadoghq.com/api/v1/application_keyhttps://api.us5.datadoghq.com/api/v1/application_key

개요

Get all application keys available for your Datadog account. This endpoint is disabled for organizations in One-Time Read mode. This endpoint requires any of the following permissions:

  • org_app_keys_read
  • user_app_keys

  • 응답

    OK

    An application key response.

    Expand All

    항목

    유형

    설명

    application_keys

    [object]

    Array of application keys.

    hash

    string

    Hash of an application key.

    name

    string

    Name of an application key.

    owner

    string

    Owner of an application key.

    {
      "application_keys": [
        {
          "hash": "1234512345123459cda4eb9ced49a3d84fd0138c",
          "name": "app_key",
          "owner": "test_user"
        }
      ]
    }

    Forbidden

    Error response object.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    Array of errors returned by the API.

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

    Too many requests

    Error response object.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    Array of errors returned by the API.

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

    코드 사례

                      # Curl command
    curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/application_key" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
    """
    Get all application keys returns "OK" response
    """
    
    from datadog_api_client import ApiClient, Configuration
    from datadog_api_client.v1.api.key_management_api import KeyManagementApi
    
    configuration = Configuration()
    with ApiClient(configuration) as api_client:
        api_instance = KeyManagementApi(api_client)
        response = api_instance.list_application_keys()
    
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
    # Get all application keys returns "OK" response
    
    require "datadog_api_client"
    api_instance = DatadogAPIClient::V1::KeyManagementAPI.new
    p api_instance.list_application_keys()
    

    Instructions

    First install the library and its dependencies and then save the example to example.rb and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
    // Get all application keys 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() {
    	ctx := datadog.NewDefaultContext(context.Background())
    	configuration := datadog.NewConfiguration()
    	apiClient := datadog.NewAPIClient(configuration)
    	api := datadogV1.NewKeyManagementApi(apiClient)
    	resp, r, err := api.ListApplicationKeys(ctx)
    
    	if err != nil {
    		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.ListApplicationKeys`: %v\n", err)
    		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    	}
    
    	responseContent, _ := json.MarshalIndent(resp, "", "  ")
    	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.ListApplicationKeys`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
    // Get all application keys returns "OK" response
    
    import com.datadog.api.client.ApiClient;
    import com.datadog.api.client.ApiException;
    import com.datadog.api.client.v1.api.KeyManagementApi;
    import com.datadog.api.client.v1.model.ApplicationKeyListResponse;
    
    public class Example {
      public static void main(String[] args) {
        ApiClient defaultClient = ApiClient.getDefaultApiClient();
        KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);
    
        try {
          ApplicationKeyListResponse result = apiInstance.listApplicationKeys();
          System.out.println(result);
        } catch (ApiException e) {
          System.err.println("Exception when calling KeyManagementApi#listApplicationKeys");
          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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
    // Get all application keys returns "OK" response
    use datadog_api_client::datadog;
    use datadog_api_client::datadogV1::api_key_management::KeyManagementAPI;
    
    #[tokio::main]
    async fn main() {
        let configuration = datadog::Configuration::new();
        let api = KeyManagementAPI::with_config(configuration);
        let resp = api.list_application_keys().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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
    /**
     * Get all application keys returns "OK" response
     */
    
    import { client, v1 } from "@datadog/datadog-api-client";
    
    const configuration = client.createConfiguration();
    const apiInstance = new v1.KeyManagementApi(configuration);
    
    apiInstance
      .listApplicationKeys()
      .then((data: v1.ApplicationKeyListResponse) => {
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

    GET https://api.ap1.datadoghq.com/api/v2/application_keyshttps://api.ap2.datadoghq.com/api/v2/application_keyshttps://api.datadoghq.eu/api/v2/application_keyshttps://api.ddog-gov.com/api/v2/application_keyshttps://api.us2.ddog-gov.com/api/v2/application_keyshttps://api.datadoghq.com/api/v2/application_keyshttps://api.us3.datadoghq.com/api/v2/application_keyshttps://api.us5.datadoghq.com/api/v2/application_keys

    개요

    List all application keys available for your org This endpoint requires the org_app_keys_read permission.

    인수

    쿼리 문자열

    이름

    유형

    설명

    page[size]

    integer

    Size for a given page. The maximum allowed value is 100.

    page[number]

    integer

    Specific page number to return.

    sort

    enum

    Application key attribute used to sort results. Sort order is ascending by default. In order to specify a descending sort, prefix the attribute with a minus sign.
    Allowed enum values: created_at, -created_at, last4, -last4, name, -name

    filter

    string

    Filter application keys by the specified string.

    filter[created_at][start]

    string

    Only include application keys created on or after the specified date.

    filter[created_at][end]

    string

    Only include application keys created on or before the specified date.

    include

    string

    Resource path for related resources to include in the response. Only owned_by is supported.

    응답

    OK

    Response for a list of application keys.

    Expand All

    항목

    유형

    설명

    data

    [object]

    Array of application keys.

    attributes

    object

    Attributes of a partial application key.

    created_at

    string

    Creation date of the application key.

    last4

    string

    The last four characters of the application key.

    last_used_at

    string

    Last usage timestamp of the application key.

    name

    string

    Name of the application key.

    scopes

    [string]

    Array of scopes to grant the application key.

    id

    string

    ID of the application key.

    relationships

    object

    Resources related to the application key.

    owned_by

    object

    Relationship to user.

    data [required]

    object

    Relationship to user object.

    id [required]

    string

    A unique identifier that represents the user.

    type [required]

    enum

    Users resource type. Allowed enum values: users

    default: users

    type

    enum

    Application Keys resource type. Allowed enum values: application_keys

    default: application_keys

    included

    [ <oneOf>]

    Array of objects related to the application key.

    Option 1

    object

    User object returned by the API.

    attributes

    object

    Attributes of user object returned by the API.

    created_at

    date-time

    The ISO 8601 timestamp of when the user account was created.

    disabled

    boolean

    Whether the user account is deactivated. Disabled users cannot log in.

    email

    string

    The email address of the user, used for login and notifications.

    handle

    string

    The unique handle (username) of the user, typically matching their email prefix.

    icon

    string

    URL of the user's profile icon, typically a Gravatar URL derived from the email address.

    last_login_time

    date-time

    The ISO 8601 timestamp of the user's most recent login, or null if the user has never logged in.

    mfa_enabled

    boolean

    Whether multi-factor authentication (MFA) is enabled for the user's account.

    modified_at

    date-time

    The ISO 8601 timestamp of when the user account was last modified.

    name

    string

    The full display name of the user as shown in the Datadog UI.

    service_account

    boolean

    Whether this is a service account rather than a human user. Service accounts are used for programmatic API access.

    status

    string

    The current status of the user account (for example, Active, Pending, or Disabled).

    title

    string

    The job title of the user (for example, "Senior Engineer" or "Product Manager").

    uuid

    string

    The globally unique identifier (UUID) of the user.

    verified

    boolean

    Whether the user's email address has been verified.

    id

    string

    ID of the user.

    relationships

    object

    Relationships of the user object returned by the API.

    org

    object

    Relationship to an organization.

    data [required]

    object

    Relationship to organization object.

    id [required]

    string

    ID of the organization.

    type [required]

    enum

    Organizations resource type. Allowed enum values: orgs

    default: orgs

    other_orgs

    object

    Relationship to organizations.

    data [required]

    [object]

    Relationships to organization objects.

    id [required]

    string

    ID of the organization.

    type [required]

    enum

    Organizations resource type. Allowed enum values: orgs

    default: orgs

    other_users

    object

    Relationship to users.

    data [required]

    [object]

    Relationships to user objects.

    id [required]

    string

    A unique identifier that represents the user.

    type [required]

    enum

    Users resource type. Allowed enum values: users

    default: users

    roles

    object

    Relationship to roles.

    data

    [object]

    An array containing type and the unique identifier of a role.

    id

    string

    The unique identifier of the role.

    type

    enum

    Roles type. Allowed enum values: roles

    default: roles

    type

    enum

    Users resource type. Allowed enum values: users

    default: users

    Option 2

    object

    Role object returned by the API.

    attributes

    object

    Attributes of the role.

    created_at

    date-time

    Creation time of the role.

    modified_at

    date-time

    Time of last role modification.

    name

    string

    The name of the role. The name is neither unique nor a stable identifier of the role.

    receives_permissions_from

    [string]

    The managed role from which this role automatically inherits new permissions. Specify one of the following: "Datadog Admin Role", "Datadog Standard Role", or "Datadog Read Only Role". If empty or not specified, the role does not automatically inherit permissions from any managed role.

    user_count

    int64

    Number of users with that role.

    id

    string

    The unique identifier of the role.

    relationships

    object

    Relationships of the role object returned by the API.

    permissions

    object

    Relationship to multiple permissions objects.

    data

    [object]

    Relationships to permission objects.

    id

    string

    ID of the permission.

    type

    enum

    Permissions resource type. Allowed enum values: permissions

    default: permissions

    type [required]

    enum

    Roles type. Allowed enum values: roles

    default: roles

    Option 3

    object

    The definition of LeakedKey object.

    attributes [required]

    object

    The definition of LeakedKeyAttributes object.

    date [required]

    date-time

    The LeakedKeyAttributes date.

    leak_source

    string

    The LeakedKeyAttributes leak_source.

    id [required]

    string

    The LeakedKey id.

    type [required]

    enum

    The definition of LeakedKeyType object. Allowed enum values: leaked_keys

    default: leaked_keys

    meta

    object

    Additional information related to the application key response.

    max_allowed_per_user

    int64

    Max allowed number of application keys per user.

    page

    object

    Additional information related to the application key response.

    total_filtered_count

    int64

    Total filtered application key count.

    {
      "data": [
        {
          "attributes": {
            "created_at": "2020-11-23T10:00:00.000Z",
            "last4": "abcd",
            "last_used_at": "2020-12-20T10:00:00.000Z",
            "name": "Application Key for managing dashboards",
            "scopes": [
              "dashboards_read",
              "dashboards_write",
              "dashboards_public_share"
            ]
          },
          "id": "string",
          "relationships": {
            "owned_by": {
              "data": {
                "id": "00000000-0000-0000-2345-000000000000",
                "type": "users"
              }
            }
          },
          "type": "application_keys"
        }
      ],
      "included": [
        {
          "attributes": {
            "created_at": "2019-09-19T10:00:00.000Z",
            "disabled": false,
            "email": "string",
            "handle": "string",
            "icon": "string",
            "last_login_time": "2019-09-19T10:00:00.000Z",
            "mfa_enabled": false,
            "modified_at": "2019-09-19T10:00:00.000Z",
            "name": "string",
            "service_account": false,
            "status": "string",
            "title": "string",
            "uuid": "string",
            "verified": false
          },
          "id": "string",
          "relationships": {
            "org": {
              "data": {
                "id": "00000000-0000-beef-0000-000000000000",
                "type": "orgs"
              }
            },
            "other_orgs": {
              "data": [
                {
                  "id": "00000000-0000-beef-0000-000000000000",
                  "type": "orgs"
                }
              ]
            },
            "other_users": {
              "data": [
                {
                  "id": "00000000-0000-0000-2345-000000000000",
                  "type": "users"
                }
              ]
            },
            "roles": {
              "data": [
                {
                  "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
                  "type": "roles"
                }
              ]
            }
          },
          "type": "users"
        }
      ],
      "meta": {
        "max_allowed_per_user": "integer",
        "page": {
          "total_filtered_count": "integer"
        }
      }
    }

    Bad Request

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Forbidden

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Not Found

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Too many requests

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    코드 사례

                      # Curl command
    curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/application_keys" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
    """
    Get all application keys returns "OK" response
    """
    
    from datadog_api_client import ApiClient, Configuration
    from datadog_api_client.v2.api.key_management_api import KeyManagementApi
    
    configuration = Configuration()
    with ApiClient(configuration) as api_client:
        api_instance = KeyManagementApi(api_client)
        response = api_instance.list_application_keys()
    
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
    # Get all application keys returns "OK" response
    
    require "datadog_api_client"
    api_instance = DatadogAPIClient::V2::KeyManagementAPI.new
    p api_instance.list_application_keys()
    

    Instructions

    First install the library and its dependencies and then save the example to example.rb and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
    // Get all application keys 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() {
    	ctx := datadog.NewDefaultContext(context.Background())
    	configuration := datadog.NewConfiguration()
    	apiClient := datadog.NewAPIClient(configuration)
    	api := datadogV2.NewKeyManagementApi(apiClient)
    	resp, r, err := api.ListApplicationKeys(ctx, *datadogV2.NewListApplicationKeysOptionalParameters())
    
    	if err != nil {
    		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.ListApplicationKeys`: %v\n", err)
    		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    	}
    
    	responseContent, _ := json.MarshalIndent(resp, "", "  ")
    	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.ListApplicationKeys`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
    // Get all application keys returns "OK" response
    
    import com.datadog.api.client.ApiClient;
    import com.datadog.api.client.ApiException;
    import com.datadog.api.client.v2.api.KeyManagementApi;
    import com.datadog.api.client.v2.model.ListApplicationKeysResponse;
    
    public class Example {
      public static void main(String[] args) {
        ApiClient defaultClient = ApiClient.getDefaultApiClient();
        KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);
    
        try {
          ListApplicationKeysResponse result = apiInstance.listApplicationKeys();
          System.out.println(result);
        } catch (ApiException e) {
          System.err.println("Exception when calling KeyManagementApi#listApplicationKeys");
          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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
    // Get all application keys returns "OK" response
    use datadog_api_client::datadog;
    use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;
    use datadog_api_client::datadogV2::api_key_management::ListApplicationKeysOptionalParams;
    
    #[tokio::main]
    async fn main() {
        let configuration = datadog::Configuration::new();
        let api = KeyManagementAPI::with_config(configuration);
        let resp = api
            .list_application_keys(ListApplicationKeysOptionalParams::default())
            .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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
    /**
     * Get all application keys returns "OK" response
     */
    
    import { client, v2 } from "@datadog/datadog-api-client";
    
    const configuration = client.createConfiguration();
    const apiInstance = new v2.KeyManagementApi(configuration);
    
    apiInstance
      .listApplicationKeys()
      .then((data: v2.ListApplicationKeysResponse) => {
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

    POST https://api.ap1.datadoghq.com/api/v1/application_keyhttps://api.ap2.datadoghq.com/api/v1/application_keyhttps://api.datadoghq.eu/api/v1/application_keyhttps://api.ddog-gov.com/api/v1/application_keyhttps://api.us2.ddog-gov.com/api/v1/application_keyhttps://api.datadoghq.com/api/v1/application_keyhttps://api.us3.datadoghq.com/api/v1/application_keyhttps://api.us5.datadoghq.com/api/v1/application_key

    개요

    Create an application key with a given name. This endpoint is disabled for organizations in One-Time Read mode. This endpoint requires the user_app_keys permission.

    요청

    Body Data (required)

    Expand All

    항목

    유형

    설명

    hash

    string

    Hash of an application key.

    name

    string

    Name of an application key.

    owner

    string

    Owner of an application key.

    {
      "name": "example user"
    }

    응답

    OK

    An application key response.

    Expand All

    항목

    유형

    설명

    application_key

    object

    An application key with its associated metadata.

    hash

    string

    Hash of an application key.

    name

    string

    Name of an application key.

    owner

    string

    Owner of an application key.

    {
      "application_key": {
        "hash": "1234512345123459cda4eb9ced49a3d84fd0138c",
        "name": "app_key",
        "owner": "test_user"
      }
    }

    Bad Request

    Error response object.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    Array of errors returned by the API.

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

    Forbidden

    Error response object.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    Array of errors returned by the API.

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

    Conflict

    Error response object.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    Array of errors returned by the API.

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

    Too many requests

    Error response object.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    Array of errors returned by the API.

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

    코드 사례

                      ## default
    # 
    
    # Curl command
    curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/application_key" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "name": "example key" } EOF
    """
    Create an application key returns "OK" response
    """
    
    from datadog_api_client import ApiClient, Configuration
    from datadog_api_client.v1.api.key_management_api import KeyManagementApi
    from datadog_api_client.v1.model.application_key import ApplicationKey
    
    body = ApplicationKey(
        name="example user",
    )
    
    configuration = Configuration()
    with ApiClient(configuration) as api_client:
        api_instance = KeyManagementApi(api_client)
        response = api_instance.create_application_key(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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
    # Create an application key returns "OK" response
    
    require "datadog_api_client"
    api_instance = DatadogAPIClient::V1::KeyManagementAPI.new
    
    body = DatadogAPIClient::V1::ApplicationKey.new({
      name: "example user",
    })
    p api_instance.create_application_key(body)
    

    Instructions

    First install the library and its dependencies and then save the example to example.rb and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
    // Create an application key 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.ApplicationKey{
    		Name: datadog.PtrString("example user"),
    	}
    	ctx := datadog.NewDefaultContext(context.Background())
    	configuration := datadog.NewConfiguration()
    	apiClient := datadog.NewAPIClient(configuration)
    	api := datadogV1.NewKeyManagementApi(apiClient)
    	resp, r, err := api.CreateApplicationKey(ctx, body)
    
    	if err != nil {
    		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.CreateApplicationKey`: %v\n", err)
    		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    	}
    
    	responseContent, _ := json.MarshalIndent(resp, "", "  ")
    	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.CreateApplicationKey`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
    // Create an application key returns "OK" response
    
    import com.datadog.api.client.ApiClient;
    import com.datadog.api.client.ApiException;
    import com.datadog.api.client.v1.api.KeyManagementApi;
    import com.datadog.api.client.v1.model.ApplicationKey;
    import com.datadog.api.client.v1.model.ApplicationKeyResponse;
    
    public class Example {
      public static void main(String[] args) {
        ApiClient defaultClient = ApiClient.getDefaultApiClient();
        KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);
    
        ApplicationKey body = new ApplicationKey().name("example user");
    
        try {
          ApplicationKeyResponse result = apiInstance.createApplicationKey(body);
          System.out.println(result);
        } catch (ApiException e) {
          System.err.println("Exception when calling KeyManagementApi#createApplicationKey");
          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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
    // Create an application key returns "OK" response
    use datadog_api_client::datadog;
    use datadog_api_client::datadogV1::api_key_management::KeyManagementAPI;
    use datadog_api_client::datadogV1::model::ApplicationKey;
    
    #[tokio::main]
    async fn main() {
        let body = ApplicationKey::new().name("example user".to_string());
        let configuration = datadog::Configuration::new();
        let api = KeyManagementAPI::with_config(configuration);
        let resp = api.create_application_key(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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
    /**
     * Create an application key returns "OK" response
     */
    
    import { client, v1 } from "@datadog/datadog-api-client";
    
    const configuration = client.createConfiguration();
    const apiInstance = new v1.KeyManagementApi(configuration);
    
    const params: v1.KeyManagementApiCreateApplicationKeyRequest = {
      body: {
        name: "example user",
      },
    };
    
    apiInstance
      .createApplicationKey(params)
      .then((data: v1.ApplicationKeyResponse) => {
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

    GET https://api.ap1.datadoghq.com/api/v1/application_key/{key}https://api.ap2.datadoghq.com/api/v1/application_key/{key}https://api.datadoghq.eu/api/v1/application_key/{key}https://api.ddog-gov.com/api/v1/application_key/{key}https://api.us2.ddog-gov.com/api/v1/application_key/{key}https://api.datadoghq.com/api/v1/application_key/{key}https://api.us3.datadoghq.com/api/v1/application_key/{key}https://api.us5.datadoghq.com/api/v1/application_key/{key}

    개요

    Get a given application key. This endpoint is disabled for organizations in One-Time Read mode. This endpoint requires any of the following permissions:

  • org_app_keys_read
  • user_app_keys

  • 인수

    경로 파라미터

    이름

    유형

    설명

    key [required]

    string

    The specific APP key you are working with.

    응답

    OK

    An application key response.

    Expand All

    항목

    유형

    설명

    application_key

    object

    An application key with its associated metadata.

    hash

    string

    Hash of an application key.

    name

    string

    Name of an application key.

    owner

    string

    Owner of an application key.

    {
      "application_key": {
        "hash": "1234512345123459cda4eb9ced49a3d84fd0138c",
        "name": "app_key",
        "owner": "test_user"
      }
    }

    Forbidden

    Error response object.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    Array of errors returned by the API.

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

    Not Found

    Error response object.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    Array of errors returned by the API.

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

    Too many requests

    Error response object.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    Array of errors returned by the API.

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

    코드 사례

                      # Path parameters
    export key="CHANGE_ME"
    # Curl command
    curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/application_key/${key}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
    """
    Get an application key returns "OK" response
    """
    
    from datadog_api_client import ApiClient, Configuration
    from datadog_api_client.v1.api.key_management_api import KeyManagementApi
    
    configuration = Configuration()
    with ApiClient(configuration) as api_client:
        api_instance = KeyManagementApi(api_client)
        response = api_instance.get_application_key(
            key="key",
        )
    
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
    # Get an application key returns "OK" response
    
    require "datadog_api_client"
    api_instance = DatadogAPIClient::V1::KeyManagementAPI.new
    p api_instance.get_application_key("key")
    

    Instructions

    First install the library and its dependencies and then save the example to example.rb and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
    // Get an application key 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() {
    	ctx := datadog.NewDefaultContext(context.Background())
    	configuration := datadog.NewConfiguration()
    	apiClient := datadog.NewAPIClient(configuration)
    	api := datadogV1.NewKeyManagementApi(apiClient)
    	resp, r, err := api.GetApplicationKey(ctx, "key")
    
    	if err != nil {
    		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.GetApplicationKey`: %v\n", err)
    		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    	}
    
    	responseContent, _ := json.MarshalIndent(resp, "", "  ")
    	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.GetApplicationKey`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
    // Get an application key returns "OK" response
    
    import com.datadog.api.client.ApiClient;
    import com.datadog.api.client.ApiException;
    import com.datadog.api.client.v1.api.KeyManagementApi;
    import com.datadog.api.client.v1.model.ApplicationKeyResponse;
    
    public class Example {
      public static void main(String[] args) {
        ApiClient defaultClient = ApiClient.getDefaultApiClient();
        KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);
    
        try {
          ApplicationKeyResponse result = apiInstance.getApplicationKey("key");
          System.out.println(result);
        } catch (ApiException e) {
          System.err.println("Exception when calling KeyManagementApi#getApplicationKey");
          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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
    // Get an application key returns "OK" response
    use datadog_api_client::datadog;
    use datadog_api_client::datadogV1::api_key_management::KeyManagementAPI;
    
    #[tokio::main]
    async fn main() {
        let configuration = datadog::Configuration::new();
        let api = KeyManagementAPI::with_config(configuration);
        let resp = api.get_application_key("key".to_string()).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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
    /**
     * Get an application key returns "OK" response
     */
    
    import { client, v1 } from "@datadog/datadog-api-client";
    
    const configuration = client.createConfiguration();
    const apiInstance = new v1.KeyManagementApi(configuration);
    
    const params: v1.KeyManagementApiGetApplicationKeyRequest = {
      key: "key",
    };
    
    apiInstance
      .getApplicationKey(params)
      .then((data: v1.ApplicationKeyResponse) => {
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

    GET https://api.ap1.datadoghq.com/api/v2/application_keys/{app_key_id}https://api.ap2.datadoghq.com/api/v2/application_keys/{app_key_id}https://api.datadoghq.eu/api/v2/application_keys/{app_key_id}https://api.ddog-gov.com/api/v2/application_keys/{app_key_id}https://api.us2.ddog-gov.com/api/v2/application_keys/{app_key_id}https://api.datadoghq.com/api/v2/application_keys/{app_key_id}https://api.us3.datadoghq.com/api/v2/application_keys/{app_key_id}https://api.us5.datadoghq.com/api/v2/application_keys/{app_key_id}

    개요

    Get an application key for your org. This endpoint requires the org_app_keys_read permission.

    인수

    경로 파라미터

    이름

    유형

    설명

    app_key_id [required]

    string

    The ID of the application key.

    쿼리 문자열

    이름

    유형

    설명

    include

    string

    Resource path for related resources to include in the response. Only owned_by is supported.

    응답

    OK

    Response for retrieving an application key.

    Expand All

    항목

    유형

    설명

    data

    object

    Datadog application key.

    attributes

    object

    Attributes of a full application key.

    created_at

    date-time

    Creation date of the application key.

    key

    string

    The application key.

    last4

    string

    The last four characters of the application key.

    last_used_at

    date-time

    Last usage timestamp of the application key.

    name

    string

    Name of the application key.

    scopes

    [string]

    Array of scopes to grant the application key.

    id

    string

    ID of the application key.

    relationships

    object

    Resources related to the application key.

    owned_by

    object

    Relationship to user.

    data [required]

    object

    Relationship to user object.

    id [required]

    string

    A unique identifier that represents the user.

    type [required]

    enum

    Users resource type. Allowed enum values: users

    default: users

    type

    enum

    Application Keys resource type. Allowed enum values: application_keys

    default: application_keys

    included

    [ <oneOf>]

    Array of objects related to the application key.

    Option 1

    object

    User object returned by the API.

    attributes

    object

    Attributes of user object returned by the API.

    created_at

    date-time

    The ISO 8601 timestamp of when the user account was created.

    disabled

    boolean

    Whether the user account is deactivated. Disabled users cannot log in.

    email

    string

    The email address of the user, used for login and notifications.

    handle

    string

    The unique handle (username) of the user, typically matching their email prefix.

    icon

    string

    URL of the user's profile icon, typically a Gravatar URL derived from the email address.

    last_login_time

    date-time

    The ISO 8601 timestamp of the user's most recent login, or null if the user has never logged in.

    mfa_enabled

    boolean

    Whether multi-factor authentication (MFA) is enabled for the user's account.

    modified_at

    date-time

    The ISO 8601 timestamp of when the user account was last modified.

    name

    string

    The full display name of the user as shown in the Datadog UI.

    service_account

    boolean

    Whether this is a service account rather than a human user. Service accounts are used for programmatic API access.

    status

    string

    The current status of the user account (for example, Active, Pending, or Disabled).

    title

    string

    The job title of the user (for example, "Senior Engineer" or "Product Manager").

    uuid

    string

    The globally unique identifier (UUID) of the user.

    verified

    boolean

    Whether the user's email address has been verified.

    id

    string

    ID of the user.

    relationships

    object

    Relationships of the user object returned by the API.

    org

    object

    Relationship to an organization.

    data [required]

    object

    Relationship to organization object.

    id [required]

    string

    ID of the organization.

    type [required]

    enum

    Organizations resource type. Allowed enum values: orgs

    default: orgs

    other_orgs

    object

    Relationship to organizations.

    data [required]

    [object]

    Relationships to organization objects.

    id [required]

    string

    ID of the organization.

    type [required]

    enum

    Organizations resource type. Allowed enum values: orgs

    default: orgs

    other_users

    object

    Relationship to users.

    data [required]

    [object]

    Relationships to user objects.

    id [required]

    string

    A unique identifier that represents the user.

    type [required]

    enum

    Users resource type. Allowed enum values: users

    default: users

    roles

    object

    Relationship to roles.

    data

    [object]

    An array containing type and the unique identifier of a role.

    id

    string

    The unique identifier of the role.

    type

    enum

    Roles type. Allowed enum values: roles

    default: roles

    type

    enum

    Users resource type. Allowed enum values: users

    default: users

    Option 2

    object

    Role object returned by the API.

    attributes

    object

    Attributes of the role.

    created_at

    date-time

    Creation time of the role.

    modified_at

    date-time

    Time of last role modification.

    name

    string

    The name of the role. The name is neither unique nor a stable identifier of the role.

    receives_permissions_from

    [string]

    The managed role from which this role automatically inherits new permissions. Specify one of the following: "Datadog Admin Role", "Datadog Standard Role", or "Datadog Read Only Role". If empty or not specified, the role does not automatically inherit permissions from any managed role.

    user_count

    int64

    Number of users with that role.

    id

    string

    The unique identifier of the role.

    relationships

    object

    Relationships of the role object returned by the API.

    permissions

    object

    Relationship to multiple permissions objects.

    data

    [object]

    Relationships to permission objects.

    id

    string

    ID of the permission.

    type

    enum

    Permissions resource type. Allowed enum values: permissions

    default: permissions

    type [required]

    enum

    Roles type. Allowed enum values: roles

    default: roles

    Option 3

    object

    The definition of LeakedKey object.

    attributes [required]

    object

    The definition of LeakedKeyAttributes object.

    date [required]

    date-time

    The LeakedKeyAttributes date.

    leak_source

    string

    The LeakedKeyAttributes leak_source.

    id [required]

    string

    The LeakedKey id.

    type [required]

    enum

    The definition of LeakedKeyType object. Allowed enum values: leaked_keys

    default: leaked_keys

    {
      "data": {
        "attributes": {
          "created_at": "2020-11-23T10:00:00.000Z",
          "key": "string",
          "last4": "abcd",
          "last_used_at": "2020-12-20T10:00:00.000Z",
          "name": "Application Key for managing dashboards",
          "scopes": [
            "dashboards_read",
            "dashboards_write",
            "dashboards_public_share"
          ]
        },
        "id": "string",
        "relationships": {
          "owned_by": {
            "data": {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          }
        },
        "type": "application_keys"
      },
      "included": [
        {
          "attributes": {
            "created_at": "2019-09-19T10:00:00.000Z",
            "disabled": false,
            "email": "string",
            "handle": "string",
            "icon": "string",
            "last_login_time": "2019-09-19T10:00:00.000Z",
            "mfa_enabled": false,
            "modified_at": "2019-09-19T10:00:00.000Z",
            "name": "string",
            "service_account": false,
            "status": "string",
            "title": "string",
            "uuid": "string",
            "verified": false
          },
          "id": "string",
          "relationships": {
            "org": {
              "data": {
                "id": "00000000-0000-beef-0000-000000000000",
                "type": "orgs"
              }
            },
            "other_orgs": {
              "data": [
                {
                  "id": "00000000-0000-beef-0000-000000000000",
                  "type": "orgs"
                }
              ]
            },
            "other_users": {
              "data": [
                {
                  "id": "00000000-0000-0000-2345-000000000000",
                  "type": "users"
                }
              ]
            },
            "roles": {
              "data": [
                {
                  "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
                  "type": "roles"
                }
              ]
            }
          },
          "type": "users"
        }
      ]
    }

    Bad Request

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Forbidden

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Not Found

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Too many requests

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    코드 사례

                      # Path parameters
    export app_key_id="CHANGE_ME"
    # Curl command
    curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/application_keys/${app_key_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
    """
    Get an application key returns "OK" response
    """
    
    from os import environ
    from datadog_api_client import ApiClient, Configuration
    from datadog_api_client.v2.api.key_management_api import KeyManagementApi
    
    # there is a valid "application_key" in the system
    APPLICATION_KEY_DATA_ID = environ["APPLICATION_KEY_DATA_ID"]
    
    configuration = Configuration()
    with ApiClient(configuration) as api_client:
        api_instance = KeyManagementApi(api_client)
        response = api_instance.get_application_key(
            app_key_id=APPLICATION_KEY_DATA_ID,
        )
    
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
    # Get an application key returns "OK" response
    
    require "datadog_api_client"
    api_instance = DatadogAPIClient::V2::KeyManagementAPI.new
    
    # there is a valid "application_key" in the system
    APPLICATION_KEY_DATA_ID = ENV["APPLICATION_KEY_DATA_ID"]
    p api_instance.get_application_key(APPLICATION_KEY_DATA_ID)
    

    Instructions

    First install the library and its dependencies and then save the example to example.rb and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
    // Get an application key 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() {
    	// there is a valid "application_key" in the system
    	ApplicationKeyDataID := os.Getenv("APPLICATION_KEY_DATA_ID")
    
    	ctx := datadog.NewDefaultContext(context.Background())
    	configuration := datadog.NewConfiguration()
    	apiClient := datadog.NewAPIClient(configuration)
    	api := datadogV2.NewKeyManagementApi(apiClient)
    	resp, r, err := api.GetApplicationKey(ctx, ApplicationKeyDataID, *datadogV2.NewGetApplicationKeyOptionalParameters())
    
    	if err != nil {
    		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.GetApplicationKey`: %v\n", err)
    		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    	}
    
    	responseContent, _ := json.MarshalIndent(resp, "", "  ")
    	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.GetApplicationKey`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
    // Get an application key returns "OK" response
    
    import com.datadog.api.client.ApiClient;
    import com.datadog.api.client.ApiException;
    import com.datadog.api.client.v2.api.KeyManagementApi;
    import com.datadog.api.client.v2.model.ApplicationKeyResponse;
    
    public class Example {
      public static void main(String[] args) {
        ApiClient defaultClient = ApiClient.getDefaultApiClient();
        KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);
    
        // there is a valid "application_key" in the system
        String APPLICATION_KEY_DATA_ID = System.getenv("APPLICATION_KEY_DATA_ID");
    
        try {
          ApplicationKeyResponse result = apiInstance.getApplicationKey(APPLICATION_KEY_DATA_ID);
          System.out.println(result);
        } catch (ApiException e) {
          System.err.println("Exception when calling KeyManagementApi#getApplicationKey");
          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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
    // Get an application key returns "OK" response
    use datadog_api_client::datadog;
    use datadog_api_client::datadogV2::api_key_management::GetApplicationKeyOptionalParams;
    use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;
    
    #[tokio::main]
    async fn main() {
        // there is a valid "application_key" in the system
        let application_key_data_id = std::env::var("APPLICATION_KEY_DATA_ID").unwrap();
        let configuration = datadog::Configuration::new();
        let api = KeyManagementAPI::with_config(configuration);
        let resp = api
            .get_application_key(
                application_key_data_id.clone(),
                GetApplicationKeyOptionalParams::default(),
            )
            .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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
    /**
     * Get an application key returns "OK" response
     */
    
    import { client, v2 } from "@datadog/datadog-api-client";
    
    const configuration = client.createConfiguration();
    const apiInstance = new v2.KeyManagementApi(configuration);
    
    // there is a valid "application_key" in the system
    const APPLICATION_KEY_DATA_ID = process.env.APPLICATION_KEY_DATA_ID as string;
    
    const params: v2.KeyManagementApiGetApplicationKeyRequest = {
      appKeyId: APPLICATION_KEY_DATA_ID,
    };
    
    apiInstance
      .getApplicationKey(params)
      .then((data: v2.ApplicationKeyResponse) => {
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

    PUT https://api.ap1.datadoghq.com/api/v1/application_key/{key}https://api.ap2.datadoghq.com/api/v1/application_key/{key}https://api.datadoghq.eu/api/v1/application_key/{key}https://api.ddog-gov.com/api/v1/application_key/{key}https://api.us2.ddog-gov.com/api/v1/application_key/{key}https://api.datadoghq.com/api/v1/application_key/{key}https://api.us3.datadoghq.com/api/v1/application_key/{key}https://api.us5.datadoghq.com/api/v1/application_key/{key}

    개요

    Edit an application key name. This endpoint is disabled for organizations in One-Time Read mode. This endpoint requires any of the following permissions:

  • org_app_keys_write
  • user_app_keys

  • 인수

    경로 파라미터

    이름

    유형

    설명

    key [required]

    string

    The specific APP key you are working with.

    요청

    Body Data (required)

    Expand All

    항목

    유형

    설명

    hash

    string

    Hash of an application key.

    name

    string

    Name of an application key.

    owner

    string

    Owner of an application key.

    {
      "name": "example user"
    }

    응답

    OK

    An application key response.

    Expand All

    항목

    유형

    설명

    application_key

    object

    An application key with its associated metadata.

    hash

    string

    Hash of an application key.

    name

    string

    Name of an application key.

    owner

    string

    Owner of an application key.

    {
      "application_key": {
        "hash": "1234512345123459cda4eb9ced49a3d84fd0138c",
        "name": "app_key",
        "owner": "test_user"
      }
    }

    Bad Request

    Error response object.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    Array of errors returned by the API.

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

    Forbidden

    Error response object.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    Array of errors returned by the API.

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

    Not Found

    Error response object.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    Array of errors returned by the API.

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

    Conflict

    Error response object.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    Array of errors returned by the API.

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

    Too many requests

    Error response object.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    Array of errors returned by the API.

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

    코드 사례

                      ## default
    # 
    
    # Path parameters
    export key="CHANGE_ME"
    # Curl command
    curl -X PUT "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/application_key/${key}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "name": "example key" } EOF
    """
    Edit an application key returns "OK" response
    """
    
    from datadog_api_client import ApiClient, Configuration
    from datadog_api_client.v1.api.key_management_api import KeyManagementApi
    from datadog_api_client.v1.model.application_key import ApplicationKey
    
    body = ApplicationKey(
        name="example user",
    )
    
    configuration = Configuration()
    with ApiClient(configuration) as api_client:
        api_instance = KeyManagementApi(api_client)
        response = api_instance.update_application_key(key="key", 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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
    # Edit an application key returns "OK" response
    
    require "datadog_api_client"
    api_instance = DatadogAPIClient::V1::KeyManagementAPI.new
    
    body = DatadogAPIClient::V1::ApplicationKey.new({
      name: "example user",
    })
    p api_instance.update_application_key("key", body)
    

    Instructions

    First install the library and its dependencies and then save the example to example.rb and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
    // Edit an application key 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.ApplicationKey{
    		Name: datadog.PtrString("example user"),
    	}
    	ctx := datadog.NewDefaultContext(context.Background())
    	configuration := datadog.NewConfiguration()
    	apiClient := datadog.NewAPIClient(configuration)
    	api := datadogV1.NewKeyManagementApi(apiClient)
    	resp, r, err := api.UpdateApplicationKey(ctx, "key", body)
    
    	if err != nil {
    		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.UpdateApplicationKey`: %v\n", err)
    		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    	}
    
    	responseContent, _ := json.MarshalIndent(resp, "", "  ")
    	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.UpdateApplicationKey`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
    // Edit an application key returns "OK" response
    
    import com.datadog.api.client.ApiClient;
    import com.datadog.api.client.ApiException;
    import com.datadog.api.client.v1.api.KeyManagementApi;
    import com.datadog.api.client.v1.model.ApplicationKey;
    import com.datadog.api.client.v1.model.ApplicationKeyResponse;
    
    public class Example {
      public static void main(String[] args) {
        ApiClient defaultClient = ApiClient.getDefaultApiClient();
        KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);
    
        ApplicationKey body = new ApplicationKey().name("example user");
    
        try {
          ApplicationKeyResponse result = apiInstance.updateApplicationKey("key", body);
          System.out.println(result);
        } catch (ApiException e) {
          System.err.println("Exception when calling KeyManagementApi#updateApplicationKey");
          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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
    // Edit an application key returns "OK" response
    use datadog_api_client::datadog;
    use datadog_api_client::datadogV1::api_key_management::KeyManagementAPI;
    use datadog_api_client::datadogV1::model::ApplicationKey;
    
    #[tokio::main]
    async fn main() {
        let body = ApplicationKey::new().name("example user".to_string());
        let configuration = datadog::Configuration::new();
        let api = KeyManagementAPI::with_config(configuration);
        let resp = api.update_application_key("key".to_string(), 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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
    /**
     * Edit an application key returns "OK" response
     */
    
    import { client, v1 } from "@datadog/datadog-api-client";
    
    const configuration = client.createConfiguration();
    const apiInstance = new v1.KeyManagementApi(configuration);
    
    const params: v1.KeyManagementApiUpdateApplicationKeyRequest = {
      body: {
        name: "example user",
      },
      key: "key",
    };
    
    apiInstance
      .updateApplicationKey(params)
      .then((data: v1.ApplicationKeyResponse) => {
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

    PATCH https://api.ap1.datadoghq.com/api/v2/application_keys/{app_key_id}https://api.ap2.datadoghq.com/api/v2/application_keys/{app_key_id}https://api.datadoghq.eu/api/v2/application_keys/{app_key_id}https://api.ddog-gov.com/api/v2/application_keys/{app_key_id}https://api.us2.ddog-gov.com/api/v2/application_keys/{app_key_id}https://api.datadoghq.com/api/v2/application_keys/{app_key_id}https://api.us3.datadoghq.com/api/v2/application_keys/{app_key_id}https://api.us5.datadoghq.com/api/v2/application_keys/{app_key_id}

    개요

    Edit an application key This endpoint requires the org_app_keys_write permission.

    인수

    경로 파라미터

    이름

    유형

    설명

    app_key_id [required]

    string

    The ID of the application key.

    요청

    Body Data (required)

    Expand All

    항목

    유형

    설명

    data [required]

    object

    Object used to update an application key.

    attributes [required]

    object

    Attributes used to update an application Key.

    name

    string

    Name of the application key.

    scopes

    [string]

    Array of scopes to grant the application key.

    id [required]

    string

    ID of the application key.

    type [required]

    enum

    Application Keys resource type. Allowed enum values: application_keys

    default: application_keys

    {
      "data": {
        "id": "string",
        "type": "application_keys",
        "attributes": {
          "name": "Application Key for managing dashboards-updated"
        }
      }
    }

    응답

    OK

    Response for retrieving an application key.

    Expand All

    항목

    유형

    설명

    data

    object

    Datadog application key.

    attributes

    object

    Attributes of a full application key.

    created_at

    date-time

    Creation date of the application key.

    key

    string

    The application key.

    last4

    string

    The last four characters of the application key.

    last_used_at

    date-time

    Last usage timestamp of the application key.

    name

    string

    Name of the application key.

    scopes

    [string]

    Array of scopes to grant the application key.

    id

    string

    ID of the application key.

    relationships

    object

    Resources related to the application key.

    owned_by

    object

    Relationship to user.

    data [required]

    object

    Relationship to user object.

    id [required]

    string

    A unique identifier that represents the user.

    type [required]

    enum

    Users resource type. Allowed enum values: users

    default: users

    type

    enum

    Application Keys resource type. Allowed enum values: application_keys

    default: application_keys

    included

    [ <oneOf>]

    Array of objects related to the application key.

    Option 1

    object

    User object returned by the API.

    attributes

    object

    Attributes of user object returned by the API.

    created_at

    date-time

    The ISO 8601 timestamp of when the user account was created.

    disabled

    boolean

    Whether the user account is deactivated. Disabled users cannot log in.

    email

    string

    The email address of the user, used for login and notifications.

    handle

    string

    The unique handle (username) of the user, typically matching their email prefix.

    icon

    string

    URL of the user's profile icon, typically a Gravatar URL derived from the email address.

    last_login_time

    date-time

    The ISO 8601 timestamp of the user's most recent login, or null if the user has never logged in.

    mfa_enabled

    boolean

    Whether multi-factor authentication (MFA) is enabled for the user's account.

    modified_at

    date-time

    The ISO 8601 timestamp of when the user account was last modified.

    name

    string

    The full display name of the user as shown in the Datadog UI.

    service_account

    boolean

    Whether this is a service account rather than a human user. Service accounts are used for programmatic API access.

    status

    string

    The current status of the user account (for example, Active, Pending, or Disabled).

    title

    string

    The job title of the user (for example, "Senior Engineer" or "Product Manager").

    uuid

    string

    The globally unique identifier (UUID) of the user.

    verified

    boolean

    Whether the user's email address has been verified.

    id

    string

    ID of the user.

    relationships

    object

    Relationships of the user object returned by the API.

    org

    object

    Relationship to an organization.

    data [required]

    object

    Relationship to organization object.

    id [required]

    string

    ID of the organization.

    type [required]

    enum

    Organizations resource type. Allowed enum values: orgs

    default: orgs

    other_orgs

    object

    Relationship to organizations.

    data [required]

    [object]

    Relationships to organization objects.

    id [required]

    string

    ID of the organization.

    type [required]

    enum

    Organizations resource type. Allowed enum values: orgs

    default: orgs

    other_users

    object

    Relationship to users.

    data [required]

    [object]

    Relationships to user objects.

    id [required]

    string

    A unique identifier that represents the user.

    type [required]

    enum

    Users resource type. Allowed enum values: users

    default: users

    roles

    object

    Relationship to roles.

    data

    [object]

    An array containing type and the unique identifier of a role.

    id

    string

    The unique identifier of the role.

    type

    enum

    Roles type. Allowed enum values: roles

    default: roles

    type

    enum

    Users resource type. Allowed enum values: users

    default: users

    Option 2

    object

    Role object returned by the API.

    attributes

    object

    Attributes of the role.

    created_at

    date-time

    Creation time of the role.

    modified_at

    date-time

    Time of last role modification.

    name

    string

    The name of the role. The name is neither unique nor a stable identifier of the role.

    receives_permissions_from

    [string]

    The managed role from which this role automatically inherits new permissions. Specify one of the following: "Datadog Admin Role", "Datadog Standard Role", or "Datadog Read Only Role". If empty or not specified, the role does not automatically inherit permissions from any managed role.

    user_count

    int64

    Number of users with that role.

    id

    string

    The unique identifier of the role.

    relationships

    object

    Relationships of the role object returned by the API.

    permissions

    object

    Relationship to multiple permissions objects.

    data

    [object]

    Relationships to permission objects.

    id

    string

    ID of the permission.

    type

    enum

    Permissions resource type. Allowed enum values: permissions

    default: permissions

    type [required]

    enum

    Roles type. Allowed enum values: roles

    default: roles

    Option 3

    object

    The definition of LeakedKey object.

    attributes [required]

    object

    The definition of LeakedKeyAttributes object.

    date [required]

    date-time

    The LeakedKeyAttributes date.

    leak_source

    string

    The LeakedKeyAttributes leak_source.

    id [required]

    string

    The LeakedKey id.

    type [required]

    enum

    The definition of LeakedKeyType object. Allowed enum values: leaked_keys

    default: leaked_keys

    {
      "data": {
        "attributes": {
          "created_at": "2020-11-23T10:00:00.000Z",
          "key": "string",
          "last4": "abcd",
          "last_used_at": "2020-12-20T10:00:00.000Z",
          "name": "Application Key for managing dashboards",
          "scopes": [
            "dashboards_read",
            "dashboards_write",
            "dashboards_public_share"
          ]
        },
        "id": "string",
        "relationships": {
          "owned_by": {
            "data": {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          }
        },
        "type": "application_keys"
      },
      "included": [
        {
          "attributes": {
            "created_at": "2019-09-19T10:00:00.000Z",
            "disabled": false,
            "email": "string",
            "handle": "string",
            "icon": "string",
            "last_login_time": "2019-09-19T10:00:00.000Z",
            "mfa_enabled": false,
            "modified_at": "2019-09-19T10:00:00.000Z",
            "name": "string",
            "service_account": false,
            "status": "string",
            "title": "string",
            "uuid": "string",
            "verified": false
          },
          "id": "string",
          "relationships": {
            "org": {
              "data": {
                "id": "00000000-0000-beef-0000-000000000000",
                "type": "orgs"
              }
            },
            "other_orgs": {
              "data": [
                {
                  "id": "00000000-0000-beef-0000-000000000000",
                  "type": "orgs"
                }
              ]
            },
            "other_users": {
              "data": [
                {
                  "id": "00000000-0000-0000-2345-000000000000",
                  "type": "users"
                }
              ]
            },
            "roles": {
              "data": [
                {
                  "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
                  "type": "roles"
                }
              ]
            }
          },
          "type": "users"
        }
      ]
    }

    Bad Request

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Forbidden

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Not Found

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Too many requests

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    코드 사례

                              ## default
    # 
    
    # Path parameters
    export app_key_id="CHANGE_ME"
    # Curl command
    curl -X PATCH "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/application_keys/${app_key_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "name": "Application Key for managing dashboards", "scopes": [ "dashboards_read", "dashboards_write", "dashboards_public_share" ] }, "id": "00112233-4455-6677-8899-aabbccddeeff", "type": "application_keys" } } EOF
    // Edit an application key 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() {
    	// there is a valid "application_key" in the system
    	ApplicationKeyDataID := os.Getenv("APPLICATION_KEY_DATA_ID")
    
    	body := datadogV2.ApplicationKeyUpdateRequest{
    		Data: datadogV2.ApplicationKeyUpdateData{
    			Id:   ApplicationKeyDataID,
    			Type: datadogV2.APPLICATIONKEYSTYPE_APPLICATION_KEYS,
    			Attributes: datadogV2.ApplicationKeyUpdateAttributes{
    				Name: datadog.PtrString("Application Key for managing dashboards-updated"),
    			},
    		},
    	}
    	ctx := datadog.NewDefaultContext(context.Background())
    	configuration := datadog.NewConfiguration()
    	apiClient := datadog.NewAPIClient(configuration)
    	api := datadogV2.NewKeyManagementApi(apiClient)
    	resp, r, err := api.UpdateApplicationKey(ctx, ApplicationKeyDataID, body)
    
    	if err != nil {
    		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.UpdateApplicationKey`: %v\n", err)
    		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    	}
    
    	responseContent, _ := json.MarshalIndent(resp, "", "  ")
    	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.UpdateApplicationKey`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
    // Edit an application key returns "OK" response
    
    import com.datadog.api.client.ApiClient;
    import com.datadog.api.client.ApiException;
    import com.datadog.api.client.v2.api.KeyManagementApi;
    import com.datadog.api.client.v2.model.ApplicationKeyResponse;
    import com.datadog.api.client.v2.model.ApplicationKeyUpdateAttributes;
    import com.datadog.api.client.v2.model.ApplicationKeyUpdateData;
    import com.datadog.api.client.v2.model.ApplicationKeyUpdateRequest;
    import com.datadog.api.client.v2.model.ApplicationKeysType;
    
    public class Example {
      public static void main(String[] args) {
        ApiClient defaultClient = ApiClient.getDefaultApiClient();
        KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);
    
        // there is a valid "application_key" in the system
        String APPLICATION_KEY_DATA_ATTRIBUTES_NAME =
            System.getenv("APPLICATION_KEY_DATA_ATTRIBUTES_NAME");
        String APPLICATION_KEY_DATA_ID = System.getenv("APPLICATION_KEY_DATA_ID");
    
        ApplicationKeyUpdateRequest body =
            new ApplicationKeyUpdateRequest()
                .data(
                    new ApplicationKeyUpdateData()
                        .id(APPLICATION_KEY_DATA_ID)
                        .type(ApplicationKeysType.APPLICATION_KEYS)
                        .attributes(
                            new ApplicationKeyUpdateAttributes()
                                .name("Application Key for managing dashboards-updated")));
    
        try {
          ApplicationKeyResponse result =
              apiInstance.updateApplicationKey(APPLICATION_KEY_DATA_ID, body);
          System.out.println(result);
        } catch (ApiException e) {
          System.err.println("Exception when calling KeyManagementApi#updateApplicationKey");
          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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
    """
    Edit an application key returns "OK" response
    """
    
    from os import environ
    from datadog_api_client import ApiClient, Configuration
    from datadog_api_client.v2.api.key_management_api import KeyManagementApi
    from datadog_api_client.v2.model.application_key_update_attributes import ApplicationKeyUpdateAttributes
    from datadog_api_client.v2.model.application_key_update_data import ApplicationKeyUpdateData
    from datadog_api_client.v2.model.application_key_update_request import ApplicationKeyUpdateRequest
    from datadog_api_client.v2.model.application_keys_type import ApplicationKeysType
    
    # there is a valid "application_key" in the system
    APPLICATION_KEY_DATA_ATTRIBUTES_NAME = environ["APPLICATION_KEY_DATA_ATTRIBUTES_NAME"]
    APPLICATION_KEY_DATA_ID = environ["APPLICATION_KEY_DATA_ID"]
    
    body = ApplicationKeyUpdateRequest(
        data=ApplicationKeyUpdateData(
            id=APPLICATION_KEY_DATA_ID,
            type=ApplicationKeysType.APPLICATION_KEYS,
            attributes=ApplicationKeyUpdateAttributes(
                name="Application Key for managing dashboards-updated",
            ),
        ),
    )
    
    configuration = Configuration()
    with ApiClient(configuration) as api_client:
        api_instance = KeyManagementApi(api_client)
        response = api_instance.update_application_key(app_key_id=APPLICATION_KEY_DATA_ID, 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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
    # Edit an application key returns "OK" response
    
    require "datadog_api_client"
    api_instance = DatadogAPIClient::V2::KeyManagementAPI.new
    
    # there is a valid "application_key" in the system
    APPLICATION_KEY_DATA_ATTRIBUTES_NAME = ENV["APPLICATION_KEY_DATA_ATTRIBUTES_NAME"]
    APPLICATION_KEY_DATA_ID = ENV["APPLICATION_KEY_DATA_ID"]
    
    body = DatadogAPIClient::V2::ApplicationKeyUpdateRequest.new({
      data: DatadogAPIClient::V2::ApplicationKeyUpdateData.new({
        id: APPLICATION_KEY_DATA_ID,
        type: DatadogAPIClient::V2::ApplicationKeysType::APPLICATION_KEYS,
        attributes: DatadogAPIClient::V2::ApplicationKeyUpdateAttributes.new({
          name: "Application Key for managing dashboards-updated",
        }),
      }),
    })
    p api_instance.update_application_key(APPLICATION_KEY_DATA_ID, body)
    

    Instructions

    First install the library and its dependencies and then save the example to example.rb and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
    // Edit an application key returns "OK" response
    use datadog_api_client::datadog;
    use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;
    use datadog_api_client::datadogV2::model::ApplicationKeyUpdateAttributes;
    use datadog_api_client::datadogV2::model::ApplicationKeyUpdateData;
    use datadog_api_client::datadogV2::model::ApplicationKeyUpdateRequest;
    use datadog_api_client::datadogV2::model::ApplicationKeysType;
    
    #[tokio::main]
    async fn main() {
        // there is a valid "application_key" in the system
        let application_key_data_id = std::env::var("APPLICATION_KEY_DATA_ID").unwrap();
        let body = ApplicationKeyUpdateRequest::new(ApplicationKeyUpdateData::new(
            ApplicationKeyUpdateAttributes::new()
                .name("Application Key for managing dashboards-updated".to_string()),
            application_key_data_id.clone(),
            ApplicationKeysType::APPLICATION_KEYS,
        ));
        let configuration = datadog::Configuration::new();
        let api = KeyManagementAPI::with_config(configuration);
        let resp = api
            .update_application_key(application_key_data_id.clone(), 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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
    /**
     * Edit an application key returns "OK" response
     */
    
    import { client, v2 } from "@datadog/datadog-api-client";
    
    const configuration = client.createConfiguration();
    const apiInstance = new v2.KeyManagementApi(configuration);
    
    // there is a valid "application_key" in the system
    const APPLICATION_KEY_DATA_ID = process.env.APPLICATION_KEY_DATA_ID as string;
    
    const params: v2.KeyManagementApiUpdateApplicationKeyRequest = {
      body: {
        data: {
          id: APPLICATION_KEY_DATA_ID,
          type: "application_keys",
          attributes: {
            name: "Application Key for managing dashboards-updated",
          },
        },
      },
      appKeyId: APPLICATION_KEY_DATA_ID,
    };
    
    apiInstance
      .updateApplicationKey(params)
      .then((data: v2.ApplicationKeyResponse) => {
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

    DELETE https://api.ap1.datadoghq.com/api/v1/application_key/{key}https://api.ap2.datadoghq.com/api/v1/application_key/{key}https://api.datadoghq.eu/api/v1/application_key/{key}https://api.ddog-gov.com/api/v1/application_key/{key}https://api.us2.ddog-gov.com/api/v1/application_key/{key}https://api.datadoghq.com/api/v1/application_key/{key}https://api.us3.datadoghq.com/api/v1/application_key/{key}https://api.us5.datadoghq.com/api/v1/application_key/{key}

    개요

    Delete a given application key. This endpoint is disabled for organizations in One-Time Read mode. This endpoint requires any of the following permissions:

  • org_app_keys_write
  • user_app_keys

  • 인수

    경로 파라미터

    이름

    유형

    설명

    key [required]

    string

    The specific APP key you are working with.

    응답

    OK

    An application key response.

    Expand All

    항목

    유형

    설명

    application_key

    object

    An application key with its associated metadata.

    hash

    string

    Hash of an application key.

    name

    string

    Name of an application key.

    owner

    string

    Owner of an application key.

    {
      "application_key": {
        "hash": "1234512345123459cda4eb9ced49a3d84fd0138c",
        "name": "app_key",
        "owner": "test_user"
      }
    }

    Forbidden

    Error response object.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    Array of errors returned by the API.

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

    Not Found

    Error response object.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    Array of errors returned by the API.

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

    Too many requests

    Error response object.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    Array of errors returned by the API.

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

    코드 사례

                      # Path parameters
    export key="CHANGE_ME"
    # Curl command
    curl -X DELETE "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/application_key/${key}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
    """
    Delete an application key returns "OK" response
    """
    
    from datadog_api_client import ApiClient, Configuration
    from datadog_api_client.v1.api.key_management_api import KeyManagementApi
    
    configuration = Configuration()
    with ApiClient(configuration) as api_client:
        api_instance = KeyManagementApi(api_client)
        response = api_instance.delete_application_key(
            key="key",
        )
    
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
    # Delete an application key returns "OK" response
    
    require "datadog_api_client"
    api_instance = DatadogAPIClient::V1::KeyManagementAPI.new
    p api_instance.delete_application_key("key")
    

    Instructions

    First install the library and its dependencies and then save the example to example.rb and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
    // Delete an application key 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() {
    	ctx := datadog.NewDefaultContext(context.Background())
    	configuration := datadog.NewConfiguration()
    	apiClient := datadog.NewAPIClient(configuration)
    	api := datadogV1.NewKeyManagementApi(apiClient)
    	resp, r, err := api.DeleteApplicationKey(ctx, "key")
    
    	if err != nil {
    		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.DeleteApplicationKey`: %v\n", err)
    		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    	}
    
    	responseContent, _ := json.MarshalIndent(resp, "", "  ")
    	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.DeleteApplicationKey`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
    // Delete an application key returns "OK" response
    
    import com.datadog.api.client.ApiClient;
    import com.datadog.api.client.ApiException;
    import com.datadog.api.client.v1.api.KeyManagementApi;
    import com.datadog.api.client.v1.model.ApplicationKeyResponse;
    
    public class Example {
      public static void main(String[] args) {
        ApiClient defaultClient = ApiClient.getDefaultApiClient();
        KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);
    
        try {
          ApplicationKeyResponse result = apiInstance.deleteApplicationKey("key");
          System.out.println(result);
        } catch (ApiException e) {
          System.err.println("Exception when calling KeyManagementApi#deleteApplicationKey");
          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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
    // Delete an application key returns "OK" response
    use datadog_api_client::datadog;
    use datadog_api_client::datadogV1::api_key_management::KeyManagementAPI;
    
    #[tokio::main]
    async fn main() {
        let configuration = datadog::Configuration::new();
        let api = KeyManagementAPI::with_config(configuration);
        let resp = api.delete_application_key("key".to_string()).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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
    /**
     * Delete an application key returns "OK" response
     */
    
    import { client, v1 } from "@datadog/datadog-api-client";
    
    const configuration = client.createConfiguration();
    const apiInstance = new v1.KeyManagementApi(configuration);
    
    const params: v1.KeyManagementApiDeleteApplicationKeyRequest = {
      key: "key",
    };
    
    apiInstance
      .deleteApplicationKey(params)
      .then((data: v1.ApplicationKeyResponse) => {
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

    DELETE https://api.ap1.datadoghq.com/api/v2/application_keys/{app_key_id}https://api.ap2.datadoghq.com/api/v2/application_keys/{app_key_id}https://api.datadoghq.eu/api/v2/application_keys/{app_key_id}https://api.ddog-gov.com/api/v2/application_keys/{app_key_id}https://api.us2.ddog-gov.com/api/v2/application_keys/{app_key_id}https://api.datadoghq.com/api/v2/application_keys/{app_key_id}https://api.us3.datadoghq.com/api/v2/application_keys/{app_key_id}https://api.us5.datadoghq.com/api/v2/application_keys/{app_key_id}

    개요

    Delete an application key This endpoint requires the org_app_keys_write permission.

    인수

    경로 파라미터

    이름

    유형

    설명

    app_key_id [required]

    string

    The ID of the application key.

    응답

    No Content

    Forbidden

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Not Found

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Too many requests

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    코드 사례

                      # Path parameters
    export app_key_id="CHANGE_ME"
    # Curl command
    curl -X DELETE "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/application_keys/${app_key_id}" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
    """
    Delete an application key returns "No Content" response
    """
    
    from os import environ
    from datadog_api_client import ApiClient, Configuration
    from datadog_api_client.v2.api.key_management_api import KeyManagementApi
    
    # there is a valid "application_key" in the system
    APPLICATION_KEY_DATA_ID = environ["APPLICATION_KEY_DATA_ID"]
    
    configuration = Configuration()
    with ApiClient(configuration) as api_client:
        api_instance = KeyManagementApi(api_client)
        api_instance.delete_application_key(
            app_key_id=APPLICATION_KEY_DATA_ID,
        )
    

    Instructions

    First install the library and its dependencies and then save the example to example.py and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
    # Delete an application key returns "No Content" response
    
    require "datadog_api_client"
    api_instance = DatadogAPIClient::V2::KeyManagementAPI.new
    
    # there is a valid "application_key" in the system
    APPLICATION_KEY_DATA_ID = ENV["APPLICATION_KEY_DATA_ID"]
    api_instance.delete_application_key(APPLICATION_KEY_DATA_ID)
    

    Instructions

    First install the library and its dependencies and then save the example to example.rb and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
    // Delete an application key returns "No Content" response
    
    package main
    
    import (
    	"context"
    	"fmt"
    	"os"
    
    	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
    	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
    )
    
    func main() {
    	// there is a valid "application_key" in the system
    	ApplicationKeyDataID := os.Getenv("APPLICATION_KEY_DATA_ID")
    
    	ctx := datadog.NewDefaultContext(context.Background())
    	configuration := datadog.NewConfiguration()
    	apiClient := datadog.NewAPIClient(configuration)
    	api := datadogV2.NewKeyManagementApi(apiClient)
    	r, err := api.DeleteApplicationKey(ctx, ApplicationKeyDataID)
    
    	if err != nil {
    		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.DeleteApplicationKey`: %v\n", err)
    		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    	}
    }
    

    Instructions

    First install the library and its dependencies and then save the example to main.go and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
    // Delete an application key returns "No Content" response
    
    import com.datadog.api.client.ApiClient;
    import com.datadog.api.client.ApiException;
    import com.datadog.api.client.v2.api.KeyManagementApi;
    
    public class Example {
      public static void main(String[] args) {
        ApiClient defaultClient = ApiClient.getDefaultApiClient();
        KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);
    
        // there is a valid "application_key" in the system
        String APPLICATION_KEY_DATA_ID = System.getenv("APPLICATION_KEY_DATA_ID");
    
        try {
          apiInstance.deleteApplicationKey(APPLICATION_KEY_DATA_ID);
        } catch (ApiException e) {
          System.err.println("Exception when calling KeyManagementApi#deleteApplicationKey");
          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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
    // Delete an application key returns "No Content" response
    use datadog_api_client::datadog;
    use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;
    
    #[tokio::main]
    async fn main() {
        // there is a valid "application_key" in the system
        let application_key_data_id = std::env::var("APPLICATION_KEY_DATA_ID").unwrap();
        let configuration = datadog::Configuration::new();
        let api = KeyManagementAPI::with_config(configuration);
        let resp = api
            .delete_application_key(application_key_data_id.clone())
            .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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
    /**
     * Delete an application key returns "No Content" response
     */
    
    import { client, v2 } from "@datadog/datadog-api-client";
    
    const configuration = client.createConfiguration();
    const apiInstance = new v2.KeyManagementApi(configuration);
    
    // there is a valid "application_key" in the system
    const APPLICATION_KEY_DATA_ID = process.env.APPLICATION_KEY_DATA_ID as string;
    
    const params: v2.KeyManagementApiDeleteApplicationKeyRequest = {
      appKeyId: APPLICATION_KEY_DATA_ID,
    };
    
    apiInstance
      .deleteApplicationKey(params)
      .then((data: any) => {
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

    DELETE https://api.ap1.datadoghq.com/api/v2/current_user/application_keys/{app_key_id}https://api.ap2.datadoghq.com/api/v2/current_user/application_keys/{app_key_id}https://api.datadoghq.eu/api/v2/current_user/application_keys/{app_key_id}https://api.ddog-gov.com/api/v2/current_user/application_keys/{app_key_id}https://api.us2.ddog-gov.com/api/v2/current_user/application_keys/{app_key_id}https://api.datadoghq.com/api/v2/current_user/application_keys/{app_key_id}https://api.us3.datadoghq.com/api/v2/current_user/application_keys/{app_key_id}https://api.us5.datadoghq.com/api/v2/current_user/application_keys/{app_key_id}

    개요

    Delete an application key owned by current user This endpoint requires the user_app_keys permission.

    인수

    경로 파라미터

    이름

    유형

    설명

    app_key_id [required]

    string

    The ID of the application key.

    응답

    No Content

    Forbidden

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Not Found

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Too many requests

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    코드 사례

                      # Path parameters
    export app_key_id="CHANGE_ME"
    # Curl command
    curl -X DELETE "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/current_user/application_keys/${app_key_id}" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
    """
    Delete an application key owned by current user returns "No Content" response
    """
    
    from os import environ
    from datadog_api_client import ApiClient, Configuration
    from datadog_api_client.v2.api.key_management_api import KeyManagementApi
    
    # there is a valid "application_key" in the system
    APPLICATION_KEY_DATA_ID = environ["APPLICATION_KEY_DATA_ID"]
    
    configuration = Configuration()
    with ApiClient(configuration) as api_client:
        api_instance = KeyManagementApi(api_client)
        api_instance.delete_current_user_application_key(
            app_key_id=APPLICATION_KEY_DATA_ID,
        )
    

    Instructions

    First install the library and its dependencies and then save the example to example.py and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
    # Delete an application key owned by current user returns "No Content" response
    
    require "datadog_api_client"
    api_instance = DatadogAPIClient::V2::KeyManagementAPI.new
    
    # there is a valid "application_key" in the system
    APPLICATION_KEY_DATA_ID = ENV["APPLICATION_KEY_DATA_ID"]
    api_instance.delete_current_user_application_key(APPLICATION_KEY_DATA_ID)
    

    Instructions

    First install the library and its dependencies and then save the example to example.rb and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
    // Delete an application key owned by current user returns "No Content" response
    
    package main
    
    import (
    	"context"
    	"fmt"
    	"os"
    
    	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
    	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
    )
    
    func main() {
    	// there is a valid "application_key" in the system
    	ApplicationKeyDataID := os.Getenv("APPLICATION_KEY_DATA_ID")
    
    	ctx := datadog.NewDefaultContext(context.Background())
    	configuration := datadog.NewConfiguration()
    	apiClient := datadog.NewAPIClient(configuration)
    	api := datadogV2.NewKeyManagementApi(apiClient)
    	r, err := api.DeleteCurrentUserApplicationKey(ctx, ApplicationKeyDataID)
    
    	if err != nil {
    		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.DeleteCurrentUserApplicationKey`: %v\n", err)
    		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    	}
    }
    

    Instructions

    First install the library and its dependencies and then save the example to main.go and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
    // Delete an application key owned by current user returns "No Content" response
    
    import com.datadog.api.client.ApiClient;
    import com.datadog.api.client.ApiException;
    import com.datadog.api.client.v2.api.KeyManagementApi;
    
    public class Example {
      public static void main(String[] args) {
        ApiClient defaultClient = ApiClient.getDefaultApiClient();
        KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);
    
        // there is a valid "application_key" in the system
        String APPLICATION_KEY_DATA_ID = System.getenv("APPLICATION_KEY_DATA_ID");
    
        try {
          apiInstance.deleteCurrentUserApplicationKey(APPLICATION_KEY_DATA_ID);
        } catch (ApiException e) {
          System.err.println("Exception when calling KeyManagementApi#deleteCurrentUserApplicationKey");
          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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
    // Delete an application key owned by current user returns "No Content" response
    use datadog_api_client::datadog;
    use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;
    
    #[tokio::main]
    async fn main() {
        // there is a valid "application_key" in the system
        let application_key_data_id = std::env::var("APPLICATION_KEY_DATA_ID").unwrap();
        let configuration = datadog::Configuration::new();
        let api = KeyManagementAPI::with_config(configuration);
        let resp = api
            .delete_current_user_application_key(application_key_data_id.clone())
            .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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
    /**
     * Delete an application key owned by current user returns "No Content" response
     */
    
    import { client, v2 } from "@datadog/datadog-api-client";
    
    const configuration = client.createConfiguration();
    const apiInstance = new v2.KeyManagementApi(configuration);
    
    // there is a valid "application_key" in the system
    const APPLICATION_KEY_DATA_ID = process.env.APPLICATION_KEY_DATA_ID as string;
    
    const params: v2.KeyManagementApiDeleteCurrentUserApplicationKeyRequest = {
      appKeyId: APPLICATION_KEY_DATA_ID,
    };
    
    apiInstance
      .deleteCurrentUserApplicationKey(params)
      .then((data: any) => {
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

    PATCH https://api.ap1.datadoghq.com/api/v2/current_user/application_keys/{app_key_id}https://api.ap2.datadoghq.com/api/v2/current_user/application_keys/{app_key_id}https://api.datadoghq.eu/api/v2/current_user/application_keys/{app_key_id}https://api.ddog-gov.com/api/v2/current_user/application_keys/{app_key_id}https://api.us2.ddog-gov.com/api/v2/current_user/application_keys/{app_key_id}https://api.datadoghq.com/api/v2/current_user/application_keys/{app_key_id}https://api.us3.datadoghq.com/api/v2/current_user/application_keys/{app_key_id}https://api.us5.datadoghq.com/api/v2/current_user/application_keys/{app_key_id}

    개요

    Edit an application key owned by current user. The key field is not returned for organizations in One-Time Read mode. This endpoint requires the user_app_keys permission.

    인수

    경로 파라미터

    이름

    유형

    설명

    app_key_id [required]

    string

    The ID of the application key.

    요청

    Body Data (required)

    Expand All

    항목

    유형

    설명

    data [required]

    object

    Object used to update an application key.

    attributes [required]

    object

    Attributes used to update an application Key.

    name

    string

    Name of the application key.

    scopes

    [string]

    Array of scopes to grant the application key.

    id [required]

    string

    ID of the application key.

    type [required]

    enum

    Application Keys resource type. Allowed enum values: application_keys

    default: application_keys

    {
      "data": {
        "id": "string",
        "type": "application_keys",
        "attributes": {
          "name": "Application Key for managing dashboards-updated"
        }
      }
    }

    응답

    OK

    Response for retrieving an application key.

    Expand All

    항목

    유형

    설명

    data

    object

    Datadog application key.

    attributes

    object

    Attributes of a full application key.

    created_at

    date-time

    Creation date of the application key.

    key

    string

    The application key.

    last4

    string

    The last four characters of the application key.

    last_used_at

    date-time

    Last usage timestamp of the application key.

    name

    string

    Name of the application key.

    scopes

    [string]

    Array of scopes to grant the application key.

    id

    string

    ID of the application key.

    relationships

    object

    Resources related to the application key.

    owned_by

    object

    Relationship to user.

    data [required]

    object

    Relationship to user object.

    id [required]

    string

    A unique identifier that represents the user.

    type [required]

    enum

    Users resource type. Allowed enum values: users

    default: users

    type

    enum

    Application Keys resource type. Allowed enum values: application_keys

    default: application_keys

    included

    [ <oneOf>]

    Array of objects related to the application key.

    Option 1

    object

    User object returned by the API.

    attributes

    object

    Attributes of user object returned by the API.

    created_at

    date-time

    The ISO 8601 timestamp of when the user account was created.

    disabled

    boolean

    Whether the user account is deactivated. Disabled users cannot log in.

    email

    string

    The email address of the user, used for login and notifications.

    handle

    string

    The unique handle (username) of the user, typically matching their email prefix.

    icon

    string

    URL of the user's profile icon, typically a Gravatar URL derived from the email address.

    last_login_time

    date-time

    The ISO 8601 timestamp of the user's most recent login, or null if the user has never logged in.

    mfa_enabled

    boolean

    Whether multi-factor authentication (MFA) is enabled for the user's account.

    modified_at

    date-time

    The ISO 8601 timestamp of when the user account was last modified.

    name

    string

    The full display name of the user as shown in the Datadog UI.

    service_account

    boolean

    Whether this is a service account rather than a human user. Service accounts are used for programmatic API access.

    status

    string

    The current status of the user account (for example, Active, Pending, or Disabled).

    title

    string

    The job title of the user (for example, "Senior Engineer" or "Product Manager").

    uuid

    string

    The globally unique identifier (UUID) of the user.

    verified

    boolean

    Whether the user's email address has been verified.

    id

    string

    ID of the user.

    relationships

    object

    Relationships of the user object returned by the API.

    org

    object

    Relationship to an organization.

    data [required]

    object

    Relationship to organization object.

    id [required]

    string

    ID of the organization.

    type [required]

    enum

    Organizations resource type. Allowed enum values: orgs

    default: orgs

    other_orgs

    object

    Relationship to organizations.

    data [required]

    [object]

    Relationships to organization objects.

    id [required]

    string

    ID of the organization.

    type [required]

    enum

    Organizations resource type. Allowed enum values: orgs

    default: orgs

    other_users

    object

    Relationship to users.

    data [required]

    [object]

    Relationships to user objects.

    id [required]

    string

    A unique identifier that represents the user.

    type [required]

    enum

    Users resource type. Allowed enum values: users

    default: users

    roles

    object

    Relationship to roles.

    data

    [object]

    An array containing type and the unique identifier of a role.

    id

    string

    The unique identifier of the role.

    type

    enum

    Roles type. Allowed enum values: roles

    default: roles

    type

    enum

    Users resource type. Allowed enum values: users

    default: users

    Option 2

    object

    Role object returned by the API.

    attributes

    object

    Attributes of the role.

    created_at

    date-time

    Creation time of the role.

    modified_at

    date-time

    Time of last role modification.

    name

    string

    The name of the role. The name is neither unique nor a stable identifier of the role.

    receives_permissions_from

    [string]

    The managed role from which this role automatically inherits new permissions. Specify one of the following: "Datadog Admin Role", "Datadog Standard Role", or "Datadog Read Only Role". If empty or not specified, the role does not automatically inherit permissions from any managed role.

    user_count

    int64

    Number of users with that role.

    id

    string

    The unique identifier of the role.

    relationships

    object

    Relationships of the role object returned by the API.

    permissions

    object

    Relationship to multiple permissions objects.

    data

    [object]

    Relationships to permission objects.

    id

    string

    ID of the permission.

    type

    enum

    Permissions resource type. Allowed enum values: permissions

    default: permissions

    type [required]

    enum

    Roles type. Allowed enum values: roles

    default: roles

    Option 3

    object

    The definition of LeakedKey object.

    attributes [required]

    object

    The definition of LeakedKeyAttributes object.

    date [required]

    date-time

    The LeakedKeyAttributes date.

    leak_source

    string

    The LeakedKeyAttributes leak_source.

    id [required]

    string

    The LeakedKey id.

    type [required]

    enum

    The definition of LeakedKeyType object. Allowed enum values: leaked_keys

    default: leaked_keys

    {
      "data": {
        "attributes": {
          "created_at": "2020-11-23T10:00:00.000Z",
          "key": "string",
          "last4": "abcd",
          "last_used_at": "2020-12-20T10:00:00.000Z",
          "name": "Application Key for managing dashboards",
          "scopes": [
            "dashboards_read",
            "dashboards_write",
            "dashboards_public_share"
          ]
        },
        "id": "string",
        "relationships": {
          "owned_by": {
            "data": {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          }
        },
        "type": "application_keys"
      },
      "included": [
        {
          "attributes": {
            "created_at": "2019-09-19T10:00:00.000Z",
            "disabled": false,
            "email": "string",
            "handle": "string",
            "icon": "string",
            "last_login_time": "2019-09-19T10:00:00.000Z",
            "mfa_enabled": false,
            "modified_at": "2019-09-19T10:00:00.000Z",
            "name": "string",
            "service_account": false,
            "status": "string",
            "title": "string",
            "uuid": "string",
            "verified": false
          },
          "id": "string",
          "relationships": {
            "org": {
              "data": {
                "id": "00000000-0000-beef-0000-000000000000",
                "type": "orgs"
              }
            },
            "other_orgs": {
              "data": [
                {
                  "id": "00000000-0000-beef-0000-000000000000",
                  "type": "orgs"
                }
              ]
            },
            "other_users": {
              "data": [
                {
                  "id": "00000000-0000-0000-2345-000000000000",
                  "type": "users"
                }
              ]
            },
            "roles": {
              "data": [
                {
                  "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
                  "type": "roles"
                }
              ]
            }
          },
          "type": "users"
        }
      ]
    }

    Bad Request

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Forbidden

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Not Found

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Too many requests

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    코드 사례

                              ## default
    # 
    
    # Path parameters
    export app_key_id="CHANGE_ME"
    # Curl command
    curl -X PATCH "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/current_user/application_keys/${app_key_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "name": "Application Key for managing dashboards", "scopes": [ "dashboards_read", "dashboards_write", "dashboards_public_share" ] }, "id": "00112233-4455-6677-8899-aabbccddeeff", "type": "application_keys" } } EOF
    // Edit an application key owned by current user 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() {
    	// there is a valid "application_key" in the system
    	ApplicationKeyDataID := os.Getenv("APPLICATION_KEY_DATA_ID")
    
    	body := datadogV2.ApplicationKeyUpdateRequest{
    		Data: datadogV2.ApplicationKeyUpdateData{
    			Id:   ApplicationKeyDataID,
    			Type: datadogV2.APPLICATIONKEYSTYPE_APPLICATION_KEYS,
    			Attributes: datadogV2.ApplicationKeyUpdateAttributes{
    				Name: datadog.PtrString("Application Key for managing dashboards-updated"),
    			},
    		},
    	}
    	ctx := datadog.NewDefaultContext(context.Background())
    	configuration := datadog.NewConfiguration()
    	apiClient := datadog.NewAPIClient(configuration)
    	api := datadogV2.NewKeyManagementApi(apiClient)
    	resp, r, err := api.UpdateCurrentUserApplicationKey(ctx, ApplicationKeyDataID, body)
    
    	if err != nil {
    		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.UpdateCurrentUserApplicationKey`: %v\n", err)
    		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    	}
    
    	responseContent, _ := json.MarshalIndent(resp, "", "  ")
    	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.UpdateCurrentUserApplicationKey`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
    // Edit an application key owned by current user returns "OK" response
    
    import com.datadog.api.client.ApiClient;
    import com.datadog.api.client.ApiException;
    import com.datadog.api.client.v2.api.KeyManagementApi;
    import com.datadog.api.client.v2.model.ApplicationKeyResponse;
    import com.datadog.api.client.v2.model.ApplicationKeyUpdateAttributes;
    import com.datadog.api.client.v2.model.ApplicationKeyUpdateData;
    import com.datadog.api.client.v2.model.ApplicationKeyUpdateRequest;
    import com.datadog.api.client.v2.model.ApplicationKeysType;
    
    public class Example {
      public static void main(String[] args) {
        ApiClient defaultClient = ApiClient.getDefaultApiClient();
        KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);
    
        // there is a valid "application_key" in the system
        String APPLICATION_KEY_DATA_ATTRIBUTES_NAME =
            System.getenv("APPLICATION_KEY_DATA_ATTRIBUTES_NAME");
        String APPLICATION_KEY_DATA_ID = System.getenv("APPLICATION_KEY_DATA_ID");
    
        ApplicationKeyUpdateRequest body =
            new ApplicationKeyUpdateRequest()
                .data(
                    new ApplicationKeyUpdateData()
                        .id(APPLICATION_KEY_DATA_ID)
                        .type(ApplicationKeysType.APPLICATION_KEYS)
                        .attributes(
                            new ApplicationKeyUpdateAttributes()
                                .name("Application Key for managing dashboards-updated")));
    
        try {
          ApplicationKeyResponse result =
              apiInstance.updateCurrentUserApplicationKey(APPLICATION_KEY_DATA_ID, body);
          System.out.println(result);
        } catch (ApiException e) {
          System.err.println("Exception when calling KeyManagementApi#updateCurrentUserApplicationKey");
          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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
    """
    Edit an application key owned by current user returns "OK" response
    """
    
    from os import environ
    from datadog_api_client import ApiClient, Configuration
    from datadog_api_client.v2.api.key_management_api import KeyManagementApi
    from datadog_api_client.v2.model.application_key_update_attributes import ApplicationKeyUpdateAttributes
    from datadog_api_client.v2.model.application_key_update_data import ApplicationKeyUpdateData
    from datadog_api_client.v2.model.application_key_update_request import ApplicationKeyUpdateRequest
    from datadog_api_client.v2.model.application_keys_type import ApplicationKeysType
    
    # there is a valid "application_key" in the system
    APPLICATION_KEY_DATA_ATTRIBUTES_NAME = environ["APPLICATION_KEY_DATA_ATTRIBUTES_NAME"]
    APPLICATION_KEY_DATA_ID = environ["APPLICATION_KEY_DATA_ID"]
    
    body = ApplicationKeyUpdateRequest(
        data=ApplicationKeyUpdateData(
            id=APPLICATION_KEY_DATA_ID,
            type=ApplicationKeysType.APPLICATION_KEYS,
            attributes=ApplicationKeyUpdateAttributes(
                name="Application Key for managing dashboards-updated",
            ),
        ),
    )
    
    configuration = Configuration()
    with ApiClient(configuration) as api_client:
        api_instance = KeyManagementApi(api_client)
        response = api_instance.update_current_user_application_key(app_key_id=APPLICATION_KEY_DATA_ID, 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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
    # Edit an application key owned by current user returns "OK" response
    
    require "datadog_api_client"
    api_instance = DatadogAPIClient::V2::KeyManagementAPI.new
    
    # there is a valid "application_key" in the system
    APPLICATION_KEY_DATA_ATTRIBUTES_NAME = ENV["APPLICATION_KEY_DATA_ATTRIBUTES_NAME"]
    APPLICATION_KEY_DATA_ID = ENV["APPLICATION_KEY_DATA_ID"]
    
    body = DatadogAPIClient::V2::ApplicationKeyUpdateRequest.new({
      data: DatadogAPIClient::V2::ApplicationKeyUpdateData.new({
        id: APPLICATION_KEY_DATA_ID,
        type: DatadogAPIClient::V2::ApplicationKeysType::APPLICATION_KEYS,
        attributes: DatadogAPIClient::V2::ApplicationKeyUpdateAttributes.new({
          name: "Application Key for managing dashboards-updated",
        }),
      }),
    })
    p api_instance.update_current_user_application_key(APPLICATION_KEY_DATA_ID, body)
    

    Instructions

    First install the library and its dependencies and then save the example to example.rb and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
    // Edit an application key owned by current user returns "OK" response
    use datadog_api_client::datadog;
    use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;
    use datadog_api_client::datadogV2::model::ApplicationKeyUpdateAttributes;
    use datadog_api_client::datadogV2::model::ApplicationKeyUpdateData;
    use datadog_api_client::datadogV2::model::ApplicationKeyUpdateRequest;
    use datadog_api_client::datadogV2::model::ApplicationKeysType;
    
    #[tokio::main]
    async fn main() {
        // there is a valid "application_key" in the system
        let application_key_data_id = std::env::var("APPLICATION_KEY_DATA_ID").unwrap();
        let body = ApplicationKeyUpdateRequest::new(ApplicationKeyUpdateData::new(
            ApplicationKeyUpdateAttributes::new()
                .name("Application Key for managing dashboards-updated".to_string()),
            application_key_data_id.clone(),
            ApplicationKeysType::APPLICATION_KEYS,
        ));
        let configuration = datadog::Configuration::new();
        let api = KeyManagementAPI::with_config(configuration);
        let resp = api
            .update_current_user_application_key(application_key_data_id.clone(), 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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
    /**
     * Edit an application key owned by current user returns "OK" response
     */
    
    import { client, v2 } from "@datadog/datadog-api-client";
    
    const configuration = client.createConfiguration();
    const apiInstance = new v2.KeyManagementApi(configuration);
    
    // there is a valid "application_key" in the system
    const APPLICATION_KEY_DATA_ID = process.env.APPLICATION_KEY_DATA_ID as string;
    
    const params: v2.KeyManagementApiUpdateCurrentUserApplicationKeyRequest = {
      body: {
        data: {
          id: APPLICATION_KEY_DATA_ID,
          type: "application_keys",
          attributes: {
            name: "Application Key for managing dashboards-updated",
          },
        },
      },
      appKeyId: APPLICATION_KEY_DATA_ID,
    };
    
    apiInstance
      .updateCurrentUserApplicationKey(params)
      .then((data: v2.ApplicationKeyResponse) => {
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

    GET https://api.ap1.datadoghq.com/api/v2/current_user/application_keys/{app_key_id}https://api.ap2.datadoghq.com/api/v2/current_user/application_keys/{app_key_id}https://api.datadoghq.eu/api/v2/current_user/application_keys/{app_key_id}https://api.ddog-gov.com/api/v2/current_user/application_keys/{app_key_id}https://api.us2.ddog-gov.com/api/v2/current_user/application_keys/{app_key_id}https://api.datadoghq.com/api/v2/current_user/application_keys/{app_key_id}https://api.us3.datadoghq.com/api/v2/current_user/application_keys/{app_key_id}https://api.us5.datadoghq.com/api/v2/current_user/application_keys/{app_key_id}

    개요

    Get an application key owned by current user. The key field is not returned for organizations in One-Time Read mode. This endpoint requires the user_app_keys permission.

    인수

    경로 파라미터

    이름

    유형

    설명

    app_key_id [required]

    string

    The ID of the application key.

    응답

    OK

    Response for retrieving an application key.

    Expand All

    항목

    유형

    설명

    data

    object

    Datadog application key.

    attributes

    object

    Attributes of a full application key.

    created_at

    date-time

    Creation date of the application key.

    key

    string

    The application key.

    last4

    string

    The last four characters of the application key.

    last_used_at

    date-time

    Last usage timestamp of the application key.

    name

    string

    Name of the application key.

    scopes

    [string]

    Array of scopes to grant the application key.

    id

    string

    ID of the application key.

    relationships

    object

    Resources related to the application key.

    owned_by

    object

    Relationship to user.

    data [required]

    object

    Relationship to user object.

    id [required]

    string

    A unique identifier that represents the user.

    type [required]

    enum

    Users resource type. Allowed enum values: users

    default: users

    type

    enum

    Application Keys resource type. Allowed enum values: application_keys

    default: application_keys

    included

    [ <oneOf>]

    Array of objects related to the application key.

    Option 1

    object

    User object returned by the API.

    attributes

    object

    Attributes of user object returned by the API.

    created_at

    date-time

    The ISO 8601 timestamp of when the user account was created.

    disabled

    boolean

    Whether the user account is deactivated. Disabled users cannot log in.

    email

    string

    The email address of the user, used for login and notifications.

    handle

    string

    The unique handle (username) of the user, typically matching their email prefix.

    icon

    string

    URL of the user's profile icon, typically a Gravatar URL derived from the email address.

    last_login_time

    date-time

    The ISO 8601 timestamp of the user's most recent login, or null if the user has never logged in.

    mfa_enabled

    boolean

    Whether multi-factor authentication (MFA) is enabled for the user's account.

    modified_at

    date-time

    The ISO 8601 timestamp of when the user account was last modified.

    name

    string

    The full display name of the user as shown in the Datadog UI.

    service_account

    boolean

    Whether this is a service account rather than a human user. Service accounts are used for programmatic API access.

    status

    string

    The current status of the user account (for example, Active, Pending, or Disabled).

    title

    string

    The job title of the user (for example, "Senior Engineer" or "Product Manager").

    uuid

    string

    The globally unique identifier (UUID) of the user.

    verified

    boolean

    Whether the user's email address has been verified.

    id

    string

    ID of the user.

    relationships

    object

    Relationships of the user object returned by the API.

    org

    object

    Relationship to an organization.

    data [required]

    object

    Relationship to organization object.

    id [required]

    string

    ID of the organization.

    type [required]

    enum

    Organizations resource type. Allowed enum values: orgs

    default: orgs

    other_orgs

    object

    Relationship to organizations.

    data [required]

    [object]

    Relationships to organization objects.

    id [required]

    string

    ID of the organization.

    type [required]

    enum

    Organizations resource type. Allowed enum values: orgs

    default: orgs

    other_users

    object

    Relationship to users.

    data [required]

    [object]

    Relationships to user objects.

    id [required]

    string

    A unique identifier that represents the user.

    type [required]

    enum

    Users resource type. Allowed enum values: users

    default: users

    roles

    object

    Relationship to roles.

    data

    [object]

    An array containing type and the unique identifier of a role.

    id

    string

    The unique identifier of the role.

    type

    enum

    Roles type. Allowed enum values: roles

    default: roles

    type

    enum

    Users resource type. Allowed enum values: users

    default: users

    Option 2

    object

    Role object returned by the API.

    attributes

    object

    Attributes of the role.

    created_at

    date-time

    Creation time of the role.

    modified_at

    date-time

    Time of last role modification.

    name

    string

    The name of the role. The name is neither unique nor a stable identifier of the role.

    receives_permissions_from

    [string]

    The managed role from which this role automatically inherits new permissions. Specify one of the following: "Datadog Admin Role", "Datadog Standard Role", or "Datadog Read Only Role". If empty or not specified, the role does not automatically inherit permissions from any managed role.

    user_count

    int64

    Number of users with that role.

    id

    string

    The unique identifier of the role.

    relationships

    object

    Relationships of the role object returned by the API.

    permissions

    object

    Relationship to multiple permissions objects.

    data

    [object]

    Relationships to permission objects.

    id

    string

    ID of the permission.

    type

    enum

    Permissions resource type. Allowed enum values: permissions

    default: permissions

    type [required]

    enum

    Roles type. Allowed enum values: roles

    default: roles

    Option 3

    object

    The definition of LeakedKey object.

    attributes [required]

    object

    The definition of LeakedKeyAttributes object.

    date [required]

    date-time

    The LeakedKeyAttributes date.

    leak_source

    string

    The LeakedKeyAttributes leak_source.

    id [required]

    string

    The LeakedKey id.

    type [required]

    enum

    The definition of LeakedKeyType object. Allowed enum values: leaked_keys

    default: leaked_keys

    {
      "data": {
        "attributes": {
          "created_at": "2020-11-23T10:00:00.000Z",
          "key": "string",
          "last4": "abcd",
          "last_used_at": "2020-12-20T10:00:00.000Z",
          "name": "Application Key for managing dashboards",
          "scopes": [
            "dashboards_read",
            "dashboards_write",
            "dashboards_public_share"
          ]
        },
        "id": "string",
        "relationships": {
          "owned_by": {
            "data": {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          }
        },
        "type": "application_keys"
      },
      "included": [
        {
          "attributes": {
            "created_at": "2019-09-19T10:00:00.000Z",
            "disabled": false,
            "email": "string",
            "handle": "string",
            "icon": "string",
            "last_login_time": "2019-09-19T10:00:00.000Z",
            "mfa_enabled": false,
            "modified_at": "2019-09-19T10:00:00.000Z",
            "name": "string",
            "service_account": false,
            "status": "string",
            "title": "string",
            "uuid": "string",
            "verified": false
          },
          "id": "string",
          "relationships": {
            "org": {
              "data": {
                "id": "00000000-0000-beef-0000-000000000000",
                "type": "orgs"
              }
            },
            "other_orgs": {
              "data": [
                {
                  "id": "00000000-0000-beef-0000-000000000000",
                  "type": "orgs"
                }
              ]
            },
            "other_users": {
              "data": [
                {
                  "id": "00000000-0000-0000-2345-000000000000",
                  "type": "users"
                }
              ]
            },
            "roles": {
              "data": [
                {
                  "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
                  "type": "roles"
                }
              ]
            }
          },
          "type": "users"
        }
      ]
    }

    Forbidden

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Not Found

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Too many requests

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    코드 사례

                      # Path parameters
    export app_key_id="CHANGE_ME"
    # Curl command
    curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/current_user/application_keys/${app_key_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
    """
    Get one application key owned by current user returns "OK" response
    """
    
    from os import environ
    from datadog_api_client import ApiClient, Configuration
    from datadog_api_client.v2.api.key_management_api import KeyManagementApi
    
    # there is a valid "application_key" in the system
    APPLICATION_KEY_DATA_ID = environ["APPLICATION_KEY_DATA_ID"]
    
    configuration = Configuration()
    with ApiClient(configuration) as api_client:
        api_instance = KeyManagementApi(api_client)
        response = api_instance.get_current_user_application_key(
            app_key_id=APPLICATION_KEY_DATA_ID,
        )
    
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
    # Get one application key owned by current user returns "OK" response
    
    require "datadog_api_client"
    api_instance = DatadogAPIClient::V2::KeyManagementAPI.new
    
    # there is a valid "application_key" in the system
    APPLICATION_KEY_DATA_ID = ENV["APPLICATION_KEY_DATA_ID"]
    p api_instance.get_current_user_application_key(APPLICATION_KEY_DATA_ID)
    

    Instructions

    First install the library and its dependencies and then save the example to example.rb and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
    // Get one application key owned by current user 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() {
    	// there is a valid "application_key" in the system
    	ApplicationKeyDataID := os.Getenv("APPLICATION_KEY_DATA_ID")
    
    	ctx := datadog.NewDefaultContext(context.Background())
    	configuration := datadog.NewConfiguration()
    	apiClient := datadog.NewAPIClient(configuration)
    	api := datadogV2.NewKeyManagementApi(apiClient)
    	resp, r, err := api.GetCurrentUserApplicationKey(ctx, ApplicationKeyDataID)
    
    	if err != nil {
    		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.GetCurrentUserApplicationKey`: %v\n", err)
    		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    	}
    
    	responseContent, _ := json.MarshalIndent(resp, "", "  ")
    	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.GetCurrentUserApplicationKey`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
    // Get one application key owned by current user returns "OK" response
    
    import com.datadog.api.client.ApiClient;
    import com.datadog.api.client.ApiException;
    import com.datadog.api.client.v2.api.KeyManagementApi;
    import com.datadog.api.client.v2.model.ApplicationKeyResponse;
    
    public class Example {
      public static void main(String[] args) {
        ApiClient defaultClient = ApiClient.getDefaultApiClient();
        KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);
    
        // there is a valid "application_key" in the system
        String APPLICATION_KEY_DATA_ID = System.getenv("APPLICATION_KEY_DATA_ID");
    
        try {
          ApplicationKeyResponse result =
              apiInstance.getCurrentUserApplicationKey(APPLICATION_KEY_DATA_ID);
          System.out.println(result);
        } catch (ApiException e) {
          System.err.println("Exception when calling KeyManagementApi#getCurrentUserApplicationKey");
          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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
    // Get one application key owned by current user returns "OK" response
    use datadog_api_client::datadog;
    use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;
    
    #[tokio::main]
    async fn main() {
        // there is a valid "application_key" in the system
        let application_key_data_id = std::env::var("APPLICATION_KEY_DATA_ID").unwrap();
        let configuration = datadog::Configuration::new();
        let api = KeyManagementAPI::with_config(configuration);
        let resp = api
            .get_current_user_application_key(application_key_data_id.clone())
            .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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
    /**
     * Get one application key owned by current user returns "OK" response
     */
    
    import { client, v2 } from "@datadog/datadog-api-client";
    
    const configuration = client.createConfiguration();
    const apiInstance = new v2.KeyManagementApi(configuration);
    
    // there is a valid "application_key" in the system
    const APPLICATION_KEY_DATA_ID = process.env.APPLICATION_KEY_DATA_ID as string;
    
    const params: v2.KeyManagementApiGetCurrentUserApplicationKeyRequest = {
      appKeyId: APPLICATION_KEY_DATA_ID,
    };
    
    apiInstance
      .getCurrentUserApplicationKey(params)
      .then((data: v2.ApplicationKeyResponse) => {
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

    POST https://api.ap1.datadoghq.com/api/v2/current_user/application_keyshttps://api.ap2.datadoghq.com/api/v2/current_user/application_keyshttps://api.datadoghq.eu/api/v2/current_user/application_keyshttps://api.ddog-gov.com/api/v2/current_user/application_keyshttps://api.us2.ddog-gov.com/api/v2/current_user/application_keyshttps://api.datadoghq.com/api/v2/current_user/application_keyshttps://api.us3.datadoghq.com/api/v2/current_user/application_keyshttps://api.us5.datadoghq.com/api/v2/current_user/application_keys

    개요

    Create an application key for current user This endpoint requires the user_app_keys permission.

    요청

    Body Data (required)

    Expand All

    항목

    유형

    설명

    data [required]

    object

    Object used to create an application key.

    attributes [required]

    object

    Attributes used to create an application Key.

    name [required]

    string

    Name of the application key.

    scopes

    [string]

    Array of scopes to grant the application key.

    type [required]

    enum

    Application Keys resource type. Allowed enum values: application_keys

    default: application_keys

    {
      "data": {
        "type": "application_keys",
        "attributes": {
          "name": "Example-Key-Management",
          "scopes": [
            "dashboards_read",
            "dashboards_write",
            "dashboards_public_share"
          ]
        }
      }
    }
    {
      "data": {
        "type": "application_keys",
        "attributes": {
          "name": "Example-Key-Management"
        }
      }
    }

    응답

    Created

    Response for retrieving an application key.

    Expand All

    항목

    유형

    설명

    data

    object

    Datadog application key.

    attributes

    object

    Attributes of a full application key.

    created_at

    date-time

    Creation date of the application key.

    key

    string

    The application key.

    last4

    string

    The last four characters of the application key.

    last_used_at

    date-time

    Last usage timestamp of the application key.

    name

    string

    Name of the application key.

    scopes

    [string]

    Array of scopes to grant the application key.

    id

    string

    ID of the application key.

    relationships

    object

    Resources related to the application key.

    owned_by

    object

    Relationship to user.

    data [required]

    object

    Relationship to user object.

    id [required]

    string

    A unique identifier that represents the user.

    type [required]

    enum

    Users resource type. Allowed enum values: users

    default: users

    type

    enum

    Application Keys resource type. Allowed enum values: application_keys

    default: application_keys

    included

    [ <oneOf>]

    Array of objects related to the application key.

    Option 1

    object

    User object returned by the API.

    attributes

    object

    Attributes of user object returned by the API.

    created_at

    date-time

    The ISO 8601 timestamp of when the user account was created.

    disabled

    boolean

    Whether the user account is deactivated. Disabled users cannot log in.

    email

    string

    The email address of the user, used for login and notifications.

    handle

    string

    The unique handle (username) of the user, typically matching their email prefix.

    icon

    string

    URL of the user's profile icon, typically a Gravatar URL derived from the email address.

    last_login_time

    date-time

    The ISO 8601 timestamp of the user's most recent login, or null if the user has never logged in.

    mfa_enabled

    boolean

    Whether multi-factor authentication (MFA) is enabled for the user's account.

    modified_at

    date-time

    The ISO 8601 timestamp of when the user account was last modified.

    name

    string

    The full display name of the user as shown in the Datadog UI.

    service_account

    boolean

    Whether this is a service account rather than a human user. Service accounts are used for programmatic API access.

    status

    string

    The current status of the user account (for example, Active, Pending, or Disabled).

    title

    string

    The job title of the user (for example, "Senior Engineer" or "Product Manager").

    uuid

    string

    The globally unique identifier (UUID) of the user.

    verified

    boolean

    Whether the user's email address has been verified.

    id

    string

    ID of the user.

    relationships

    object

    Relationships of the user object returned by the API.

    org

    object

    Relationship to an organization.

    data [required]

    object

    Relationship to organization object.

    id [required]

    string

    ID of the organization.

    type [required]

    enum

    Organizations resource type. Allowed enum values: orgs

    default: orgs

    other_orgs

    object

    Relationship to organizations.

    data [required]

    [object]

    Relationships to organization objects.

    id [required]

    string

    ID of the organization.

    type [required]

    enum

    Organizations resource type. Allowed enum values: orgs

    default: orgs

    other_users

    object

    Relationship to users.

    data [required]

    [object]

    Relationships to user objects.

    id [required]

    string

    A unique identifier that represents the user.

    type [required]

    enum

    Users resource type. Allowed enum values: users

    default: users

    roles

    object

    Relationship to roles.

    data

    [object]

    An array containing type and the unique identifier of a role.

    id

    string

    The unique identifier of the role.

    type

    enum

    Roles type. Allowed enum values: roles

    default: roles

    type

    enum

    Users resource type. Allowed enum values: users

    default: users

    Option 2

    object

    Role object returned by the API.

    attributes

    object

    Attributes of the role.

    created_at

    date-time

    Creation time of the role.

    modified_at

    date-time

    Time of last role modification.

    name

    string

    The name of the role. The name is neither unique nor a stable identifier of the role.

    receives_permissions_from

    [string]

    The managed role from which this role automatically inherits new permissions. Specify one of the following: "Datadog Admin Role", "Datadog Standard Role", or "Datadog Read Only Role". If empty or not specified, the role does not automatically inherit permissions from any managed role.

    user_count

    int64

    Number of users with that role.

    id

    string

    The unique identifier of the role.

    relationships

    object

    Relationships of the role object returned by the API.

    permissions

    object

    Relationship to multiple permissions objects.

    data

    [object]

    Relationships to permission objects.

    id

    string

    ID of the permission.

    type

    enum

    Permissions resource type. Allowed enum values: permissions

    default: permissions

    type [required]

    enum

    Roles type. Allowed enum values: roles

    default: roles

    Option 3

    object

    The definition of LeakedKey object.

    attributes [required]

    object

    The definition of LeakedKeyAttributes object.

    date [required]

    date-time

    The LeakedKeyAttributes date.

    leak_source

    string

    The LeakedKeyAttributes leak_source.

    id [required]

    string

    The LeakedKey id.

    type [required]

    enum

    The definition of LeakedKeyType object. Allowed enum values: leaked_keys

    default: leaked_keys

    {
      "data": {
        "attributes": {
          "created_at": "2020-11-23T10:00:00.000Z",
          "key": "string",
          "last4": "abcd",
          "last_used_at": "2020-12-20T10:00:00.000Z",
          "name": "Application Key for managing dashboards",
          "scopes": [
            "dashboards_read",
            "dashboards_write",
            "dashboards_public_share"
          ]
        },
        "id": "string",
        "relationships": {
          "owned_by": {
            "data": {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          }
        },
        "type": "application_keys"
      },
      "included": [
        {
          "attributes": {
            "created_at": "2019-09-19T10:00:00.000Z",
            "disabled": false,
            "email": "string",
            "handle": "string",
            "icon": "string",
            "last_login_time": "2019-09-19T10:00:00.000Z",
            "mfa_enabled": false,
            "modified_at": "2019-09-19T10:00:00.000Z",
            "name": "string",
            "service_account": false,
            "status": "string",
            "title": "string",
            "uuid": "string",
            "verified": false
          },
          "id": "string",
          "relationships": {
            "org": {
              "data": {
                "id": "00000000-0000-beef-0000-000000000000",
                "type": "orgs"
              }
            },
            "other_orgs": {
              "data": [
                {
                  "id": "00000000-0000-beef-0000-000000000000",
                  "type": "orgs"
                }
              ]
            },
            "other_users": {
              "data": [
                {
                  "id": "00000000-0000-0000-2345-000000000000",
                  "type": "users"
                }
              ]
            },
            "roles": {
              "data": [
                {
                  "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
                  "type": "roles"
                }
              ]
            }
          },
          "type": "users"
        }
      ]
    }

    Bad Request

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Forbidden

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Too many requests

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    코드 사례

                              ## default
    # 
    
    # Curl command
    curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/current_user/application_keys" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "name": "Application Key for managing dashboards", "scopes": [ "dashboards_read", "dashboards_write", "dashboards_public_share" ] }, "type": "application_keys" } } EOF
                              ## default
    # 
    
    # Curl command
    curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/current_user/application_keys" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "name": "Application Key for managing dashboards", "scopes": [ "dashboards_read", "dashboards_write", "dashboards_public_share" ] }, "type": "application_keys" } } EOF
    // Create an Application key with scopes for current user returns "Created" 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.ApplicationKeyCreateRequest{
    		Data: datadogV2.ApplicationKeyCreateData{
    			Type: datadogV2.APPLICATIONKEYSTYPE_APPLICATION_KEYS,
    			Attributes: datadogV2.ApplicationKeyCreateAttributes{
    				Name: "Example-Key-Management",
    				Scopes: *datadog.NewNullableList(&[]string{
    					"dashboards_read",
    					"dashboards_write",
    					"dashboards_public_share",
    				}),
    			},
    		},
    	}
    	ctx := datadog.NewDefaultContext(context.Background())
    	configuration := datadog.NewConfiguration()
    	apiClient := datadog.NewAPIClient(configuration)
    	api := datadogV2.NewKeyManagementApi(apiClient)
    	resp, r, err := api.CreateCurrentUserApplicationKey(ctx, body)
    
    	if err != nil {
    		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.CreateCurrentUserApplicationKey`: %v\n", err)
    		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    	}
    
    	responseContent, _ := json.MarshalIndent(resp, "", "  ")
    	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.CreateCurrentUserApplicationKey`:\n%s\n", responseContent)
    }
    
    // Create an application key for current user returns "Created" 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.ApplicationKeyCreateRequest{
    		Data: datadogV2.ApplicationKeyCreateData{
    			Type: datadogV2.APPLICATIONKEYSTYPE_APPLICATION_KEYS,
    			Attributes: datadogV2.ApplicationKeyCreateAttributes{
    				Name: "Example-Key-Management",
    			},
    		},
    	}
    	ctx := datadog.NewDefaultContext(context.Background())
    	configuration := datadog.NewConfiguration()
    	apiClient := datadog.NewAPIClient(configuration)
    	api := datadogV2.NewKeyManagementApi(apiClient)
    	resp, r, err := api.CreateCurrentUserApplicationKey(ctx, body)
    
    	if err != nil {
    		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.CreateCurrentUserApplicationKey`: %v\n", err)
    		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    	}
    
    	responseContent, _ := json.MarshalIndent(resp, "", "  ")
    	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.CreateCurrentUserApplicationKey`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
    // Create an Application key with scopes for current user returns "Created" response
    
    import com.datadog.api.client.ApiClient;
    import com.datadog.api.client.ApiException;
    import com.datadog.api.client.v2.api.KeyManagementApi;
    import com.datadog.api.client.v2.model.ApplicationKeyCreateAttributes;
    import com.datadog.api.client.v2.model.ApplicationKeyCreateData;
    import com.datadog.api.client.v2.model.ApplicationKeyCreateRequest;
    import com.datadog.api.client.v2.model.ApplicationKeyResponse;
    import com.datadog.api.client.v2.model.ApplicationKeysType;
    import java.util.Arrays;
    
    public class Example {
      public static void main(String[] args) {
        ApiClient defaultClient = ApiClient.getDefaultApiClient();
        KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);
    
        ApplicationKeyCreateRequest body =
            new ApplicationKeyCreateRequest()
                .data(
                    new ApplicationKeyCreateData()
                        .type(ApplicationKeysType.APPLICATION_KEYS)
                        .attributes(
                            new ApplicationKeyCreateAttributes()
                                .name("Example-Key-Management")
                                .scopes(
                                    Arrays.asList(
                                        "dashboards_read",
                                        "dashboards_write",
                                        "dashboards_public_share"))));
    
        try {
          ApplicationKeyResponse result = apiInstance.createCurrentUserApplicationKey(body);
          System.out.println(result);
        } catch (ApiException e) {
          System.err.println("Exception when calling KeyManagementApi#createCurrentUserApplicationKey");
          System.err.println("Status code: " + e.getCode());
          System.err.println("Reason: " + e.getResponseBody());
          System.err.println("Response headers: " + e.getResponseHeaders());
          e.printStackTrace();
        }
      }
    }
    
    // Create an application key for current user returns "Created" response
    
    import com.datadog.api.client.ApiClient;
    import com.datadog.api.client.ApiException;
    import com.datadog.api.client.v2.api.KeyManagementApi;
    import com.datadog.api.client.v2.model.ApplicationKeyCreateAttributes;
    import com.datadog.api.client.v2.model.ApplicationKeyCreateData;
    import com.datadog.api.client.v2.model.ApplicationKeyCreateRequest;
    import com.datadog.api.client.v2.model.ApplicationKeyResponse;
    import com.datadog.api.client.v2.model.ApplicationKeysType;
    
    public class Example {
      public static void main(String[] args) {
        ApiClient defaultClient = ApiClient.getDefaultApiClient();
        KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);
    
        ApplicationKeyCreateRequest body =
            new ApplicationKeyCreateRequest()
                .data(
                    new ApplicationKeyCreateData()
                        .type(ApplicationKeysType.APPLICATION_KEYS)
                        .attributes(
                            new ApplicationKeyCreateAttributes().name("Example-Key-Management")));
    
        try {
          ApplicationKeyResponse result = apiInstance.createCurrentUserApplicationKey(body);
          System.out.println(result);
        } catch (ApiException e) {
          System.err.println("Exception when calling KeyManagementApi#createCurrentUserApplicationKey");
          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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
    """
    Create an Application key with scopes for current user returns "Created" response
    """
    
    from datadog_api_client import ApiClient, Configuration
    from datadog_api_client.v2.api.key_management_api import KeyManagementApi
    from datadog_api_client.v2.model.application_key_create_attributes import ApplicationKeyCreateAttributes
    from datadog_api_client.v2.model.application_key_create_data import ApplicationKeyCreateData
    from datadog_api_client.v2.model.application_key_create_request import ApplicationKeyCreateRequest
    from datadog_api_client.v2.model.application_keys_type import ApplicationKeysType
    
    body = ApplicationKeyCreateRequest(
        data=ApplicationKeyCreateData(
            type=ApplicationKeysType.APPLICATION_KEYS,
            attributes=ApplicationKeyCreateAttributes(
                name="Example-Key-Management",
                scopes=[
                    "dashboards_read",
                    "dashboards_write",
                    "dashboards_public_share",
                ],
            ),
        ),
    )
    
    configuration = Configuration()
    with ApiClient(configuration) as api_client:
        api_instance = KeyManagementApi(api_client)
        response = api_instance.create_current_user_application_key(body=body)
    
        print(response)
    
    """
    Create an application key for current user returns "Created" response
    """
    
    from datadog_api_client import ApiClient, Configuration
    from datadog_api_client.v2.api.key_management_api import KeyManagementApi
    from datadog_api_client.v2.model.application_key_create_attributes import ApplicationKeyCreateAttributes
    from datadog_api_client.v2.model.application_key_create_data import ApplicationKeyCreateData
    from datadog_api_client.v2.model.application_key_create_request import ApplicationKeyCreateRequest
    from datadog_api_client.v2.model.application_keys_type import ApplicationKeysType
    
    body = ApplicationKeyCreateRequest(
        data=ApplicationKeyCreateData(
            type=ApplicationKeysType.APPLICATION_KEYS,
            attributes=ApplicationKeyCreateAttributes(
                name="Example-Key-Management",
            ),
        ),
    )
    
    configuration = Configuration()
    with ApiClient(configuration) as api_client:
        api_instance = KeyManagementApi(api_client)
        response = api_instance.create_current_user_application_key(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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
    # Create an Application key with scopes for current user returns "Created" response
    
    require "datadog_api_client"
    api_instance = DatadogAPIClient::V2::KeyManagementAPI.new
    
    body = DatadogAPIClient::V2::ApplicationKeyCreateRequest.new({
      data: DatadogAPIClient::V2::ApplicationKeyCreateData.new({
        type: DatadogAPIClient::V2::ApplicationKeysType::APPLICATION_KEYS,
        attributes: DatadogAPIClient::V2::ApplicationKeyCreateAttributes.new({
          name: "Example-Key-Management",
          scopes: [
            "dashboards_read",
            "dashboards_write",
            "dashboards_public_share",
          ],
        }),
      }),
    })
    p api_instance.create_current_user_application_key(body)
    
    # Create an application key for current user returns "Created" response
    
    require "datadog_api_client"
    api_instance = DatadogAPIClient::V2::KeyManagementAPI.new
    
    body = DatadogAPIClient::V2::ApplicationKeyCreateRequest.new({
      data: DatadogAPIClient::V2::ApplicationKeyCreateData.new({
        type: DatadogAPIClient::V2::ApplicationKeysType::APPLICATION_KEYS,
        attributes: DatadogAPIClient::V2::ApplicationKeyCreateAttributes.new({
          name: "Example-Key-Management",
        }),
      }),
    })
    p api_instance.create_current_user_application_key(body)
    

    Instructions

    First install the library and its dependencies and then save the example to example.rb and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
    // Create an Application key with scopes for current user returns "Created"
    // response
    use datadog_api_client::datadog;
    use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;
    use datadog_api_client::datadogV2::model::ApplicationKeyCreateAttributes;
    use datadog_api_client::datadogV2::model::ApplicationKeyCreateData;
    use datadog_api_client::datadogV2::model::ApplicationKeyCreateRequest;
    use datadog_api_client::datadogV2::model::ApplicationKeysType;
    
    #[tokio::main]
    async fn main() {
        let body = ApplicationKeyCreateRequest::new(ApplicationKeyCreateData::new(
            ApplicationKeyCreateAttributes::new("Example-Key-Management".to_string()).scopes(Some(
                vec![
                    "dashboards_read".to_string(),
                    "dashboards_write".to_string(),
                    "dashboards_public_share".to_string(),
                ],
            )),
            ApplicationKeysType::APPLICATION_KEYS,
        ));
        let configuration = datadog::Configuration::new();
        let api = KeyManagementAPI::with_config(configuration);
        let resp = api.create_current_user_application_key(body).await;
        if let Ok(value) = resp {
            println!("{:#?}", value);
        } else {
            println!("{:#?}", resp.unwrap_err());
        }
    }
    
    // Create an application key for current user returns "Created" response
    use datadog_api_client::datadog;
    use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;
    use datadog_api_client::datadogV2::model::ApplicationKeyCreateAttributes;
    use datadog_api_client::datadogV2::model::ApplicationKeyCreateData;
    use datadog_api_client::datadogV2::model::ApplicationKeyCreateRequest;
    use datadog_api_client::datadogV2::model::ApplicationKeysType;
    
    #[tokio::main]
    async fn main() {
        let body = ApplicationKeyCreateRequest::new(ApplicationKeyCreateData::new(
            ApplicationKeyCreateAttributes::new("Example-Key-Management".to_string()),
            ApplicationKeysType::APPLICATION_KEYS,
        ));
        let configuration = datadog::Configuration::new();
        let api = KeyManagementAPI::with_config(configuration);
        let resp = api.create_current_user_application_key(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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
    /**
     * Create an Application key with scopes for current user returns "Created" response
     */
    
    import { client, v2 } from "@datadog/datadog-api-client";
    
    const configuration = client.createConfiguration();
    const apiInstance = new v2.KeyManagementApi(configuration);
    
    const params: v2.KeyManagementApiCreateCurrentUserApplicationKeyRequest = {
      body: {
        data: {
          type: "application_keys",
          attributes: {
            name: "Example-Key-Management",
            scopes: [
              "dashboards_read",
              "dashboards_write",
              "dashboards_public_share",
            ],
          },
        },
      },
    };
    
    apiInstance
      .createCurrentUserApplicationKey(params)
      .then((data: v2.ApplicationKeyResponse) => {
        console.log(
          "API called successfully. Returned data: " + JSON.stringify(data)
        );
      })
      .catch((error: any) => console.error(error));
    
    /**
     * Create an application key for current user returns "Created" response
     */
    
    import { client, v2 } from "@datadog/datadog-api-client";
    
    const configuration = client.createConfiguration();
    const apiInstance = new v2.KeyManagementApi(configuration);
    
    const params: v2.KeyManagementApiCreateCurrentUserApplicationKeyRequest = {
      body: {
        data: {
          type: "application_keys",
          attributes: {
            name: "Example-Key-Management",
          },
        },
      },
    };
    
    apiInstance
      .createCurrentUserApplicationKey(params)
      .then((data: v2.ApplicationKeyResponse) => {
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

    GET https://api.ap1.datadoghq.com/api/v2/current_user/application_keyshttps://api.ap2.datadoghq.com/api/v2/current_user/application_keyshttps://api.datadoghq.eu/api/v2/current_user/application_keyshttps://api.ddog-gov.com/api/v2/current_user/application_keyshttps://api.us2.ddog-gov.com/api/v2/current_user/application_keyshttps://api.datadoghq.com/api/v2/current_user/application_keyshttps://api.us3.datadoghq.com/api/v2/current_user/application_keyshttps://api.us5.datadoghq.com/api/v2/current_user/application_keys

    개요

    List all application keys available for current user This endpoint requires the user_app_keys permission.

    인수

    쿼리 문자열

    이름

    유형

    설명

    page[size]

    integer

    Size for a given page. The maximum allowed value is 100.

    page[number]

    integer

    Specific page number to return.

    sort

    enum

    Application key attribute used to sort results. Sort order is ascending by default. In order to specify a descending sort, prefix the attribute with a minus sign.
    Allowed enum values: created_at, -created_at, last4, -last4, name, -name

    filter

    string

    Filter application keys by the specified string.

    filter[created_at][start]

    string

    Only include application keys created on or after the specified date.

    filter[created_at][end]

    string

    Only include application keys created on or before the specified date.

    include

    string

    Resource path for related resources to include in the response. Only owned_by is supported.

    응답

    OK

    Response for a list of application keys.

    Expand All

    항목

    유형

    설명

    data

    [object]

    Array of application keys.

    attributes

    object

    Attributes of a partial application key.

    created_at

    string

    Creation date of the application key.

    last4

    string

    The last four characters of the application key.

    last_used_at

    string

    Last usage timestamp of the application key.

    name

    string

    Name of the application key.

    scopes

    [string]

    Array of scopes to grant the application key.

    id

    string

    ID of the application key.

    relationships

    object

    Resources related to the application key.

    owned_by

    object

    Relationship to user.

    data [required]

    object

    Relationship to user object.

    id [required]

    string

    A unique identifier that represents the user.

    type [required]

    enum

    Users resource type. Allowed enum values: users

    default: users

    type

    enum

    Application Keys resource type. Allowed enum values: application_keys

    default: application_keys

    included

    [ <oneOf>]

    Array of objects related to the application key.

    Option 1

    object

    User object returned by the API.

    attributes

    object

    Attributes of user object returned by the API.

    created_at

    date-time

    The ISO 8601 timestamp of when the user account was created.

    disabled

    boolean

    Whether the user account is deactivated. Disabled users cannot log in.

    email

    string

    The email address of the user, used for login and notifications.

    handle

    string

    The unique handle (username) of the user, typically matching their email prefix.

    icon

    string

    URL of the user's profile icon, typically a Gravatar URL derived from the email address.

    last_login_time

    date-time

    The ISO 8601 timestamp of the user's most recent login, or null if the user has never logged in.

    mfa_enabled

    boolean

    Whether multi-factor authentication (MFA) is enabled for the user's account.

    modified_at

    date-time

    The ISO 8601 timestamp of when the user account was last modified.

    name

    string

    The full display name of the user as shown in the Datadog UI.

    service_account

    boolean

    Whether this is a service account rather than a human user. Service accounts are used for programmatic API access.

    status

    string

    The current status of the user account (for example, Active, Pending, or Disabled).

    title

    string

    The job title of the user (for example, "Senior Engineer" or "Product Manager").

    uuid

    string

    The globally unique identifier (UUID) of the user.

    verified

    boolean

    Whether the user's email address has been verified.

    id

    string

    ID of the user.

    relationships

    object

    Relationships of the user object returned by the API.

    org

    object

    Relationship to an organization.

    data [required]

    object

    Relationship to organization object.

    id [required]

    string

    ID of the organization.

    type [required]

    enum

    Organizations resource type. Allowed enum values: orgs

    default: orgs

    other_orgs

    object

    Relationship to organizations.

    data [required]

    [object]

    Relationships to organization objects.

    id [required]

    string

    ID of the organization.

    type [required]

    enum

    Organizations resource type. Allowed enum values: orgs

    default: orgs

    other_users

    object

    Relationship to users.

    data [required]

    [object]

    Relationships to user objects.

    id [required]

    string

    A unique identifier that represents the user.

    type [required]

    enum

    Users resource type. Allowed enum values: users

    default: users

    roles

    object

    Relationship to roles.

    data

    [object]

    An array containing type and the unique identifier of a role.

    id

    string

    The unique identifier of the role.

    type

    enum

    Roles type. Allowed enum values: roles

    default: roles

    type

    enum

    Users resource type. Allowed enum values: users

    default: users

    Option 2

    object

    Role object returned by the API.

    attributes

    object

    Attributes of the role.

    created_at

    date-time

    Creation time of the role.

    modified_at

    date-time

    Time of last role modification.

    name

    string

    The name of the role. The name is neither unique nor a stable identifier of the role.

    receives_permissions_from

    [string]

    The managed role from which this role automatically inherits new permissions. Specify one of the following: "Datadog Admin Role", "Datadog Standard Role", or "Datadog Read Only Role". If empty or not specified, the role does not automatically inherit permissions from any managed role.

    user_count

    int64

    Number of users with that role.

    id

    string

    The unique identifier of the role.

    relationships

    object

    Relationships of the role object returned by the API.

    permissions

    object

    Relationship to multiple permissions objects.

    data

    [object]

    Relationships to permission objects.

    id

    string

    ID of the permission.

    type

    enum

    Permissions resource type. Allowed enum values: permissions

    default: permissions

    type [required]

    enum

    Roles type. Allowed enum values: roles

    default: roles

    Option 3

    object

    The definition of LeakedKey object.

    attributes [required]

    object

    The definition of LeakedKeyAttributes object.

    date [required]

    date-time

    The LeakedKeyAttributes date.

    leak_source

    string

    The LeakedKeyAttributes leak_source.

    id [required]

    string

    The LeakedKey id.

    type [required]

    enum

    The definition of LeakedKeyType object. Allowed enum values: leaked_keys

    default: leaked_keys

    meta

    object

    Additional information related to the application key response.

    max_allowed_per_user

    int64

    Max allowed number of application keys per user.

    page

    object

    Additional information related to the application key response.

    total_filtered_count

    int64

    Total filtered application key count.

    {
      "data": [
        {
          "attributes": {
            "created_at": "2020-11-23T10:00:00.000Z",
            "last4": "abcd",
            "last_used_at": "2020-12-20T10:00:00.000Z",
            "name": "Application Key for managing dashboards",
            "scopes": [
              "dashboards_read",
              "dashboards_write",
              "dashboards_public_share"
            ]
          },
          "id": "string",
          "relationships": {
            "owned_by": {
              "data": {
                "id": "00000000-0000-0000-2345-000000000000",
                "type": "users"
              }
            }
          },
          "type": "application_keys"
        }
      ],
      "included": [
        {
          "attributes": {
            "created_at": "2019-09-19T10:00:00.000Z",
            "disabled": false,
            "email": "string",
            "handle": "string",
            "icon": "string",
            "last_login_time": "2019-09-19T10:00:00.000Z",
            "mfa_enabled": false,
            "modified_at": "2019-09-19T10:00:00.000Z",
            "name": "string",
            "service_account": false,
            "status": "string",
            "title": "string",
            "uuid": "string",
            "verified": false
          },
          "id": "string",
          "relationships": {
            "org": {
              "data": {
                "id": "00000000-0000-beef-0000-000000000000",
                "type": "orgs"
              }
            },
            "other_orgs": {
              "data": [
                {
                  "id": "00000000-0000-beef-0000-000000000000",
                  "type": "orgs"
                }
              ]
            },
            "other_users": {
              "data": [
                {
                  "id": "00000000-0000-0000-2345-000000000000",
                  "type": "users"
                }
              ]
            },
            "roles": {
              "data": [
                {
                  "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
                  "type": "roles"
                }
              ]
            }
          },
          "type": "users"
        }
      ],
      "meta": {
        "max_allowed_per_user": "integer",
        "page": {
          "total_filtered_count": "integer"
        }
      }
    }

    Bad Request

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Forbidden

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Not Found

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Too many requests

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    코드 사례

                      # Curl command
    curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/current_user/application_keys" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
    """
    Get all application keys owned by current user returns "OK" response
    """
    
    from datadog_api_client import ApiClient, Configuration
    from datadog_api_client.v2.api.key_management_api import KeyManagementApi
    
    configuration = Configuration()
    with ApiClient(configuration) as api_client:
        api_instance = KeyManagementApi(api_client)
        response = api_instance.list_current_user_application_keys()
    
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
    # Get all application keys owned by current user returns "OK" response
    
    require "datadog_api_client"
    api_instance = DatadogAPIClient::V2::KeyManagementAPI.new
    p api_instance.list_current_user_application_keys()
    

    Instructions

    First install the library and its dependencies and then save the example to example.rb and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
    // Get all application keys owned by current user 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() {
    	ctx := datadog.NewDefaultContext(context.Background())
    	configuration := datadog.NewConfiguration()
    	apiClient := datadog.NewAPIClient(configuration)
    	api := datadogV2.NewKeyManagementApi(apiClient)
    	resp, r, err := api.ListCurrentUserApplicationKeys(ctx, *datadogV2.NewListCurrentUserApplicationKeysOptionalParameters())
    
    	if err != nil {
    		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.ListCurrentUserApplicationKeys`: %v\n", err)
    		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    	}
    
    	responseContent, _ := json.MarshalIndent(resp, "", "  ")
    	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.ListCurrentUserApplicationKeys`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
    // Get all application keys owned by current user returns "OK" response
    
    import com.datadog.api.client.ApiClient;
    import com.datadog.api.client.ApiException;
    import com.datadog.api.client.v2.api.KeyManagementApi;
    import com.datadog.api.client.v2.model.ListApplicationKeysResponse;
    
    public class Example {
      public static void main(String[] args) {
        ApiClient defaultClient = ApiClient.getDefaultApiClient();
        KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);
    
        try {
          ListApplicationKeysResponse result = apiInstance.listCurrentUserApplicationKeys();
          System.out.println(result);
        } catch (ApiException e) {
          System.err.println("Exception when calling KeyManagementApi#listCurrentUserApplicationKeys");
          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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
    // Get all application keys owned by current user returns "OK" response
    use datadog_api_client::datadog;
    use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;
    use datadog_api_client::datadogV2::api_key_management::ListCurrentUserApplicationKeysOptionalParams;
    
    #[tokio::main]
    async fn main() {
        let configuration = datadog::Configuration::new();
        let api = KeyManagementAPI::with_config(configuration);
        let resp = api
            .list_current_user_application_keys(ListCurrentUserApplicationKeysOptionalParams::default())
            .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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
    /**
     * Get all application keys owned by current user returns "OK" response
     */
    
    import { client, v2 } from "@datadog/datadog-api-client";
    
    const configuration = client.createConfiguration();
    const apiInstance = new v2.KeyManagementApi(configuration);
    
    apiInstance
      .listCurrentUserApplicationKeys()
      .then((data: v2.ListApplicationKeysResponse) => {
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

    POST https://api.ap1.datadoghq.com/api/v2/personal_access_tokenshttps://api.ap2.datadoghq.com/api/v2/personal_access_tokenshttps://api.datadoghq.eu/api/v2/personal_access_tokenshttps://api.ddog-gov.com/api/v2/personal_access_tokenshttps://api.us2.ddog-gov.com/api/v2/personal_access_tokenshttps://api.datadoghq.com/api/v2/personal_access_tokenshttps://api.us3.datadoghq.com/api/v2/personal_access_tokenshttps://api.us5.datadoghq.com/api/v2/personal_access_tokens

    개요

    Create a personal access token for the current user. This endpoint requires the user_app_keys permission.

    요청

    Body Data (required)

    Expand All

    항목

    유형

    설명

    data [required]

    object

    Object used to create a personal access token.

    attributes [required]

    object

    Attributes used to create a personal access token.

    expires_at [required]

    date-time

    Expiration date of the personal access token. Must be at least 24 hours in the future.

    name [required]

    string

    Name of the personal access token.

    scopes [required]

    [string]

    Array of scopes to grant the personal access token.

    type [required]

    enum

    Personal access tokens resource type. Allowed enum values: personal_access_tokens

    default: personal_access_tokens

    {
      "data": {
        "type": "personal_access_tokens",
        "attributes": {
          "name": "Example-Key-Management",
          "scopes": [
            "dashboards_read"
          ],
          "expires_at": "2022-11-11T11:11:11+00:00"
        }
      }
    }

    응답

    Created

    Response for creating a personal access token. Includes the token key.

    Expand All

    항목

    유형

    설명

    data

    object

    Datadog personal access token, including the token key.

    attributes

    object

    Attributes of a full personal access token, including the token key.

    created_at

    date-time

    Creation date of the personal access token.

    expires_at

    date-time

    Expiration date of the personal access token.

    key

    string

    The personal access token key. Only returned upon creation.

    name

    string

    Name of the personal access token.

    public_portion

    string

    The public portion of the personal access token.

    scopes

    [string]

    Array of scopes granted to the personal access token.

    id

    string

    ID of the personal access token.

    relationships

    object

    Resources related to the personal access token.

    owned_by

    object

    Relationship to user.

    data [required]

    object

    Relationship to user object.

    id [required]

    string

    A unique identifier that represents the user.

    type [required]

    enum

    Users resource type. Allowed enum values: users

    default: users

    type

    enum

    Personal access tokens resource type. Allowed enum values: personal_access_tokens

    default: personal_access_tokens

    {
      "data": {
        "attributes": {
          "created_at": "2024-01-01T00:00:00+00:00",
          "expires_at": "2025-12-31T23:59:59+00:00",
          "key": "string",
          "name": "My Personal Access Token",
          "public_portion": "ddpat_abc123",
          "scopes": [
            "dashboards_read",
            "dashboards_write"
          ]
        },
        "id": "string",
        "relationships": {
          "owned_by": {
            "data": {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          }
        },
        "type": "personal_access_tokens"
      }
    }

    Bad Request

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Forbidden

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Too many requests

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    코드 사례

                              ## default
    # 
    
    # Curl command
    curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/personal_access_tokens" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "expires_at": "2025-12-31T23:59:59+00:00", "name": "My Personal Access Token", "scopes": [ "dashboards_read", "dashboards_write" ] }, "type": "personal_access_tokens" } } EOF

    GET https://api.ap1.datadoghq.com/api/v2/personal_access_tokenshttps://api.ap2.datadoghq.com/api/v2/personal_access_tokenshttps://api.datadoghq.eu/api/v2/personal_access_tokenshttps://api.ddog-gov.com/api/v2/personal_access_tokenshttps://api.us2.ddog-gov.com/api/v2/personal_access_tokenshttps://api.datadoghq.com/api/v2/personal_access_tokenshttps://api.us3.datadoghq.com/api/v2/personal_access_tokenshttps://api.us5.datadoghq.com/api/v2/personal_access_tokens

    개요

    List all personal access tokens for the organization. This endpoint requires any of the following permissions:

  • user_app_keys
  • org_app_keys_read

  • 인수

    쿼리 문자열

    이름

    유형

    설명

    page[size]

    integer

    Size for a given page. The maximum allowed value is 100.

    page[number]

    integer

    Specific page number to return.

    sort

    enum

    Personal access token attribute used to sort results. Sort order is ascending by default. In order to specify a descending sort, prefix the attribute with a minus sign.
    Allowed enum values: name, -name, created_at, -created_at, expires_at, -expires_at

    filter

    string

    Filter personal access tokens by the specified string.

    filter[owner_uuid]

    array

    Filter personal access tokens by the owner’s UUID. Supports multiple values.

    응답

    OK

    Response for a list of personal access tokens.

    Expand All

    항목

    유형

    설명

    data

    [object]

    Array of personal access tokens.

    attributes

    object

    Attributes of a personal access token.

    created_at

    date-time

    Creation date of the personal access token.

    expires_at

    date-time

    Expiration date of the personal access token.

    last_used_at

    date-time

    Date the personal access token was last used.

    modified_at

    date-time

    Date of last modification of the personal access token.

    name

    string

    Name of the personal access token.

    public_portion

    string

    The public portion of the personal access token.

    scopes

    [string]

    Array of scopes granted to the personal access token.

    id

    string

    ID of the personal access token.

    relationships

    object

    Resources related to the personal access token.

    owned_by

    object

    Relationship to user.

    data [required]

    object

    Relationship to user object.

    id [required]

    string

    A unique identifier that represents the user.

    type [required]

    enum

    Users resource type. Allowed enum values: users

    default: users

    type

    enum

    Personal access tokens resource type. Allowed enum values: personal_access_tokens

    default: personal_access_tokens

    meta

    object

    Additional information related to the personal access token response.

    page

    object

    Pagination information.

    total_filtered_count

    int64

    Total filtered personal access token count.

    {
      "data": [
        {
          "attributes": {
            "created_at": "2024-01-01T00:00:00+00:00",
            "expires_at": "2025-12-31T23:59:59+00:00",
            "last_used_at": "2025-06-15T12:30:00+00:00",
            "modified_at": "2024-06-01T00:00:00+00:00",
            "name": "My Personal Access Token",
            "public_portion": "ddpat_abc123",
            "scopes": [
              "dashboards_read",
              "dashboards_write"
            ]
          },
          "id": "string",
          "relationships": {
            "owned_by": {
              "data": {
                "id": "00000000-0000-0000-2345-000000000000",
                "type": "users"
              }
            }
          },
          "type": "personal_access_tokens"
        }
      ],
      "meta": {
        "page": {
          "total_filtered_count": "integer"
        }
      }
    }

    Bad Request

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Forbidden

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Too many requests

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    코드 사례

                      # Curl command
    curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/personal_access_tokens" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

    GET https://api.ap1.datadoghq.com/api/v2/personal_access_tokens/{pat_id}https://api.ap2.datadoghq.com/api/v2/personal_access_tokens/{pat_id}https://api.datadoghq.eu/api/v2/personal_access_tokens/{pat_id}https://api.ddog-gov.com/api/v2/personal_access_tokens/{pat_id}https://api.us2.ddog-gov.com/api/v2/personal_access_tokens/{pat_id}https://api.datadoghq.com/api/v2/personal_access_tokens/{pat_id}https://api.us3.datadoghq.com/api/v2/personal_access_tokens/{pat_id}https://api.us5.datadoghq.com/api/v2/personal_access_tokens/{pat_id}

    개요

    Get a specific personal access token by its UUID. This endpoint requires any of the following permissions:

  • user_app_keys
  • org_app_keys_read

  • 인수

    경로 파라미터

    이름

    유형

    설명

    pat_id [required]

    string

    The ID of the personal access token.

    응답

    OK

    Response for retrieving a personal access token.

    Expand All

    항목

    유형

    설명

    data

    object

    Datadog personal access token.

    attributes

    object

    Attributes of a personal access token.

    created_at

    date-time

    Creation date of the personal access token.

    expires_at

    date-time

    Expiration date of the personal access token.

    last_used_at

    date-time

    Date the personal access token was last used.

    modified_at

    date-time

    Date of last modification of the personal access token.

    name

    string

    Name of the personal access token.

    public_portion

    string

    The public portion of the personal access token.

    scopes

    [string]

    Array of scopes granted to the personal access token.

    id

    string

    ID of the personal access token.

    relationships

    object

    Resources related to the personal access token.

    owned_by

    object

    Relationship to user.

    data [required]

    object

    Relationship to user object.

    id [required]

    string

    A unique identifier that represents the user.

    type [required]

    enum

    Users resource type. Allowed enum values: users

    default: users

    type

    enum

    Personal access tokens resource type. Allowed enum values: personal_access_tokens

    default: personal_access_tokens

    {
      "data": {
        "attributes": {
          "created_at": "2024-01-01T00:00:00+00:00",
          "expires_at": "2025-12-31T23:59:59+00:00",
          "last_used_at": "2025-06-15T12:30:00+00:00",
          "modified_at": "2024-06-01T00:00:00+00:00",
          "name": "My Personal Access Token",
          "public_portion": "ddpat_abc123",
          "scopes": [
            "dashboards_read",
            "dashboards_write"
          ]
        },
        "id": "string",
        "relationships": {
          "owned_by": {
            "data": {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          }
        },
        "type": "personal_access_tokens"
      }
    }

    Forbidden

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Not Found

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Too many requests

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    코드 사례

                      # Path parameters
    export pat_id="00000000-0000-1234-0000-000000000000"
    # Curl command
    curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/personal_access_tokens/${pat_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

    PATCH https://api.ap1.datadoghq.com/api/v2/personal_access_tokens/{pat_id}https://api.ap2.datadoghq.com/api/v2/personal_access_tokens/{pat_id}https://api.datadoghq.eu/api/v2/personal_access_tokens/{pat_id}https://api.ddog-gov.com/api/v2/personal_access_tokens/{pat_id}https://api.us2.ddog-gov.com/api/v2/personal_access_tokens/{pat_id}https://api.datadoghq.com/api/v2/personal_access_tokens/{pat_id}https://api.us3.datadoghq.com/api/v2/personal_access_tokens/{pat_id}https://api.us5.datadoghq.com/api/v2/personal_access_tokens/{pat_id}

    개요

    Update a specific personal access token. This endpoint requires any of the following permissions:

  • user_app_keys
  • org_app_keys_write

  • 인수

    경로 파라미터

    이름

    유형

    설명

    pat_id [required]

    string

    The ID of the personal access token.

    요청

    Body Data (required)

    Expand All

    항목

    유형

    설명

    data [required]

    object

    Object used to update a personal access token.

    attributes [required]

    object

    Attributes used to update a personal access token.

    name

    string

    Name of the personal access token.

    scopes

    [string]

    Array of scopes to grant the personal access token.

    id [required]

    string

    ID of the personal access token.

    type [required]

    enum

    Personal access tokens resource type. Allowed enum values: personal_access_tokens

    default: personal_access_tokens

    {
      "data": {
        "type": "personal_access_tokens",
        "id": "string",
        "attributes": {
          "name": "Example-Key-Management-updated"
        }
      }
    }

    응답

    OK

    Response for retrieving a personal access token.

    Expand All

    항목

    유형

    설명

    data

    object

    Datadog personal access token.

    attributes

    object

    Attributes of a personal access token.

    created_at

    date-time

    Creation date of the personal access token.

    expires_at

    date-time

    Expiration date of the personal access token.

    last_used_at

    date-time

    Date the personal access token was last used.

    modified_at

    date-time

    Date of last modification of the personal access token.

    name

    string

    Name of the personal access token.

    public_portion

    string

    The public portion of the personal access token.

    scopes

    [string]

    Array of scopes granted to the personal access token.

    id

    string

    ID of the personal access token.

    relationships

    object

    Resources related to the personal access token.

    owned_by

    object

    Relationship to user.

    data [required]

    object

    Relationship to user object.

    id [required]

    string

    A unique identifier that represents the user.

    type [required]

    enum

    Users resource type. Allowed enum values: users

    default: users

    type

    enum

    Personal access tokens resource type. Allowed enum values: personal_access_tokens

    default: personal_access_tokens

    {
      "data": {
        "attributes": {
          "created_at": "2024-01-01T00:00:00+00:00",
          "expires_at": "2025-12-31T23:59:59+00:00",
          "last_used_at": "2025-06-15T12:30:00+00:00",
          "modified_at": "2024-06-01T00:00:00+00:00",
          "name": "My Personal Access Token",
          "public_portion": "ddpat_abc123",
          "scopes": [
            "dashboards_read",
            "dashboards_write"
          ]
        },
        "id": "string",
        "relationships": {
          "owned_by": {
            "data": {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          }
        },
        "type": "personal_access_tokens"
      }
    }

    Bad Request

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Forbidden

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Not Found

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Too many requests

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    코드 사례

                              ## default
    # 
    
    # Path parameters
    export pat_id="00000000-0000-1234-0000-000000000000"
    # Curl command
    curl -X PATCH "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/personal_access_tokens/${pat_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "name": "Updated Personal Access Token", "scopes": [ "dashboards_read", "dashboards_write" ] }, "id": "00112233-4455-6677-8899-aabbccddeeff", "type": "personal_access_tokens" } } EOF

    DELETE https://api.ap1.datadoghq.com/api/v2/personal_access_tokens/{pat_id}https://api.ap2.datadoghq.com/api/v2/personal_access_tokens/{pat_id}https://api.datadoghq.eu/api/v2/personal_access_tokens/{pat_id}https://api.ddog-gov.com/api/v2/personal_access_tokens/{pat_id}https://api.us2.ddog-gov.com/api/v2/personal_access_tokens/{pat_id}https://api.datadoghq.com/api/v2/personal_access_tokens/{pat_id}https://api.us3.datadoghq.com/api/v2/personal_access_tokens/{pat_id}https://api.us5.datadoghq.com/api/v2/personal_access_tokens/{pat_id}

    개요

    Revoke a specific personal access token. This endpoint requires any of the following permissions:

  • user_app_keys
  • org_app_keys_write

  • 인수

    경로 파라미터

    이름

    유형

    설명

    pat_id [required]

    string

    The ID of the personal access token.

    응답

    No Content

    Forbidden

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Not Found

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Too many requests

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    코드 사례

                      # Path parameters
    export pat_id="00000000-0000-1234-0000-000000000000"
    # Curl command
    curl -X DELETE "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/personal_access_tokens/${pat_id}" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

    Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.

    GET https://api.ap1.datadoghq.com/api/v2/validatehttps://api.ap2.datadoghq.com/api/v2/validatehttps://api.datadoghq.eu/api/v2/validatehttps://api.ddog-gov.com/api/v2/validatehttps://api.us2.ddog-gov.com/api/v2/validatehttps://api.datadoghq.com/api/v2/validatehttps://api.us3.datadoghq.com/api/v2/validatehttps://api.us5.datadoghq.com/api/v2/validate

    개요

    Check if the API key is valid. Returns the organization UUID, API key ID, and associated scopes.

    응답

    OK

    Response for the API key validation endpoint.

    Expand All

    항목

    유형

    설명

    data [required]

    object

    Data object containing the API key validation result.

    attributes [required]

    object

    Attributes of the API key validation response.

    api_key_id [required]

    string

    The UUID of the API key.

    api_key_scopes [required]

    [string]

    List of scope names associated with the API key.

    valid [required]

    boolean

    Whether the API key is valid.

    id [required]

    string

    The UUID of the organization associated with the API key.

    type [required]

    enum

    Resource type for the API key validation response. Allowed enum values: validate_v2

    {
      "data": {
        "attributes": {
          "api_key_id": "a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6",
          "api_key_scopes": [
            "remote_config_read"
          ],
          "valid": true
        },
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "type": "validate_v2"
      }
    }

    Forbidden

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [object]

    A list of errors.

    detail

    string

    A human-readable explanation specific to this occurrence of the error.

    meta

    object

    Non-standard meta-information about the error

    source

    object

    References to the source of the error.

    header

    string

    A string indicating the name of a single request header which caused the error.

    parameter

    string

    A string indicating which URI query parameter caused the error.

    pointer

    string

    A JSON pointer to the value in the request document that caused the error.

    status

    string

    Status code of the response.

    title

    string

    Short human-readable summary of the error.

    {
      "errors": [
        {
          "detail": "Missing required attribute in body",
          "meta": {},
          "source": {
            "header": "Authorization",
            "parameter": "limit",
            "pointer": "/data/attributes/title"
          },
          "status": "400",
          "title": "Bad Request"
        }
      ]
    }

    Too many requests

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    코드 사례

                      # Curl command
    curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/validate" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}"

    GET https://api.ap1.datadoghq.com/api/v2/validate_keyshttps://api.ap2.datadoghq.com/api/v2/validate_keyshttps://api.datadoghq.eu/api/v2/validate_keyshttps://api.ddog-gov.com/api/v2/validate_keyshttps://api.us2.ddog-gov.com/api/v2/validate_keyshttps://api.datadoghq.com/api/v2/validate_keyshttps://api.us3.datadoghq.com/api/v2/validate_keyshttps://api.us5.datadoghq.com/api/v2/validate_keys

    개요

    Check that the API key and application key used for the request are both valid. Returns {"status": "ok"} on success, 401 or 403 otherwise. Useful as a lightweight authentication probe before issuing other API calls that require full credentials.

    응답

    OK

    Response object for the API and application key validation status check.

    Expand All

    항목

    유형

    설명

    status [required]

    enum

    Status of the validation. Always ok when both the API key and the application key are valid. Allowed enum values: ok

    {
      "status": "ok"
    }

    Unauthorized

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Forbidden

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    Too many requests

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

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

    코드 사례

                      # Curl command
    curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/validate_keys" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"