Example 7: Private key credential
This example shows you how to call POST Credentials/Create.
TIP Know your CA's requirements for credentials. Remember that you are adding credentials as is. Always validate the Credential object. The best way to check is to create a CA Template in the UI and apply your credential. If an error occurs, correct the credential, and retry.
The Values array needs these elements:
- Name: Username, Type:string and Value that is the account name.
- Name: Key, Type:byte[] and Value that is private key.
Example: Create a Private Key Credential
Request
POST https://tpp.venafi.example/vedsdk/Credentials/Create Authorization:Bearer 4MyGeneratedBearerTknz=={ "CredentialPath":"\\VED\\Policy\\Top Level\\SSHCredential3", "FriendlyName":"PrivateKey", "Expiration":"\/Date(1716122248657)\/", "Values":[ { "Name":"Username", "Type":"string", "Value":"ssh-account" }, { "Name":"Key", "Type":"byte[]", "Value":"MIIBVgIBACfq/uEOb..." } ] }
Response
HTTP/1.1 200 OK { "Result":1 }