Credential vault API - POST a set of credentials
Creates a new set of credentials for synthetic monitors.
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 credential vault entries (credentialVault.write
) permission assigned to your API token. To learn how to obtain and use it, see Tokens and authentication.
Parameters
Refer to JSON models to find all JSON models that depend on the type of the model.
Parameter | Type | Description | In | Required |
---|---|---|---|---|
body | Credentials |
The JSON body of the request. Contains parameters of the new credentials set. |
body | optional |
Body format
The Credentials object
A set of credentials for synthetic monitors.
Element | Type | Description | Required |
---|---|---|---|
name | string |
The name of the credentials set. |
required |
id | string |
The ID of the credentials set. |
optional |
description | string |
A short description of the credentials set. |
optional |
ownerAccessOnly | boolean |
The credentials set is available to every user ( |
optional |
scope | string |
The scope of the credentials set. |
required |
type | string |
Defines the actual set of fields depending on the value. See one of the following objects:
|
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.
{
"name": "Sample credentials",
"type": "USERNAME_PASSWORD",
"description": "Sample set of credentials for API documentation\n",
"user": "john.smith",
"password": "1234abcd",
"ownerAccessOnly": "true",
"scope": "SYNTHETIC"
}
Response
Response codes
Code | Description |
---|---|
201 | Success. The new credentials set has been created. The response contains the ID of the set. |
400 | Failed. The input is invalid. |
Response body
The CredentialsResponseElement object
Metadata of the credentials set.
Element | Type | Description |
---|---|---|
name | string | The name of the credentials set. |
id | string | The ID of the credentials set. |
type | string | The type of the credentials set. |
description | string | A short description of the credentials set. |
owner | string | The owner of the credential (user for which used API token was created). |
ownerAccessOnly | boolean | Flag indicating that this credential is visible only to the owner. |
scope | string | The scope of the credentials set. |
{
"name": "Sample username-password credentials",
"id": "CREDENTIALS_VAULT-C43F2C2E6395AD23",
"type": "USERNAME_PASSWORD",
"description": "Sample credentials for demo purposes.\n",
"owner": "user@domain.com",
"ownerAccessOnly": "true",
"scope": "SYNTHETIC"
}
Example
In this example, the request creates a new set of credentials of the USERNAME_PASSWORD type. The username of the credentials set is john.smith and the password is abcd1234.
The API token is passed in the Authorization header.
You can download or copy the example request body to try it out on your own.
Curl
curl -X POST \
https://mySampleEnv.live.dynatrace.com/api/config/v1/credentials/ \
-H 'Authorization: Api-token abcdefjhij1234567890' \
-H 'Content-Type: application/json' \
-d '{
"name": "RESTtest",
"description": "Test credentials",
"password": "abcd1234",
"ownerAccessOnly": true,
"type": "USERNAME_PASSWORD",
"certificate": "john.smith"
}'
Request URL
https://mySampleEnv.live.dynatrace.com/api/config/v1/credentials/
Request body
{
"name": "RESTtest",
"description": "Test credentials",
"password": "abcd1234",
"ownerAccessOnly": true,
"type": "USERNAME_PASSWORD",
"user": "john.smith"
}
Response body
{
"id": "CREDENTIALS_VAULT-1E6EA5075AF7E85D"
}
Response code
200