Example 4: Provisioning
This example shows you how to call POST Certificates/Request, to immediately provision the certificate in four different formats (GSK, JKS, PEM, and PKCS#12) to the same device. During provisioning, Trust Protection Platform creates and uses an agent to install a new certificate on a device. For more information, see Certificates/Request Applications parameters for provisioning.
Example 4: Create Device objects, Application objects and Provision all in one API call
Request for Example 4
POST https://tpp.venafi.example/vedsdk/Certificates/Request Authorization:Bearer 4MyGeneratedBearerTknz== { "PolicyDN":"\\VED\\Policy\\Certificates", "CADN":"\\VED\\Policy\\CATemplates\\mscaTemplate", "ObjectName":"provisioning-by-api.venafi.example", "Subject":"provisioning-by-api.venafi.example", "SubjectAltNames":[ { "TypeName":"DNS", "Name":"gsk.venafi.example" }, { "TypeName":"DNS", "Name":"jks.venafi.example" }, { "TypeName":"DNS", "Name":"pem.venafi.example" }, { "TypeName":"DNS", "Name":"p12.venafi.example" }, { "TypeName":"IPAddress", "Name":"192.168.1.100" } ], "ManagementType":"Provisioning", "SetWorkToDo":true, "Devices":[ { "PolicyDN":"\\VED\\Policy\\Endpoints", "ObjectName":"LINUX", "Host":"192.168.1.100", "CredentialDN":"\\VED\\Policy\\Credentials\\root-passw0rd", "Applications":[ { "ObjectName":"GSK", "Class":"GSK", "DriverName":"appgsk", "ClassSpecificAttributes":[ { "Name":"Certificate Label", "Value":"miami" }, { "Name":"Key Store", "Value":"/opt/pki/miami.kdb" }, { "Name":"Key Store Credential", "Value":"\\VED\\Policy\\Credentials\\!omepassw0rd" }, { "Name":"Store Type", "Value":"CMS" }, { "Name":"Version", "Value":"GSK 8.0" } ] }, { "ObjectName":"JKS", "Class":"JKS", "DriverName":"appjks", "ClassSpecificAttributes":[ { "Name":"Certificate Label", "Value":"miami" }, { "Name":"Key Store", "Value":"/opt/pki/miami.jks" }, { "Name":"Key Store Credential", "Value":"\\VED\\Policy\\Credentials\\passw0rd" }, { "Name":"Private Key Password Credential", "Value":"\\VED\\Policy\\Credentials\\passw0rd" }, { "Name":"Version", "Value":"Java 1.8" } ] }, { "ObjectName":"PEM", "Class":"PEM", "DriverName":"apppem", "ClassSpecificAttributes":[ { "Name":"Certificate File", "Value":"/opt/pki/miami.crt" }, { "Name":"Private Key File", "Value":"/opt/pki/miami.key" }, { "Name":"Certificate Chain File", "Value":"/opt/pki/miami.chain" } ] }, { "ObjectName":"P12", "Class":"PKCS#12", "DriverName":"apppkcs12", "ClassSpecificAttributes":[ { "Name":"Certificate File", "Value":"/opt/pki/miami.p12" }, { "Name":"Friendly Name", "Value":"miami" }, { "Name":"Private Key Password Credential", "Value":"\\VED\\Policy\\Credentials\\passw0rd" } ] } ] } ] }
Response for Example 4
HTTP/1.1 200 OK { "CertificateDN": "\\VED\\Policy\\Certificates\\provisioning-by-api.venafi.example", "Devices": [ { "Applications": [ { "DN": "\\VED\\Policy\\Certificates\\LINUX\\GSK" }, { "DN": "\\VED\\Policy\\Certificates\\LINUX\\JKS" }, { "DN": "\\VED\\Policy\\Certificates\\LINUX\\PEM" }, { "DN": "\\VED\\Policy\\Certificates\\LINUX\\P12" } ], "DN": "\\VED\\Policy\\Certificates\\LINUX" } ], "Guid": "{2298e794-a1f8-404b-ae12-bd7bf0f28872}" }