Example: Generating a self-signed certificate using REST APIs
The following example generates a self-signed certificate.
Method and URI:
POST "https://192.0.2.5/rest/v10.04/certificates"
Request body:
{
"certificate_name": "my-cert-1",
"subject": {
"country": "US",
"state": "CA",
"org": "HPE",
"org_unit": "Aruba",
"common_name": "CX-8400"},
"key_type": "RSA",
"key_size": 2048,
"cert_type": "self-signed"
}
Example curl command:
$ curl --noproxy "192.0.2.5" -k -X POST \
-b /tmp/auth_cookie \
"https://192.0.2.5/rest/v10.04/certificates” –d '
{
"certificate_name": "my-cert-1",
"subject": {
"country": "US",
"state": "CA",
"org": "HPE",
"org_unit": "Aruba",
"common_name": "CX-8400"},
"key_type": "RSA",
"key_size": 2048,
"cert_type": "self-signed"
}'
On successful completion, the switch returns response code 201 Created.