Summary:
List, create, edit or remove credentials on a server. Applicable to Enuity v19.0 upwards.
URL:
http(s)://{server hostname}/api/credential
Methods summary
- GET Method - lists credentials.
- POST Method - creates a new credential.
- PUT Method - edit a credential.
- DELETE Method - remove a credential.
GET Method detail
Lists credentials on a server.
Response:
Response includes a list of credentials. Each credential has the following attributes.
Examples:
INPUT
curl -u admin:admin -k https://localhost/api/credential?media=json
OUTPUT
{
"items" : [ {
"id" : 1,
"deviceId" : 0,
"kind" : "SHARED",
"name" : "Public modified",
"description" : "modified",
"attributes" : {
"SnmpV12Attributes" : {
"community" : "*******",
"writeCommunity" : "*******",
}
}
} ],
"count" : 1
}
INPUT
curl -u admin:admin https://localhost/api/credential?media=xml
OUTPUT
{
"items" : [ {
"id" : 18,
"deviceId" : 0,
"kind" : "SHARED",
"name" : "Credential 1",
"description" : "This is a credential",
"attributes" : {
"SnmpV2Attributes" : {
"community" : "*******",
"writeCommunity" : "*******"
}
}
}, {
"id" : 19,
"deviceId" : 0,
"kind" : "SHARED",
"name" : "Credential 2",
"description" : "This is also a credential",
"attributes" : {
"SshAttributes" : {
"username" : "admin",
"password" : "*******",
"sshKey" : "*******"
}
}
}, {
"id" : 20,
"deviceId" : 0,
"kind" : "SHARED",
"name" : "Third Cred",
"description" : "Cred number 3",
"attributes" : {
"NaviSecAttributes" : {
"scope" : "GLOBAL",
"username" : "admin",
"password" : "*******"
}
}
} ],
"count" : 3
}
POST Method detail
Creates a new credential. The user must know the type of credential required. Entuity supports several types of credential and each has different attributes, which is also applicable to the PUT Method.
Request:
SnmpV1Attributes; SnmpV2Attributes; SnmpV12Attributes:
Name | Description |
---|---|
community |
Community string. |
writeCommunity | Write community string. |
SnmpV3Attributes:
Name | Description |
---|---|
username |
V3 username. |
authType |
Supported types:
|
authPassword |
Authentication password. |
encryptionType |
Supported types:
|
encryptionPassword | Encryption password. |
context | optional V3 context. |
CLiAccessAttributes (Config Management credential):
Name | Description |
---|---|
method |
Supported types are:
|
port | The port to connect. |
username |
Username if required. |
password1 | Optional password one. |
password2 | Optional password two. |
UserAndPasswordAttributes:
Name | Description |
---|---|
username |
Username. |
password | password. |
SshAttributes:
Name | Description |
---|---|
username |
Username. |
password | password. |
sshKey |
SSH key. Only one of the password or SSH key must be specified. |
NaviSecAttributes:
Name | Description |
---|---|
scope |
Supported scopes are:
|
username | connection username. |
password |
connection password. |
AzureAttributes:
Name | Description |
---|---|
clientId |
Unique client identity. |
secretKey | Azure vault secret key. |
tenantId |
Tenant identity (GUID). |
AwsAttributes:
Name | Description |
---|---|
accessKey |
Access Key. |
secretKey | Secret Key. |
ApiKeyAttributes:
Name | Description |
---|---|
key |
Meraki access key. |
Response:
The list of credentials after an update, as GET method would return them.
Examples:
1. Creating an SNMPv1 credential.
INPUT
curl -u admin:admin -k https://localhost/api/credential?media=json -X "POST" -H "content-type:application/json" -d
'{
"name":"0: RestAPI Test-With Description",
"description":"Test description",
"attributes":{
"SnmpV1Attributes":{
"community":"public",
"writeCommunity":"write"
}
}
}'
OUTPUT
{
"id" : 3042,
"deviceId" : 0,
"kind" : "SHARED",
"name" : "0: RestAPI Test-With Description",
"description" : "Test description",
"attributes" : {
"SnmpV1Attributes" : {
"community" : "*******",
"writeCommunity" : "*******"
}
}
}
2. Creating a SSH credential.
INPUT
curl -u admin:admin -k https://localhost/api/credential?media=json -X "POST" -H "content-type:application/json" -d
'{
"name":"178: RestAPI Test SSH-With Description",
"description":"Test description with SSH",
"attributes":{
"CliAccessAttributes":{
"method":"SSH",
"port":"22",
"username":"test",
"password1":"test!test",
"password2":"test!test"
}
}
}'
OUTPUT
{
"id" : 449,
"deviceId" : 0,
"kind" : "SHARED",
"name" : "178: RestAPI Test SSH-With Description",
"description" : "Test description with SSH",
"attributes" : {
"CliAccessAttributes" : {
"method" : "SSH",
"port" : 22,
"username" : "test",
"password1" : "*******",
"password2" : "*******"
}
}
}
3. Creating a V3 credential.
INPUT
curl -u admin:admin -k https://localhost/api/credential?media=json -X "POST" -H "content-type:application/json" -d
'{
"name":"4: RestAPI Test NONE-NONE No Auth/Encr Pass-With Description",
"description":"Test description NONE-NONE",
"attributes":{
"SnmpV3Attributes":{
"username":"test",
"authType":"NONE",
"authPassword":"",
"encryptionType":"NONE","encryptionPassword":""
}
}
}'
OUTPUT
{
"id" : 108,
"deviceId" : 0,
"kind" : "SHARED",
"name" : "4: RestAPI Test NONE-NONE No Auth/Encr Pass-With Description",
"description" : "Test description NONE-NONE",
"attributes" : {
"SnmpV3Attributes" : {
"username" : "test",
"authType" : "NONE",
"authPassword" : "*******",
"encryptionType" : "NONE",
"encryptionPassword" : "*******"
}
}
}
4. Creating a CLI credential.
INPUT
curl -u admin:admin -k https://localhost/api/credential?media=json -X "POST" -H "content-type:application/json" -d
'{
"name":"181: RestAPI Test SSH No Port-Dupe",
"attributes":{
"CliAccessAttributes":{
"method":"SSH",
"port":"",
"username":"test no port",
"password1":"test",
"password2":"test"
}
}
}'
OUTPUT
{
"id" : 464,
"deviceId" : 0,
"kind" : "SHARED",
"name" : "181: RestAPI Test SSH No Port-Dupe",
"attributes" : {
"CliAccessAttributes" : {
"method" : "SSH",
"port" : 0,
"username" : "test no port",
"password1" : "*******",
"password2" : "*******"
}
}
}
PUT Method detail
Modifies parameters of the credential. Entuity supports several types of credential and each has different attributes - please see the POST Method section above for the full list.
Response:
Detailed information about the credential after changes, as GET Method above would return it.
Examples:
Where <ID> is the credential ID. Users need only specify the attributes that are to be modified.
INPUT
curl -u admin:admin -k https://localhost/api/credential?media=json -X "PUT" -H "content-type:application/json" -d
'{
"name" : "0: RestAPI Test-With Description modified"
}'
"https://localhost/api/credential/3042?media=json"
OUTPUT
{
"id" : 3042,
"deviceId" : 0,
"kind" : "SHARED",
"name" : "0: RestAPI Test-With Description modified"
}
INPUT
curl -u admin:admin -k https://localhost/api/credential?media=json -X "PUT" -H "content-type:application/json" -d
'{
"attributes" : {
"SnmpV1Attributes" : {
"community" : "new_value_test"
}
}
}'
OUTPUT
{
"id" : 3515,
"deviceId" : 0,
"kind" : "SHARED",
"attributes" : {
"SnmpV1Attributes" : {
"community" : "*******",
"writeCommunity" : "*******"
}
}
}
DELETE Method detail
Deletes a credential.
Response:
The current list of credentials, as the GET method would return it.
Example:
Where <ID> is the credential ID.
INPUT
curl -u admin:admin -k https://localhost/api/credential/147?media=json -X "DELETE"
OUTPUT
{
"message" : "Deleted credential Id 147"
}
Comments
0 comments
Please sign in to leave a comment.