Example 8: Username 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: Password, Type:string and Value that is the account password.
Example: Create a User Credential
Request
POST https://tpp.venafi.example/vedsdk/Credentials/Create
Authorization:Bearer 4MyGeneratedBearerTknz==
{ "CredentialPath":"\\VED\\Policy\\Top Level\\MyUsernameCred1", "FriendlyName":"UsernamePassword", "Expiration":"\/Date(1716122248657)\/", "Values":[ { "Name":"Username", "Type":"string", "Value":"service-account" }, { "Name":"Password", "Type":"string", "Value":"Str0ngP@ssw0rd!" } ] }
Response
HTTP/1.1 200 OK { "Result":1 }