• Home
  • Dynatrace API
  • Account management
  • Policy management
  • Bindings
  • POST bindings of a policy

Policy management API - POST bindings of a policy

Assigns a policy of the specified level to user groups. Any existing policy bindings remain unaffected.

The request consumes an application/json payload.

POST

https://api.dynatrace.com/iam/v1/repo/{levelType}/{levelId}/bindings/{policyUuid}

Authentication

To execute this request, you need the Allow IAM policy configuration for environments (iam-policies-management) permission assigned to your token. To learn how to obtain and use it, see Authentication.

Parameters

ParameterTypeDescriptionInRequired
levelTypestring

The type of the policy level. The following values are available:

  • global: A global policy applies to all accounts and environments. It is defined and managed by Dynatrace.
  • account: An account policy applies to all environments of an account.
  • environment: An environment policy applies to a specific environment.

Each level inherits the policies of the higher level and extends them with its own policies.

pathrequired
levelIdstring

The ID of the policy level. Use one of the following values, depending on the level type:

  • global: use the global value.
  • account: use the UUID of the account.
  • environment: use the ID of the environment.
pathrequired
policyUuidstring

The ID of the required policy.

pathrequired
bodyAppendLevelPolicyBindingsRequestDto

The JSON body of the request. Contains user groups that must use the policy.

bodyrequired

Request body objects

The AppendLevelPolicyBindingsRequestDto object

ElementTypeDescriptionRequired
groupsstring[]

A list of user groups (specified by IDs) to which the policy applies.

required

Request body JSON model

This is a model of the request body, showing the possible elements. It has to be adjusted for usage in an actual request.

json
{ "groups": [ "string" ] }

Response

Response codes

CodeTypeDescription
204

Success. Policy bindings created.

400ErrorDto

Failed. The request is invalid

404ErrorDto

Failed. The specified resource is not found.

422ErrorDto

The specified response not found

Example

In this example, the request assigns the environment-level policy with the UUID of 0c621587-f978-4c7b-89ee-d2045f611b03 from the mySampleEnv environment to user groups with the following UUIDs:

  • 541802b0-623c-4193-8728-036ed01d4eb4
  • a468e0e0-ef8f-45d8-9b0f-e016984d838b

The response code of 204 indicates a successful request.

Curl

bash
curl --request POST \ --url 'https://api.dynatrace.com/iam/v1/repo/environment/lde68092/bindings/0c621587-f978-4c7b-89ee-d2045f611b03' \ --header 'Authorization: Bearer abcdefjhij1234567890' \ --header 'Content-Type: application/json' \ --data '{ "groups": [ "541802b0-623c-4193-8728-036ed01d4eb4", "a468e0e0-ef8f-45d8-9b0f-e016984d838b" ] }'

Request URL

plaintext
https://api.dynatrace.com/iam/v1/repo/environment/lde68092/bindings/0c621587-f978-4c7b-89ee-d2045f611b03

Request body

json
{ "groups": [ "541802b0-623c-4193-8728-036ed01d4eb4", "a468e0e0-ef8f-45d8-9b0f-e016984d838b" ] }

Response code

204