Slack インテグレーション

Datadog-Slack インテグレーションを Datadog API を介して直接構成します。

DELETE https://api.ap1.datadoghq.com/api/v1/integration/slackhttps://api.datadoghq.eu/api/v1/integration/slackhttps://api.ddog-gov.com/api/v1/integration/slackhttps://api.datadoghq.com/api/v1/integration/slackhttps://api.us3.datadoghq.com/api/v1/integration/slackhttps://api.us5.datadoghq.com/api/v1/integration/slack

概要

Datadog-Slack インテグレーションを削除します。

応答

OK

Authentication error

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 DELETE "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/integration/slack" \ -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/v1/integration/slack/configuration/accounts/{account_name}/channelshttps://api.datadoghq.eu/api/v1/integration/slack/configuration/accounts/{account_name}/channelshttps://api.ddog-gov.com/api/v1/integration/slack/configuration/accounts/{account_name}/channelshttps://api.datadoghq.com/api/v1/integration/slack/configuration/accounts/{account_name}/channelshttps://api.us3.datadoghq.com/api/v1/integration/slack/configuration/accounts/{account_name}/channelshttps://api.us5.datadoghq.com/api/v1/integration/slack/configuration/accounts/{account_name}/channels

概要

Datadog-Slack インテグレーションに構成されたすべてのチャンネルのリストを取得します。 This endpoint requires the integrations_read permission.

引数

パスパラメーター

名前

種類

説明

account_name [required]

string

Your Slack account name.

応答

OK

A list of configured Slack channels.

Expand All

フィールド

種類

説明

display

object

Configuration options for what is shown in an alert event message.

message

boolean

Show the main body of the alert event.

default: true

notified

boolean

Show the list of @-handles in the alert event.

default: true

snapshot

boolean

Show the alert event's snapshot image.

default: true

tags

boolean

Show the scopes on which the monitor alerted.

default: true

name

string

Your channel name.

{
  "display": {
    "message": false,
    "notified": false,
    "snapshot": false,
    "tags": false
  },
  "name": "#general"
}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Authentication error

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Item 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"
  ]
}

コード例

/**
 * Get all channels in a Slack integration returns "OK" response
 */

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

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

const params: v1.SlackIntegrationApiGetSlackIntegrationChannelsRequest = {
  accountName: "account_name",
};

apiInstance
  .getSlackIntegrationChannels(params)
  .then((data: v1.SlackIntegrationChannel[]) => {
    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.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

PUT https://api.ap1.datadoghq.com/api/v1/integration/slackhttps://api.datadoghq.eu/api/v1/integration/slackhttps://api.ddog-gov.com/api/v1/integration/slackhttps://api.datadoghq.com/api/v1/integration/slackhttps://api.us3.datadoghq.com/api/v1/integration/slackhttps://api.us5.datadoghq.com/api/v1/integration/slack

概要

既存の Datadog-Slack インテグレーションにチャンネルを追加します。

このメソッドを使用すると、現在の構成を Datadog オーガニゼーションに送信された 新しい構成に置き換えて、インテグレーション構成が更新されます。

リクエスト

Body Data (required)

既存の Datadog-Slack インテグレーションのリクエスト本文を更新します。

Expand All

フィールド

種類

説明

channels

[object]

An array of slack channel configurations.

account [required]

string

Account to which the channel belongs to.

channel_name [required]

string

Your channel name.

transfer_all_user_comments

boolean

To be notified for every comment on a graph, set it to true. If set to False use the @slack-channel_name syntax for comments to be posted to slack.

{
  "channels": [
    {
      "account": "jane.doe",
      "channel_name": "#general",
      "transfer_all_user_comments": false
    }
  ]
}

応答

OK

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Authentication error

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 PUT "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/integration/slack" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "channels": [ { "account": "jane.doe", "channel_name": "#general" } ] } EOF

POST https://api.ap1.datadoghq.com/api/v1/integration/slack/configuration/accounts/{account_name}/channelshttps://api.datadoghq.eu/api/v1/integration/slack/configuration/accounts/{account_name}/channelshttps://api.ddog-gov.com/api/v1/integration/slack/configuration/accounts/{account_name}/channelshttps://api.datadoghq.com/api/v1/integration/slack/configuration/accounts/{account_name}/channelshttps://api.us3.datadoghq.com/api/v1/integration/slack/configuration/accounts/{account_name}/channelshttps://api.us5.datadoghq.com/api/v1/integration/slack/configuration/accounts/{account_name}/channels

概要

Datadog-Slack インテグレーションにチャンネルを追加します。 This endpoint requires the manage_integrations permission.

引数

パスパラメーター

名前

種類

説明

account_name [required]

string

Your Slack account name.

リクエスト

Body Data (required)

作成される Slack チャンネルを説明するペイロード

Expand All

フィールド

種類

説明

display

object

Configuration options for what is shown in an alert event message.

message

boolean

Show the main body of the alert event.

default: true

notified

boolean

Show the list of @-handles in the alert event.

default: true

snapshot

boolean

Show the alert event's snapshot image.

default: true

tags

boolean

Show the scopes on which the monitor alerted.

default: true

name

string

Your channel name.

{
  "display": {
    "message": false,
    "notified": false,
    "snapshot": false,
    "tags": false
  },
  "name": "#general"
}

応答

OK

The Slack channel configuration.

Expand All

フィールド

種類

説明

display

object

Configuration options for what is shown in an alert event message.

message

boolean

Show the main body of the alert event.

default: true

notified

boolean

Show the list of @-handles in the alert event.

default: true

snapshot

boolean

Show the alert event's snapshot image.

default: true

tags

boolean

Show the scopes on which the monitor alerted.

default: true

name

string

Your channel name.

{
  "display": {
    "message": false,
    "notified": false,
    "snapshot": false,
    "tags": false
  },
  "name": "#general"
}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Authentication error

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Item 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"
  ]
}

