Synthetic locations API v2 - PUT a location

  • Reference
  • Published Jul 26, 2019
  • Private locations Updates an existing location.
  • Public locations Changes the status of an existing location.

The request consumes an application/json payload.

PUTManagedDynatrace for Governmenthttps://{your-domain}/e/{your-environment-id}/api/v2/synthetic/locations/{locationId}
Environment and Cluster ActiveGate (default port 9999)https://{your-activegate-domain}:9999/e/{your-environment-id}/api/v2/synthetic/locations/{locationId}

Authentication

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

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

Parameters

To find all model variations that depend on the type of the model, see JSON models.

ParameterTypeDescriptionInRequired
locationIdstring

The Dynatrace entity ID of the synthetic location to be updated.

pathRequired
bodySyntheticLocationUpdate

The JSON body of the request. Contains updated parameters of the location.

bodyRequired

Request body objects

The SyntheticLocationUpdate object

The synthetic location update. This is a base object, the exact type depends on the value of the type field.

ElementTypeDescriptionRequired
typestring

Defines the actual set of fields depending on the value. See one of the following objects:

  • PUBLIC -> SyntheticPublicLocationUpdate
  • PRIVATE -> SyntheticPrivateLocationUpdate
The element can hold these values
  • PRIVATE
  • PUBLIC
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.

{
"type": "PRIVATE"
}

Response

Response codes

CodeTypeDescription
204-

Success. The location has been updated. Response doesn't have a body.

4XXErrorEnvelope

Client side error.

5XXErrorEnvelope

Server side error.

Response body objects

The ErrorEnvelope object

ElementTypeDescription
errorError-

The Error object

ElementTypeDescription
codeinteger

The HTTP status code

constraintViolationsConstraintViolation[]

A list of constraint violations

messagestring

The error message

The ConstraintViolation object

A list of constraint violations

ElementTypeDescription
locationstring-
messagestring-
parameterLocationstring-
The element can hold these values
  • HEADER
  • PATH
  • PAYLOAD_BODY
  • QUERY
pathstring-

Response body JSON models

{
"error": {
"code": 1,
"constraintViolations": [
{
"location": "string",
"message": "string",
"parameterLocation": "HEADER",
"path": "string"
}
],
"message": "string"
}
}

Example - private location

In this example, the request updates the private synthetic location from the POST request example. It changes the name of the location to Linz and adds the synthetic node with the ID of 353074222.

The API token is passed in the Authorization header.

The response code of 204 indicates that the update was successful.

You can download or copy the example request body to try it out on your own. Be sure to replace the list of nodes with nodes available in your environment. You can fetch the list of available nodes with the GET all nodes request.

Curl

curl -L -X PUT 'https://mySampleEnv.live.dynatrace.com/api/v2/synthetic/locations/SYNTHETIC_LOCATION-493122BFA29674DC' \
-H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890' \
-H 'Content-Type: application/json' \
--data-raw '{
"type": "PRIVATE",
"name": "Linz",
"countryCode": "AT",
"regionCode": "04",
"city": "Linz",
"status": "ENABLED",
"latitude": 48.306351,
"longitude": 14.287399,
"nodes": [
"290433380",
"353074222"
],
"availabilityLocationOutage": false,
"availabilityNodeOutage": false,
"locationNodeOutageDelayInMillis": 5000
}
'

Request URL

https://mySampleEnv.live.dynatrace.com/api/v2/synthetic/locations/SYNTHETIC_LOCATION-493122BFA29674DC

Request body

{
"type": "PRIVATE",
"name": "Linz",
"countryCode": "AT",
"city": "Linz",
"status": "ENABLED",
"latitude": 48.306351,
"longitude": 14.287399,
"nodes": ["290433380", "353074222"],
"availabilityLocationOutage": false,
"availabilityNodeOutage": false,
"locationNodeOutageDelayInMillis": 5000
}

Response code

204

Example - public location

In this example, the request disables the public location with the ID of SYNTHETIC_LOCATION-0000000000000273.

The API token is passed in the Authorization header.

The response code of 204 indicates that the update was successful.

Curl

curl -L -X PUT 'https://mySampleEnv.live.dynatrace.com/api/v2/synthetic/locations/SYNTHETIC_LOCATION-0000000000000273' \
-H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890' \
-H 'Content-Type: application/json' \
--data-raw '{
"type": "PUBLIC",
"status": "DISABLED"
}
'

Request URL

https://mySampleEnv.live.dynatrace.com/api/v2/synthetic/locations/SYNTHETIC_LOCATION-0000000000000273

Request body

{
"type": "PUBLIC",
"status": "DISABLED"
}

Response code

204