Example: Generating a self-signed certificate using REST APIs
下面的示例生成一个自签名证书ificate.
Example method and URI:
POST "https://192.0.2.5/rest/v10.04/certificates"
Example 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.