コード例

/**
 * Create a Slack integration channel returns "OK" response
 */

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

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

const params: v1.SlackIntegrationApiCreateSlackIntegrationChannelRequest = {
  body: {
    display: {
      message: true,
      notified: true,
      snapshot: true,
      tags: true,
    },
    name: "#general",
  },
  accountName: "account_name",
};

apiInstance
  .createSlackIntegrationChannel(params)
  .then((data: v1.SlackIntegrationChannel) => {
    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.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v1/integration/slackhttps://api.datadoghq.eu/api/v1/integration/slackhttps://api.ddog-gov.com/api/v1/integration/slackhttps://api.datadoghq.com/api/v1/integration/slackhttps://api.us3.datadoghq.com/api/v1/integration/slackhttps://api.us5.datadoghq.com/api/v1/integration/slack

概要

Datadog-Slack インテグレーションを作成します。作成が完了したら、 Slack インテグレーションエンドポイントにチャンネルを追加するに従ってチャンネルを追加してください。

このメソッドを使用すると、Datadog オーガニゼーションの既存のデータに新しい構成を追加する形でインテグレーション構成が更新されます。

リクエスト

Body Data (required)

Datadog-Slack インテグレーションのリクエスト本文を作成します。

Expand All

フィールド

種類

説明

service_hooks

[object]

The array of service hook objects.

account [required]

string

Your Slack account name.

url [required]

string

Your Slack service hook URL.

{
  "service_hooks": [
    {
      "account": "joe.doe",
      "url": "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
    }
  ]
}

応答

OK

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Authentication error

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 POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/integration/slack" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "service_hooks": [ { "account": "joe.doe", "url": "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX" } ] } EOF

GET https://api.ap1.datadoghq.com/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}https://api.datadoghq.eu/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}https://api.ddog-gov.com/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}https://api.datadoghq.com/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}https://api.us3.datadoghq.com/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}https://api.us5.datadoghq.com/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}

概要

Datadog-Slack インテグレーションに構成されたチャンネルを取得します。 This endpoint requires the integrations_read permission.

引数

パスパラメーター

名前

種類

説明

account_name [required]

string

Your Slack account name.

channel_name [required]

string

The name of the Slack channel being operated on.

応答

OK

The Slack channel configuration.

Expand All

フィールド

種類

説明

display

object

Configuration options for what is shown in an alert event message.

message

boolean

Show the main body of the alert event.

default: true

notified

boolean

Show the list of @-handles in the alert event.

default: true

snapshot

boolean

Show the alert event's snapshot image.

default: true

tags

boolean

Show the scopes on which the monitor alerted.

default: true

name

string

Your channel name.

{
  "display": {
    "message": false,
    "notified": false,
    "snapshot": false,
    "tags": false
  },
  "name": "#general"
}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Authentication error

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Item 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"
  ]
}

