This API call updates the specified Dynatrace Cluster token. You can:
To execute this request, you need the Cluster token management (ClusterTokenManagement) permission assigned to your API token. Generate your API token via Cluster Management Console (CMC). To learn how to obtain and use it, see Cluster API - Authentication.
/api/cluster/v2/tokens
| Parameter | Type | Description | In | Required |
|---|---|---|---|---|
| id | string | The ID of the token to be updated. You can't update the token you're using for authentication of the request. | path | required |
| body | Update | The JSON body of the request. Contains updated parameters of the token. | body | required |
UpdateToken object| Element | Type | Description | Required |
|---|---|---|---|
| revoked | boolean | The token is revoked ( | optional |
| name | string | The name of the token. | optional |
| scopes | string[] | The list of permissions assigned to the token. Apart from the new permissions, you need to submit the existing permissions you want to keep, too. Any existing permission, missing in the payload, is revoked.
| optional |
This is a model of the request body, showing the possible elements. It has to be adjusted for usage in an actual request.
{"revoked": true,"name": "string","scopes": ["DiagnosticExport"]}
| Code | Type | Description |
|---|---|---|
| 204 | - | Success. The token has been updated. |
| 400 | Error | Failed. You can't update the token you're using for authentication of the request. |
| 404 | Error | Failed. The requested token has not been found. |
In this example, the request queries the metadata of the specific token, which has the ID of 4e9f128e-04f9-4795-pj319-8b7c-3c14a5e885e4. It changes the token scope by updating the token metadata. The name and validity of the token remain intact. The response code of 204 indicates that the update was successful.
curl -X PUT "https://myManaged.cluster.com/api/cluster/v2/tokens/4e9f128e-04f9-4795-pj319-8b7c-3c14a5e885e4"-H "accept: application/json; charset=utf-8"-H "Content-Type: application/json; charset=utf-8"-d "{ \"revoked\": \"true\", \"name\": \"updated token\", \"scopes\": [ \"UnattendedInstall\" ]}"
https://myManaged.cluster.com/api/cluster/v2/tokens/4e9f128e-04f9-4795-pj319-8b7c-3c14a5e885e4
{"revoked": "true","name": "updated token","scopes": ["UnattendedInstall"]}
204