Classic Environment V2
Documentation of the Dynatrace Environment API v2. Resources here generally supersede those in v1. Migration of resources from v1 is in progress.
If you miss a resource, consider using the Dynatrace Environment API v1.
To read about use cases and examples, see Dynatrace Documentation.
To authorize, use a valid access token or personal access token. For usage in a Dynatrace app, refer to the Dynatrace Developer documentation.
Notes about compatibility:
- Operations marked as early adopter or preview may be changed in non-compatible ways, although we try to avoid this.
- We may add new enum constants without incrementing the API version; thus, clients need to handle unknown enum constants gracefully.
npm install @dynatrace-sdk/client-classic-environment-v2
accessTokensActiveGateTokensClient​
import { accessTokensActiveGateTokensClient } from '@dynatrace-sdk/client-classic-environment-v2';
createToken​
Creates a new ActiveGate token
One of the following scopes is required:
- environment-api:activegate-tokens:create
- environment-api:activegate-tokens:write
Required permission: environment:roles:manage-settings
The newly created token will be owned by the same user who owns the token used for authentication of the call.
Parameters​
Name | Type |
---|---|
config.body*required | ActiveGateTokenCreate |
Returns​
Return type | Status code | Description |
---|---|---|
ActiveGateTokenCreated | 201 | Success. The token has been created. The body of the response contains the token secret. |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Failed. The input is invalid. | Client side error. | Server side error. |
Code example
import { accessTokensActiveGateTokensClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await accessTokensActiveGateTokensClient.createToken({
body: {
activeGateType:
ActiveGateTokenCreateActiveGateType.Environment,
name: "myToken",
},
});
getToken​
Gets metadata of an ActiveGate token
Required scope: environment-api:activegate-tokens:read Required permission: environment:roles:manage-settings
The token secret is not exposed.
Parameters​
Name | Type | Description |
---|---|---|
config.activeGateTokenIdentifier*required | string | The ActiveGate token identifier, consisting of prefix and public part of the token. |
Returns​
Return type | Status code | Description |
---|---|---|
ActiveGateToken | 200 | Success. The response contains the metadata of the tokens. |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Failed. The input is invalid. | Failed. The requested resource doesn't exist. | Client side error. | Server side error. |
Code example
import { accessTokensActiveGateTokensClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await accessTokensActiveGateTokensClient.getToken({
activeGateTokenIdentifier: "...",
});
listTokens​
Lists all available ActiveGate tokens
Required scope: environment-api:activegate-tokens:read Required permission: environment:roles:manage-settings
You can limit the output by using pagination:
- Specify the number of results per page in the pageSize query parameter.
- Use the cursor from the nextPageKey field of the previous response in the nextPageKey query parameter to obtain subsequent pages.
Parameters​
Name | Type | Description |
---|---|---|
config.nextPageKey | string | The cursor for the next page of results. You can find it in the nextPageKey field of the previous response. The first page is always returned if you don't specify the nextPageKey query parameter. When the nextPageKey is set to obtain subsequent pages, you must omit all other query parameters. |
config.pageSize | number | The amount of ActiveGate tokens in a single response payload. The maximal allowed page size is 3000 and the minimal size is 100. If not set, 100 is used. |
Returns​
Return type | Status code | Description |
---|---|---|
ActiveGateTokenList | 200 | Success. The response contains the list of ActiveGate tokens. |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Failed. The input is invalid. | Failed. The requested resource doesn't exist. | Client side error. | Server side error. |
Code example
import { accessTokensActiveGateTokensClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await accessTokensActiveGateTokensClient.listTokens();
revokeToken​
Deletes an ActiveGate token
Required scope: environment-api:activegate-tokens:write Required permission: environment:roles:manage-settings
Parameters​
Name | Type | Description |
---|---|---|
config.activeGateTokenIdentifier*required | string | The ActiveGate token identifier, consisting of prefix and public part of the token to be deleted. |
Returns​
Return type | Status code | Description |
---|---|---|
void | 204 | Success. Response doesn't have a body. |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Failed. The input is invalid. | Failed. The requested resource doesn't exist. | Client side error. | Server side error. |
Code example
import { accessTokensActiveGateTokensClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await accessTokensActiveGateTokensClient.revokeToken({
activeGateTokenIdentifier: "...",
});
accessTokensAgentTokensClient​
import { accessTokensAgentTokensClient } from '@dynatrace-sdk/client-classic-environment-v2';
getAgentConnectionToken​
Gets the agent connection token | maturity=EARLY_ADOPTER
Required scope: environment-api:agent-connection-tokens:read Required permission: environment:roles:agent-install
Returns the agent connection token.
Returns​
Return type | Status code | Description |
---|---|---|
AgentConnectionToken | 200 | Success |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Failed. The input is invalid. | Failed. The requested resource doesn't exist. | Client side error. | Server side error. |
Code example
import { accessTokensAgentTokensClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await accessTokensAgentTokensClient.getAgentConnectionToken();
accessTokensApiTokensClient​
import { accessTokensApiTokensClient } from '@dynatrace-sdk/client-classic-environment-v2';
createApiToken​
Creates a new API token
Required scope: environment-api:api-tokens:write Required permission: environment:roles:viewer
The newly created token will be owned by the same user who owns the token used for authentication of the call.
Creating personal access tokens requires the environment:roles:viewer
permission. Creating access tokens requires the environment:roles:manage-settings
permission.
Parameters​
Name | Type |
---|---|
config.body*required | ApiTokenCreate |
Returns​
Return type | Status code | Description |
---|---|---|
ApiTokenCreated | 201 | Success. The token has been created. The body of the response contains the token secret. |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Failed. The input is invalid. | Client side error. | Server side error. |
Code example
import { accessTokensApiTokensClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await accessTokensApiTokensClient.createApiToken({
body: { name: "tokenName", scopes: ["metrics.read"] },
});
deleteApiToken​
Deletes an API token
Required scope: environment-api:api-tokens:write Required permission: environment:roles:viewer
Parameters​
Name | Type | Description |
---|---|---|
config.id*required | string | The ID of the token to be deleted. You can specify either the ID or the secret of the token. You can't delete the token you're using for authentication of the request. |
Returns​
Return type | Status code | Description |
---|---|---|
void | 204 | Success. Response doesn't have a body. |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Failed. You can't delete the token you're using for authentication of the request. | Client side error. | Server side error. |
Code example
import { accessTokensApiTokensClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await accessTokensApiTokensClient.deleteApiToken({
id: "...",
});
getApiToken​
Gets API token metadata by token ID
Required scope: environment-api:api-tokens:read Required permission: environment:roles:viewer
The token secret is not exposed.
Parameters​
Name | Type |
---|---|
config.id*required | string |
Returns​
Return type | Status code | Description |
---|---|---|
ApiToken | 200 | Success |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Failed. The input is invalid. | Client side error. | Server side error. |
Code example
import { accessTokensApiTokensClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data = await accessTokensApiTokensClient.getApiToken({
id: "...",
});
listApiTokens​
Lists all available API tokens
Required scope: environment-api:api-tokens:read Required permission: environment:roles:viewer
You can limit the output by using pagination:
- Specify the number of results per page in the pageSize query parameter.
- Use the cursor from the nextPageKey field of the previous response in the nextPageKey query parameter to obtain subsequent pages.
Parameters​
Name | Type | Description |
---|---|---|
config.apiTokenSelector | string | Filters the resulting sets of tokens. Only tokens matching the specified criteria are included into response. You can set one or more of the following criteria:
To set multiple criteria, separate them with commas ( |
config.fields | string | Specifies the fields to be included in the response. The following fields are included by default:
To remove fields from the response, specify them with the minus ( You can include additional fields:
To add fields to the response, specify them with the plus ( Alternatively, you can define the desired set of fields in the response. Specify the required fields as a comma-separated list, without operators (for example, The fields string must be URL-encoded. |
config.from | string | Filters tokens based on the last usage time. The start of the requested timeframe. You can use one of the following formats:
|
config.nextPageKey | string | The cursor for the next page of results. You can find it in the nextPageKey field of the previous response. The first page is always returned if you don't specify the nextPageKey query parameter. When the nextPageKey is set to obtain subsequent pages, you must omit all other query parameters. |
config.pageSize | number | The amount of API tokens in a single response payload. The maximal allowed page size is 10000 and the minimal allowed page size is 100. If not set, 200 is used. |
config.sort | string | The sort order of the token list. You can sort by the following properties with a sign prefix for the sort order:
If no prefix is set, + is used. If not set, tokens are sorted by creation date with newest first. |
config.to | string | Filters tokens based on the last usage time. The end of the requested timeframe. You can use one of the following formats:
If not set, the current timestamp is used. |
Returns​
Return type | Status code | Description |
---|---|---|
ApiTokenList | 200 | Success |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Failed. The input is invalid. | Client side error. | Server side error. |
Code example
import { accessTokensApiTokensClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await accessTokensApiTokensClient.listApiTokens();
lookupApiToken​
Gets API token metadata by token secret
Required scope: environment-api:api-tokens:read Required permission: environment:roles:viewer
Parameters​
Name | Type |
---|---|
config.body*required | ApiTokenSecret |
Returns​
Return type | Status code | Description |
---|---|---|
ApiToken | 200 | Success |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Client side error. | Server side error. |
Code example
import { accessTokensApiTokensClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await accessTokensApiTokensClient.lookupApiToken({
body: {
token:
"dt0c01.ST2EY72KQINMH574WMNVI7YN.G3DFPBEJYMODIDAEX454M7YWBUVEFOWKPRVMWFASS64NFH52PX6BNDVFFM572RZM",
},
});
updateApiToken​
Updates an API token
Required scope: environment-api:api-tokens:write Required permission: environment:roles:viewer
Parameters​
Name | Type | Description |
---|---|---|
config.body*required | ApiTokenUpdate | |
config.id*required | string | The ID of the token to be updated. You can't disable the token you're using for authentication of the request. |
Returns​
Return type | Status code | Description |
---|---|---|
void | 204 | Success. Response doesn't have a body. |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Failed. The input is invalid. | Client side error. | Server side error. |
Code example
import { accessTokensApiTokensClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await accessTokensApiTokensClient.updateApiToken({
id: "...",
body: {},
});
accessTokensTenantTokensClient​
import { accessTokensTenantTokensClient } from '@dynatrace-sdk/client-classic-environment-v2';
cancelRotation​
Cancels tenant token rotation
Required scope: environment-api:tenant-token-rotation:write Required permission: environment:roles:manage-settings
To learn how to rotate tokens, see Token rotation in Dynatrace Documentation.
Returns​
Return type | Status code | Description |
---|---|---|
TenantTokenConfig | 200 | Success. Rotation process has been cancelled. The current tenant token remains valid. |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Failed. There is no ongoing rotation process. | Client side error. | Server side error. |
Code example
import { accessTokensTenantTokensClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await accessTokensTenantTokensClient.cancelRotation();
finishRotation​
Finishes tenant token rotation
Required scope: environment-api:tenant-token-rotation:write Required permission: environment:roles:manage-settings
To learn how to rotate tokens, see Token rotation in Dynatrace Documentation.
Returns​
Return type | Status code | Description |
---|---|---|
TenantTokenConfig | 200 | Success. The rotation process is completed. The active field of the response contains the new tenant token. |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | No ongoing rotation process. | Client side error. | Server side error. |
Code example
import { accessTokensTenantTokensClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await accessTokensTenantTokensClient.finishRotation();
startRotation​
Starts tenant token rotation
Required scope: environment-api:tenant-token-rotation:write Required permission: environment:roles:manage-settings
To learn how to rotate tokens, see Token rotation in Dynatrace Documentation.
Returns​
Return type | Status code | Description |
---|---|---|
TenantTokenConfig | 200 | Success. The new tenant token is created and will replace the old one. The active field of the response contains the new tenant token. |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Failed. Another rotation process is already in progress. | Client side error. | Server side error. |
Code example
import { accessTokensTenantTokensClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await accessTokensTenantTokensClient.startRotation();
activeGatesActiveGateGroupsClient​
import { activeGatesActiveGateGroupsClient } from '@dynatrace-sdk/client-classic-environment-v2';
getActiveGateGroups​
Lists ActiveGate groups
Required scope: environment-api:activegates:read Required permission: environment:roles:manage-settings
Returns​
Return type | Status code | Description |
---|---|---|
ActiveGateGroups | 200 | Success |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Client side error. | Server side error. |
Code example
import { activeGatesActiveGateGroupsClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await activeGatesActiveGateGroupsClient.getActiveGateGroups();
activeGatesAutoUpdateConfigurationClient​
import { activeGatesAutoUpdateConfigurationClient } from '@dynatrace-sdk/client-classic-environment-v2';
getAutoUpdateConfigById​
Gets the configuration of auto-update for the specified ActiveGate
Required scope: environment-api:activegates:read Required permission: environment:roles:manage-settings
Parameters​
Name | Type | Description |
---|---|---|
config.agId*required | string | The ID of the required ActiveGate. |
Returns​
Return type | Status code | Description |
---|---|---|
ActiveGateAutoUpdateConfig | 200 | Success |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Not found. See response body for details. | Client side error. | Server side error. |
Code example
import { activeGatesAutoUpdateConfigurationClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await activeGatesAutoUpdateConfigurationClient.getAutoUpdateConfigById(
{ agId: "..." },
);
getGlobalAutoUpdateConfigForTenant​
Gets the global auto-update configuration of environment ActiveGates.
Required scope: environment-api:activegates:read Required permission: environment:roles:manage-settings
Returns​
Return type | Status code | Description |
---|---|---|
ActiveGateGlobalAutoUpdateConfig | 200 | Success |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Client side error. | Server side error. |
Code example
import { activeGatesAutoUpdateConfigurationClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await activeGatesAutoUpdateConfigurationClient.getGlobalAutoUpdateConfigForTenant();
putAutoUpdateConfigById​
Updates the configuration of auto-update for the specified ActiveGate
Required scope: environment-api:activegates:write Required permission: environment:roles:manage-settings
Parameters​
Name | Type | Description |
---|---|---|
config.agId*required | string | The ID of the required ActiveGate. |
config.body*required | ActiveGateAutoUpdateConfig |
Returns​
Return type | Status code | Description |
---|---|---|
void | 204 | Success. The auto-update configuration have been updated. Response doesn't have a body. |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Failed. The input is invalid. | Client side error. | Server side error. |
Code example
import { activeGatesAutoUpdateConfigurationClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await activeGatesAutoUpdateConfigurationClient.putAutoUpdateConfigById(
{
agId: "...",
body: {
setting:
ActiveGateAutoUpdateConfigSetting.Inherited,
},
},
);
putGlobalAutoUpdateConfigForTenant​
Puts the global auto-update configuration of environment ActiveGates.
Required scope: environment-api:activegates:write Required permission: environment:roles:manage-settings
Parameters​
Name | Type |
---|---|
config.body*required | ActiveGateGlobalAutoUpdateConfig |
Returns​
Return type | Status code | Description |
---|---|---|
void | 204 | Success. The global auto-update configuration have been updated. Response doesn't have a body. |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Failed. The input is invalid. | Client side error. | Server side error. |
Code example
import { activeGatesAutoUpdateConfigurationClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await activeGatesAutoUpdateConfigurationClient.putGlobalAutoUpdateConfigForTenant(
{
body: {
globalSetting:
ActiveGateGlobalAutoUpdateConfigGlobalSetting.Enabled,
},
},
);
validateAutoUpdateConfigById​
Validates the payload for the POST /activeGates/{agId}/autoUpdate
request.
Required scope: environment-api:activegates:write Required permission: environment:roles:manage-settings
Parameters​
Name | Type | Description |
---|---|---|
config.agId*required | string | The ID of the required ActiveGate. |
config.body*required | ActiveGateAutoUpdateConfig |
Returns​
Return type | Status code | Description |
---|---|---|
void | 204 | Validated. The submitted auto-update configuration is valid. Response doesn't have a body. |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Failed. The input is invalid. | Client side error. | Server side error. |
Code example
import { activeGatesAutoUpdateConfigurationClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await activeGatesAutoUpdateConfigurationClient.validateAutoUpdateConfigById(
{
agId: "...",
body: {
setting:
ActiveGateAutoUpdateConfigSetting.Inherited,
},
},
);
validateGlobalAutoUpdateConfigForTenant​
Validates the payload for the POST /activeGates/autoUpdate
request.
Required scope: environment-api:activegates:write Required permission: environment:roles:manage-settings
Parameters​
Name | Type |
---|---|
config.body*required | ActiveGateGlobalAutoUpdateConfig |
Returns​
Return type | Status code | Description |
---|---|---|
void | 204 | Validated. The submitted configuration is valid. Response doesn't have a body. |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Failed. The input is invalid. | Client side error. | Server side error. |
Code example
import { activeGatesAutoUpdateConfigurationClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await activeGatesAutoUpdateConfigurationClient.validateGlobalAutoUpdateConfigForTenant(
{
body: {
globalSetting:
ActiveGateGlobalAutoUpdateConfigGlobalSetting.Enabled,
},
},
);
activeGatesAutoUpdateJobsClient​
import { activeGatesAutoUpdateJobsClient } from '@dynatrace-sdk/client-classic-environment-v2';
createUpdateJobForAg​
Creates a new update job for the specified ActiveGate
Required scope: environment-api:activegates:write Required permission: environment:roles:manage-settings
Parameters​
Name | Type | Description |
---|---|---|
config.agId*required | string | The ID of the required ActiveGate. |
config.body*required | UpdateJob |
Returns​
Return type | Status code | Description |
---|---|---|
UpdateJob | 201 | Success. The update-job have been created. |
Throws​
Error Type | Error Message |
---|---|
ErrorEnvelopeError | Failed. The input is invalid. | Client side error. | Server side error. |
Code example
import { activeGatesAutoUpdateJobsClient } from "@dynatrace-sdk/client-classic-environment-v2";
const data =
await activeGatesAutoUpdateJobsClient.createUpdateJobForAg(
{
agId: "...",
body: { targetVersion: "1.190.0.20200301-130000" },
},
);
deleteUpdateJobByJobIdForAg​
Deletes the specified update job
Required scope: environment-api:activegates:write Required permission: environment:roles:manage-settings
Parameters​
Name | Type | Description |
---|---|---|
config.agId*required | string | The ID of the required ActiveGate. |
config.jobId*required | string | A unique identifier for a update-job of ActiveGate. |
Returns​
Return type | Status code | Description |
---|---|---|
void | 204 | Success. The update-job have been deleted. Response doesn't have a body. |