Bootstrap FreeKB - Venafi (Certificate Management) - Delete a credential using REST API
Venafi (Certificate Management) - Delete a credential using REST API


This assumes you have already obtained a Bearer Token using curl.

AVOID TROUBLE

In order to delete a credential, you will need to have the security:manage scope when obtaining a Bearer Token using curl.

Before deleting a credential, you will probably want to determine if the credential exists. In this example, the following command is used to determine if the "foo" credential exists.

curl
--insecure
--request POST
--header "Authorization: Bearer abc123"
--header "Content-Type: application/json"
--data '{ "CredentialPath": "\\VED\\Policy\\Credentials\\foo" }'
--url https://tpp.example.com/vedsdk/Credentials/Retrieve

 

If the credential does not exist, the following should be returned.

{
    "Result": 400
}

 

If the credential exists, something like this should be returned. In this example, the "foo" credential exists. Be aware that "Password" is always returned, instead of the actual password.

{
    "Classname": "Password Credential",
    "Description": "Example Description",
    "Expiration": "/Date(1894637754000-0600)/",
    "FriendlyName": "Password",
    "Result": 1000,
    "Values": [
        {
            "Name": "Password"
        }
    ]
}

 

And here is how you would delete the "foo" credential.

curl
--insecure
--request POST
--header "Authorization: Bearer abc123"
--header "Content-Type: application/json"
--data '{ "CredentialPath": "\\VED\\Policy\\Credentials\\foo" }'
--url https://tpp.example.com/vedsdk/Credentials/Delete

 

If the credential is deleted, the following should be returned.

{
  "Result":1
}

 

If the credential is not deleted, such as when the credential does not exist, the following should be returned.

{
  "Result":400
}

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 011541 in the box below so that we can be sure you are a human.