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.
This request is an Early Adopter release and may be changed in non-compatible way.
POST |
|
Authentication
To execute this request, you need the Write configuration (WriteConfig
) permission assigned to your API token. 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 the Dynatrace server.
Parameter | Type | Description | In | Required |
---|---|---|---|---|
body | RemoteEnvironmentConfigDto |
The JSON body of the request. Contains parameters of the new remote environment configuration. |
body | optional |
Body format
The RemoteEnvironmentConfigDto object
Element | Type | Description | Required |
---|---|---|---|
networkScope | string |
The network scope of the remote environment:
Dynatrace SaaS can only use If not set, |
optional |
id | string |
The ID of the configuration. |
optional |
displayName | string |
The display name of the remote environment. |
required |
uri | string |
The URI of the remote environment. |
required |
token | string |
The API token granting access to the remote environment. The token must have the Fetch data from a remote environment ( For security reasons, GET requests return this field as |
optional |
This is a model of the request body, showing the possible elements. It has to be adjusted for usage in an actual request. See the Example expandable section for working sample request.
{
"networkScope": "EXTERNAL",
"id": "string",
"displayName": "string",
"uri": "string",
"token": "string"
}
Response
Response codes
Code | Description |
---|---|
201 | Success. A new remote environment configuration has been created. The response contains the ID of the new configuration. |
400 | Failed. The input is invalid. |
Response body
The RemoteEnvironmentConfigStub object
The short representation of a remote environment.
Element | Type | Description |
---|---|---|
networkScope | string | The network scope of the remote environment:
Dynatrace SaaS can only use If not set, |
name | string | |
id | string | |
uri | string | The display name of the remote environment. |
{
"networkScope": "CLUSTER",
"name": "string",
"id": "string",
"uri": "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.
This request is an Early Adopter release and may be changed in non-compatible way.
POST |
|
Authentication
To execute this request, you need the Write configuration (WriteConfig
) permission assigned to your API token. To learn how to obtain and use it, see Tokens and authentication.
Response
Response codes
Code | Description |
---|---|
204 | Validated. The submitted configuration is valid. Response doesn't have a body |
400 | Failed. The input is invalid. |
Response body
A successful request doesn't return any content.
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
curl -X POST \
https://mySampleEnv.live.dynatrace.com/api/config/v1/remoteEnvironments/ \
-H 'Accept: application/json' \
-H 'Authorization: Api-token abcdefjhij1234567890' \
-H 'Content-Type: application/json' \
-d '{
"displayName": "Pre-Production",
"uri": "https://preProd.live.dynatrace.com",
"token": "1234567890abcdefjhij",
"networkScope": "EXTERNAL"
}
'
Request URL
https://mySampleEnv.live.dynatrace.com/api/config/v1/remoteEnvironments/
Request body
{
"displayName": "Pre-Production",
"uri": "https://PreProd.live.dynatrace.com",
"token": "1234567890abcdefjhij",
"networkScope": "INTERNAL"
}
Response body
{
"id": "c89b9d9f-8c59-4c5b-b7ef-1a082d11e9ba",
"name": "Pre-Production",
"uri": "https://preProd.live.dynatrace.com",
"networkScope": "EXTERNAL"
}
Response code
201