This API is deprecated. Use the Management zones schema (builtin:management-zones) of the Settings API instead.
Create or delete security context for monitored entities.
Matching entities will have a management zone assigned if the given security context matches the name of an already existing management zone. This endpoint does not create a new management zone if there is no management zone with the provided name.
Management zone rules will not apply to entities with a set security context. To be able to apply them again, you need to delete the security context.
For more information on security context, see Grant access to entities with security context.
The request consumes and produces an application/json payload.
| POST | SaaS | https://{your-environment-id}.live.dynatrace.com/api/v2/entities/securityContext |
| POST | Environment ActiveGateCluster ActiveGate | https://{your-activegate-domain}:9999/e/{your-environment-id}/api/v2/entities/securityContext |
To execute this request, you need an access token with settings.write scope.
One of the following permissions is required for personal access tokens:
environment:roles:manage-settingssettings:objects:writeTo learn how to obtain and use it, see Personal access tokens.
Required scope: settings:objects:write
To learn how to obtain and use it, see Platform tokens or OAuth clients.
| Parameter | Type | Description | In | Required |
|---|---|---|---|---|
| entitySelector | string | Defines the scope of the entities to set the security context for. Only entities that can have management zones are considered for this operation You must set one of these criteria:
You can add one or more of the following criteria. Values are case-sensitive and the
For more information, see Entity selector in Dynatrace Documentation. To set several criteria, separate them with a comma ( The maximum string length is 2,000 characters. | query | Required |
| from | string | The start of the requested timeframe. You can use one of the following formats:
If not set, the relative timeframe of three days is used ( | query | Optional |
| to | string | The end of the requested timeframe. You can use one of the following formats:
If not set, the current timestamp is used. | query | Optional |
| body | Security | The JSON body of the request. Contains security context to be set for the matching entities. | body | Optional |
SecurityContextDtoImpl object| Element | Type | Description | Required |
|---|---|---|---|
| securityContext | string[] | The security context, that will be set for matching entities. If there exists a management zone with this name, it will be set for all matching entities, overriding all automatic management zone rules. | Required |
This is a model of the request body, showing the possible elements. It has to be adjusted for usage in an actual request.
{"securityContext": ["string"]}
| Code | Type | Description |
|---|---|---|
| 200 | Security | Success |
| 4XX | Error | Client side error. |
| 5XX | Error | Server side error. |
SecurityContextResultDto objectThe response payload holding the result of the security context application.
| Element | Type | Description |
|---|---|---|
| entityIds | string[] | The entity ids that matched the entity selector and now have the supplied security context set. |
| managementZoneIds | integer[] | The management zone ids that is applied to the entity ids, if the security context matched an existing management zone's name, otherwise null. |
ErrorEnvelope object| Element | Type | Description |
|---|---|---|
| error | Error | - |
Error object| Element | Type | Description |
|---|---|---|
| code | integer | The HTTP status code |
| constraintViolations | Constraint | A list of constraint violations |
| message | string | The error message |
ConstraintViolation objectA list of constraint violations
| Element | Type | Description |
|---|---|---|
| location | string | - |
| message | string | - |
| parameterLocation | string | -The element can hold these values
|
| path | string | - |
{"entityIds": ["string"],"managementZoneIds": [1]}
{"error": {"code": 1,"constraintViolations": [{"location": "string","message": "string","parameterLocation": "HEADER","path": "string"}],"message": "string"}}
| DELETE | SaaS | https://{your-environment-id}.live.dynatrace.com/api/v2/entities/securityContext |
| DELETE | Environment ActiveGateCluster ActiveGate | https://{your-activegate-domain}:9999/e/{your-environment-id}/api/v2/entities/securityContext |
To execute this request, you need an access token with settings.write scope.
One of the following permissions is required for personal access tokens:
environment:roles:manage-settingssettings:objects:writeTo learn how to obtain and use it, see Personal access tokens.
Required scope: settings:objects:write
To learn how to obtain and use it, see Platform tokens or OAuth clients.
| Parameter | Type | Description | In | Required |
|---|---|---|---|---|
| entitySelector | string | Defines the scope of the entities to set the security context for. Only entities that can have management zones are considered for this operation You must set one of these criteria:
You can add one or more of the following criteria. Values are case-sensitive and the
For more information, see Entity selector in Dynatrace Documentation. To set several criteria, separate them with a comma ( The maximum string length is 2,000 characters. | query | Required |
| from | string | The start of the requested timeframe. You can use one of the following formats:
If not set, the relative timeframe of three days is used ( | query | Optional |
| to | string | The end of the requested timeframe. You can use one of the following formats:
If not set, the current timestamp is used. | query | Optional |
| Code | Type | Description |
|---|---|---|
| 200 | Security | Success |
| 4XX | Error | Client side error. |
| 5XX | Error | Server side error. |
SecurityContextResultDto objectThe response payload holding the result of the security context application.
| Element | Type | Description |
|---|---|---|
| entityIds | string[] | The entity ids that matched the entity selector and now have the supplied security context set. |
| managementZoneIds | integer[] | The management zone ids that is applied to the entity ids, if the security context matched an existing management zone's name, otherwise null. |
ErrorEnvelope object| Element | Type | Description |
|---|---|---|
| error | Error | - |
Error object| Element | Type | Description |
|---|---|---|
| code | integer | The HTTP status code |
| constraintViolations | Constraint | A list of constraint violations |
| message | string | The error message |
ConstraintViolation objectA list of constraint violations
| Element | Type | Description |
|---|---|---|
| location | string | - |
| message | string | - |
| parameterLocation | string | -The element can hold these values
|
| path | string | - |
{"entityIds": ["string"],"managementZoneIds": [1]}
{"error": {"code": 1,"constraintViolations": [{"location": "string","message": "string","parameterLocation": "HEADER","path": "string"}],"message": "string"}}