ActiveGate tokens API - POST a token
Creates a new ActiveGate token.
The token will be owned by the user who owns the token used to authenticate the call.
The request consumes and produces an application/json
payload.
POST | SaaS | https://{your-environment-id}.live.dynatrace.com/api/v2/activeGateTokens |
Environment ActiveGateCluster ActiveGate | https://{your-activegate-domain}:9999/e/{your-environment-id}/api/v2/activeGateTokens |
Authentication
To execute this request, you need an access token with one of the following scopes:
activeGateTokenManagement.create
activeGateTokenManagement.write
To learn how to obtain and use it, see Tokens and authentication.
Parameters
The JSON body of the request. Contains parameters of the new ActiveGate token.
Request body objects
The ActiveGateTokenCreate
object
Parameters of a new ActiveGate token.
The type of the ActiveGate for which the token is valid.
ENVIRONMENT
CLUSTER
The expiration date of the token.
You can use one of the following formats:
- Timestamp in UTC milliseconds.
- Human-readable format of
2021-01-25T05:57:01.123+01:00
. If no time zone is specified, UTC is used. You can use a space character instead of theT
. Seconds and fractions of a second are optional. - Relative timeframe, back from now. The format is
now-NU/A
, whereN
is the amount of time,U
is the unit of time, andA
is an alignment. The alignment rounds all the smaller values to the nearest zero in the past. For example,now-1y/w
is one year back, aligned by a week. You can also specify relative timeframe without an alignment:now-NU
. Supported time units for the relative timeframe are:m
: minutesh
: hoursd
: daysw
: weeksM
: monthsy
: years
If not set, the token never expires.
Ensure that it is not set in the past and does not exceed 2 years
from the moment of creation."
The name of the token.
The token is a seed token (true
) or an individual token (false
).
We recommend the individual token option (false).
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.
{"activeGateType": "ENVIRONMENT","expirationDate": "now+6M","name": "myToken","seedToken": false}
Response
Response codes
Success. The token has been created. The body of the response contains the token secret.
Response body objects
The ActiveGateTokenCreated
object
The newly created ActiveGate token.
The token expiration date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
).
The secret of the token.
Response body JSON model
{"expirationDate": "2020-11-24T08:15:30.144Z","id": "dt0g02.4KWZO5EF","token": "dt0g02.4KWZO5EF.XT47R5DRADJIZUFOX4UDNOKTSUSABGLN7XSMJG7UXHRXKNY4WLORH4OF4T75MG7E"}
Example
In this example, the request creates a new ActiveGate token for an environment ActiveGate. The token is valid for two weeks (14 days) from the moment of creation.
The API token is passed in the Authorization header.
Curl
curl --request GET \--url https://mySampleEnv.live.dynatrace.com//api/v2/activeGateTokens \--header 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890' \--header 'Content-Type: application/json' \--data '{"name": "REST test","expirationDate": "now+14d","seedToken": false,"activeGateType": "ENVIRONMENT"}'
Request URL
https://mySampleEnv.live.dynatrace.com//api/v2/activeGateTokens
Request body
{"name": "REST test","expirationDate": "now+14d","seedToken": false,"activeGateType": "ENVIRONMENT"}
Response body
{"id": "dt0g02.xyz789","token": "dt0g02.xyz789.987654321zyxwvutsrq","expirationDate": "2021-12-14T13:42:31.148Z"}
Response code
201