Slack インテグレーションにチャンネルを追加する
PUT
https://api.datadoghq.com/api/v1/integration/slackhttps://api.us3.datadoghq.com/api/v1/integration/slackhttps://api.us5.datadoghq.com/api/v1/integration/slackhttps://api.datadoghq.eu/api/v1/integration/slackhttps://api.ap1.datadoghq.com/api/v1/integration/slackhttps://api.ap2.datadoghq.com/api/v1/integration/slackhttps://api.uk1.datadoghq.com/api/v1/integration/slackhttps://api.ddog-gov.com/api/v1/integration/slackhttps://api.us2.ddog-gov.com/api/v1/integration/slack概要
非推奨: このエンドポイントは非推奨です。
このメソッドは、Datadog 組織に送信された新しい構成で現在の構成を置き換えることにより、 インテグレーション構成を完全に書き換えます。 Slack の Webhook URL を含むすべての項目が有効であることを確認してください。 無効な URL を使用すると、Slack 通知が正常に機能しなくなります。
リクエスト
Body Data (required)
既存の Datadog-Slack インテグレーションリクエストボディを更新します。
フィールド
タイプ
説明
channels[object]
Slack チャンネルの構成。
account [required]string
Account to which the channel belongs to.
channel_name [required]string
Your channel name.
transfer_all_user_commentsboolean
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.
false{
"channels": [
{
"account": "jane.doe",
"channel_name": "#general",
"transfer_all_user_comments": false
}
]
}応答
OK
Bad Request
Error response object.
フィールド
タイプ
説明
errors [required][string]
Array of errors returned by the API.
{
"errors": [
"Bad Request"
]
}Authentication error
Error response object.
フィールド
タイプ
説明
errors [required][string]
Array of errors returned by the API.
{
"errors": [
"Bad Request"
]
}Too many requests
Error response object.
フィールド
タイプ
説明
errors [required][string]
Array of errors returned by the API.
{
"errors": [
"Bad Request"
]
}コード例
Slack インテグレーションにチャンネルを追加する
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PUT "https://api.${DD_SITE}/api/v1/integration/slack" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"channels": [
{
"account": "Main_Account",
"channel_name": "#channel_name_main_account",
"transfer_all_user_comments": false
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PUT "https://api.${DD_SITE}/api/v1/integration/slack" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"channels": [
{
"account": "Main_Account",
"channel_name": "#channel_name_main_account",
"transfer_all_user_comments": false
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PUT "https://api.${DD_SITE}/api/v1/integration/slack" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"channels": [
{
"account": "Main_Account",
"channel_name": "#channel_name_main_account",
"transfer_all_user_comments": false
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PUT "https://api.${DD_SITE}/api/v1/integration/slack" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"channels": [
{
"account": "Main_Account",
"channel_name": "#channel_name_main_account",
"transfer_all_user_comments": false
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PUT "https://api.${DD_SITE}/api/v1/integration/slack" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"channels": [
{
"account": "Main_Account",
"channel_name": "#channel_name_main_account",
"transfer_all_user_comments": false
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PUT "https://api.${DD_SITE}/api/v1/integration/slack" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"channels": [
{
"account": "Main_Account",
"channel_name": "#channel_name_main_account",
"transfer_all_user_comments": false
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PUT "https://api.${DD_SITE}/api/v1/integration/slack" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"channels": [
{
"account": "Main_Account",
"channel_name": "#channel_name_main_account",
"transfer_all_user_comments": false
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PUT "https://api.${DD_SITE}/api/v1/integration/slack" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"channels": [
{
"account": "Main_Account",
"channel_name": "#channel_name_main_account",
"transfer_all_user_comments": false
}
]
}
EOF# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PUT "https://api.${DD_SITE}/api/v1/integration/slack" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"channels": [
{
"account": "Main_Account",
"channel_name": "#channel_name_main_account",
"transfer_all_user_comments": false
}
]
}
EOF