コード例

/**
 * Get a Slack integration channel returns "OK" response
 */

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

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

const params: v1.SlackIntegrationApiGetSlackIntegrationChannelRequest = {
  accountName: "account_name",
  channelName: "channel_name",
};

apiInstance
  .getSlackIntegrationChannel(params)
  .then((data: v1.SlackIntegrationChannel) => {
    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.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v1/integration/slackhttps://api.datadoghq.eu/api/v1/integration/slackhttps://api.ddog-gov.com/api/v1/integration/slackhttps://api.datadoghq.com/api/v1/integration/slackhttps://api.us3.datadoghq.com/api/v1/integration/slackhttps://api.us5.datadoghq.com/api/v1/integration/slack

概要

Datadog-Slack インテグレーションのすべての情報を取得します。

応答

OK

Expand All

フィールド

種類

説明

No response body

{}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Authentication error

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Item 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"
  ]
}

コード例

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/integration/slack" \ -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/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}https://api.datadoghq.eu/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}https://api.ddog-gov.com/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}https://api.datadoghq.com/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}https://api.us3.datadoghq.com/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}https://api.us5.datadoghq.com/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}

概要

Datadog-Slack インテグレーションに使用されるチャンネルを更新します。 This endpoint requires the manage_integrations permission.

引数

パスパラメーター

名前

種類

説明

account_name [required]

string

Your Slack account name.

channel_name [required]

string

The name of the Slack channel being operated on.

リクエスト

Body Data (required)

更新されるフィールドと値を説明するペイロード。

Expand All

フィールド

種類

説明

display

object

Configuration options for what is shown in an alert event message.

message

boolean

Show the main body of the alert event.

default: true

notified

boolean

Show the list of @-handles in the alert event.

default: true

snapshot

boolean

Show the alert event's snapshot image.

default: true

tags

boolean

Show the scopes on which the monitor alerted.

default: true

name

string

Your channel name.

{
  "display": {
    "message": false,
    "notified": false,
    "snapshot": false,
    "tags": false
  },
  "name": "#general"
}

応答

OK

The Slack channel configuration.

Expand All

フィールド

種類

説明

display

object

Configuration options for what is shown in an alert event message.

message

boolean

Show the main body of the alert event.

default: true

notified

boolean

Show the list of @-handles in the alert event.

default: true

snapshot

boolean

Show the alert event's snapshot image.

default: true

tags

boolean

Show the scopes on which the monitor alerted.

default: true

name

string

Your channel name.

{
  "display": {
    "message": false,
    "notified": false,
    "snapshot": false,
    "tags": false
  },
  "name": "#general"
}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Authentication error

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Item 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"
  ]
}

コード例

/**
 * Update a Slack integration channel returns "OK" response
 */

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

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

const params: v1.SlackIntegrationApiUpdateSlackIntegrationChannelRequest = {
  body: {
    display: {
      message: true,
      notified: true,
      snapshot: true,
      tags: true,
    },
    name: "#general",
  },
  accountName: "account_name",
  channelName: "channel_name",
};

apiInstance
  .updateSlackIntegrationChannel(params)
  .then((data: v1.SlackIntegrationChannel) => {
    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.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

DELETE https://api.ap1.datadoghq.com/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}https://api.datadoghq.eu/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}https://api.ddog-gov.com/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}https://api.datadoghq.com/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}https://api.us3.datadoghq.com/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}https://api.us5.datadoghq.com/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}

概要

Datadog-Slack インテグレーションからチャンネルを削除します。 This endpoint requires the manage_integrations permission.

引数

パスパラメーター

名前

種類

説明

account_name [required]

string

Your Slack account name.

channel_name [required]

string

The name of the Slack channel being operated on.

応答

The channel was removed successfully.

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Authentication error

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

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

Item 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"
  ]
}

コード例

/**
 * Remove a Slack integration channel returns "The channel was removed successfully." response
 */

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

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

const params: v1.SlackIntegrationApiRemoveSlackIntegrationChannelRequest = {
  accountName: "account_name",
  channelName: "channel_name",
};

apiInstance
  .removeSlackIntegrationChannel(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.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

PREVIEWING: aliciascott/getting-started-phase1