Example 3: Enroll a certificate and include Custom Field values

This example shows you how POST Certificates/Request can enroll a certificate with Custom Field values on a Certificate object. When you try this example:

TIP  Because the response only shows the first missing Custom Field, always call POST Metadata/GetItems and get information about required fields. Pass all required fields. Make sure the request complies with any policy tree requirements.

If you just added or changed a Custom Field definition, wait a few minutes for the database to update. Then, make the Certificates/Request call with your Custom Field values.

Example 3: Set Custom Fields while enrolling a certificate

Request for Example 3

POST https://tpp.venafi.example/vedsdk/Certificates/Request
Authorization:Bearer 4MyGeneratedBearerTknz==
{
   "PolicyDN":"\\VED\\Policy\\Certificates",
   "CADN":"\\VED\\Policy\\CATemplates\\mscaTemplate",
   "ObjectName":"test_certificate",
   "Subject":"test_subject",
   "SubjectAltNames":[
      {
         "TypeName":"DNS",
         "Type":2,
         "Name":"venafi.com"
      }
   ],
   "CustomFields":[
      {
         "Name":"Date Required",
         "Values":[
            "2019-08-19"
         ]
      },
      {
         "Name":"List of Cost Centers",
         "Values":[
            "NW Region"
         ]
      },
      {
         "Name":"Backup Approver",
         "Values":[
            "AD+venqa:85e3ce9bec25b34780ebfd85a4d73451}"
         ]
      },
      {
         "Name":"Comments",
         "Values":[
            "Production"
         ]
      }
   ]
}

Response for Example 3

HTTP/1.1 200 OK
{
   "CertificateDN":"\\VED\\Policy\\Certificates\\test_certificate",
   "Guid":"{98486494-20e5-432b-99a1-dfff3fe31347}"
}