Example: Getting and deleting certificates using REST APIs
Getting a list of all certificates
Method and URI:
GET "https://192.0.2.5/rest/v1/certificates"
Example curl command:
$ curl --noproxy "192.0.2.5" -k GET \
-b /tmp/auth_cookie \
"https://192.0.2.5/rest/v1/certificates”
On successful completion, the switch returns response code 200 OK and a response body containing the certificate resource URLs indexed by the certificate name. For example:
{
"my-cert-1": "/rest/v1/certificates/my-cert-1",
"my-cert-2": "/rest/v1/certificates/my-cert-2"
}
Getting a certificate
Method and URI:
GET "https://192.0.2.5/rest/v1/certificates/my-cert-2"
Example curl command:
$ curl --noproxy "192.0.2.5" -k GET \
-b /tmp/auth_cookie \
"https://192.0.2.5/rest/v1/certificates/my-cert-2"
On successful completion, the switch returns response code 200 OK and a response body containing the certificate.
For example:
'{
"cert_name": "my-cert-2",
"cert_type": "regular"
"cert_status": "csr_pending",
"key_type": "RSA",
"key_size": 2048,
"subject": {
"common_name": "CX-8400",
"country": "US",
"locality: "el camino",
"state": "CA",
"org": "HPE",
"org_unit": "Aruba"
},
"certificate": "<certificate-in-PEM-format>"
}'
Deleting a certificate
Method and URI:
DELETE "https://192.0.2.5/rest/v1/certificates/my-cert-3"
Example curl command:
$ curl --noproxy "192.0.2.5" -k -X DELETE \
-b /tmp/auth_cookie \
"https://192.0.2.5/rest/v1/certificates/my-cert-3"
On successful completion, the switch returns response code 204.