• Home
  • Dynatrace API
  • Configuration
  • Remote environments
  • POST a remote environment

Remote environments API - POST a remote environment configuration

Creates a new remote environment configuration.

Before creation, Dynatrace verifies the provided URI and token by trying to reach the environment using the token for authentication. If the attempt fails, no remote environment configuration is created.

The request consumes and produces an application/json payload.

POSTManagedDynatrace for Governmenthttps://{your-domain}/e/{your-environment-id}/api/config/v1/remoteEnvironments
SaaShttps://{your-environment-id}.live.dynatrace.com/api/config/v1/remoteEnvironments
Environment ActiveGatehttps://{your-activegate-domain}/e/{your-environment-id}/api/config/v1/remoteEnvironments

Authentication

To execute this request, you need an access token with WriteConfig scope.

To learn how to obtain and use it, see Tokens and authentication.

Parameters

The body must not provide an ID. An ID is assigned automatically by Dynatrace.

ParameterTypeDescriptionInRequired
bodyRemoteEnvironmentConfigDto

The JSON body of the request. Contains parameters of the new remote environment configuration.

bodyoptional

Request body objects

The RemoteEnvironmentConfigDto object

ElementTypeDescriptionRequired
networkScopestring

The network scope of the remote environment:

  • EXTERNAL: The remote environment is located in an another network.
  • INTERNAL: The remote environment is located in the same network.
  • CLUSTER: The remote environment is located in the same cluster.

Dynatrace SaaS can only use EXTERNAL.

If not set, EXTERNAL is used.

The element can hold these values
  • CLUSTER
  • EXTERNAL
  • INTERNAL
optional
displayNamestring

The display name of the remote environment.

required
uristring

The URI of the remote environment.

required
tokenstring

The API token granting access to the remote environment.

The token must have the Fetch data from a remote environment (RestRequestForwarding) scope.

For security reasons, GET requests return this field as null.

optional
idstring

The ID of the configuration.

optional

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
{ "networkScope": "EXTERNAL", "displayName": "string", "uri": "string", "token": "string", "id": "string" }

Response

Response codes

CodeTypeDescription
201RemoteEnvironmentConfigStub

Success. A new remote environment configuration has been created. The response contains the ID of the new configuration.

400ErrorEnvelope

Failed. The input is invalid.

Response body objects

The RemoteEnvironmentConfigStub object

The short representation of a remote environment.

ElementTypeDescription
networkScopestring

The network scope of the remote environment:

  • EXTERNAL: The remote environment is located in an another network.
  • INTERNAL: The remote environment is located in the same network.
  • CLUSTER: The remote environment is located in the same cluster.

Dynatrace SaaS can only use EXTERNAL.

If not set, EXTERNAL is used.

The element can hold these values
  • CLUSTER
  • EXTERNAL
  • INTERNAL
uristring

The display name of the remote environment.

namestring-
idstring-

Response body JSON model

json
{ "networkScope": "CLUSTER", "uri": "string", "name": "string", "id": "string" }

Validate payload

We recommend that you validate the payload before submitting it with an actual request. A response code of 204 indicates a valid payload.

The request consumes an application/json payload.

POSTManagedDynatrace for Governmenthttps://{your-domain}/e/{your-environment-id}/api/config/v1/remoteEnvironments/validator
SaaShttps://{your-environment-id}.live.dynatrace.com/api/config/v1/remoteEnvironments/validator
Environment ActiveGatehttps://{your-activegate-domain}/e/{your-environment-id}/api/config/v1/remoteEnvironments/validator

Authentication

To execute this request, you need an access token with WriteConfig scope.

To learn how to obtain and use it, see Tokens and authentication.

Response

Response codes

CodeTypeDescription
204

Validated. The submitted configuration is valid. Response doesn't have a body

400ErrorEnvelope

Failed. The input is invalid.

Example

In this example, the request creates a new remote environment configuration, referring to the Pre-Production environment.

The API token is passed in the Authorization header.

Curl

bash
curl -X POST \ https://mySampleEnv.live.dynatrace.com/api/config/v1/remoteEnvironments/ \ -H 'Accept: application/json' \ -H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890' \ -H 'Content-Type: application/json' \ -d '{ "displayName": "Pre-Production", "uri": "https://preProd.live.dynatrace.com", "token": "1234567890abcdefjhij", "networkScope": "EXTERNAL" } '

Request URL

plaintext
https://mySampleEnv.live.dynatrace.com/api/config/v1/remoteEnvironments/

Request body

json
{ "displayName": "Pre-Production", "uri": "https://PreProd.live.dynatrace.com", "token": "1234567890abcdefjhij", "networkScope": "INTERNAL" }

Response body

json
{ "id": "c89b9d9f-8c59-4c5b-b7ef-1a082d11e9ba", "name": "Pre-Production", "uri": "https://preProd.live.dynatrace.com", "networkScope": "EXTERNAL" }

Response code

201