For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/ja/api/latest/tag-rules/get-a-tag-rule.md. A documentation index is available at /llms.txt.
Language
Datadog site

Get a tag rule

警告Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.
GEThttps://api.datadoghq.com/api/v2/governance/tag_rules/{rule_id}https://api.us3.datadoghq.com/api/v2/governance/tag_rules/{rule_id}https://api.us5.datadoghq.com/api/v2/governance/tag_rules/{rule_id}https://api.datadoghq.eu/api/v2/governance/tag_rules/{rule_id}https://api.ap1.datadoghq.com/api/v2/governance/tag_rules/{rule_id}https://api.ap2.datadoghq.com/api/v2/governance/tag_rules/{rule_id}https://api.uk1.datadoghq.com/api/v2/governance/tag_rules/{rule_id}https://api.ddog-gov.com/api/v2/governance/tag_rules/{rule_id}https://api.us2.ddog-gov.com/api/v2/governance/tag_rules/{rule_id}

概要

Retrieve a single tag rule by ID. Optionally include the rule's current compliance score via the include=score query parameter. Rules belonging to other organizations cannot be retrieved.

This endpoint requires any of the following permissions:

  • telemetry_rules_read
  • metrics_read

引数

パスパラメーター

名前
タイプ
説明
rule_id [required]
string

The unique identifier of the tag rule.

クエリ文字列

名前
タイプ
説明
include
enum

Comma-separated list of related resources to include alongside the rule. Currently the only supported value is score.

Allowed enum values: score
ts_start
integer

Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds.

ts_end
integer

End of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Must be in the past and greater than ts_start.

応答

OK

A single tag rule.

フィールド
タイプ
説明
data [required]
object

A tag rule resource.

included
[object]

Related resources fetched alongside the primary tag rules. Populated when an include query parameter is supplied.

コード例

Get a tag rule
# Path parameters
export rule_id="123"

# 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 GET "https://api.${DD_SITE}/api/v2/governance/tag_rules/${rule_id}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Path parameters
export rule_id="123"

# 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 GET "https://api.${DD_SITE}/api/v2/governance/tag_rules/${rule_id}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Path parameters
export rule_id="123"

# 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 GET "https://api.${DD_SITE}/api/v2/governance/tag_rules/${rule_id}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Path parameters
export rule_id="123"

# 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 GET "https://api.${DD_SITE}/api/v2/governance/tag_rules/${rule_id}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Path parameters
export rule_id="123"

# 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 GET "https://api.${DD_SITE}/api/v2/governance/tag_rules/${rule_id}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Path parameters
export rule_id="123"

# 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 GET "https://api.${DD_SITE}/api/v2/governance/tag_rules/${rule_id}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Path parameters
export rule_id="123"

# 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 GET "https://api.${DD_SITE}/api/v2/governance/tag_rules/${rule_id}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Path parameters
export rule_id="123"

# 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 GET "https://api.${DD_SITE}/api/v2/governance/tag_rules/${rule_id}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Path parameters
export rule_id="123"

# 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 GET "https://api.${DD_SITE}/api/v2/governance/tag_rules/${rule_id}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"