When I first start working with an API, I aim for low-hanging fruit. REST APIs, by nature, should be very generic in how they’re interacted with; however, there’s usually small nuances to take into consideration. For example, I recently found out that the VMware Cloud on AWS API uses a csp-auth-token header for authentication and authorization.
While authorization and authentication to the VCF API was straightforward (SDDC Manager username and password), I struggled the first time with POSTing a new VMware license due the API requiring a specific format for productType.
When I explored the API, I saw examples for NSXV and VCENTER but didn’t find other productTypes in the License Keys section (2.6).
Instead, the valid productTypes are only referenced in section 3.54.7 which is an example HTTP request:
{
"description" : "string",
"id" : "string",
"isUnlimited" : true,
"key" : "4M2VN-9RKEN-J80TU-0T222-98QP2",
"licenseKeyUsage" : {
"licenseUnit" : "One among: CPUPACKAGE, INSTANCE, VMS, CCU, PLU, DESKTOPVM, SERVERVM, VM, SERVER, CORES, CONCURRENTUSER, NAMEDUSER",
"remaining" : 0,
"total" : 0,
"used" : 0
},
"licenseKeyValidity" : {
"expiryDate" : {
"epochSecond" : 0,
"nano" : 0
},
"licenseKeyStatus" : "One among: EXPIRED, ACTIVE, NEVER_EXPIRES"
},
"productType" : "One among: VCENTER, VSAN, NSXV, SDDC_MANAGER, ESXI, VRA, VROPS, NSXT"
}
As you can see, the valid productTypes for license keys are:
- VCENTER
- VSAN
- NSXV
- NSXT
- SDDC_MANAGER
- ESXI
- VRA
- VROPS
I hope this information has been helpful if you’re trying to add license keys to VCF through the API. I am submitting feedback to product management to make this more prominent.