To work with encryption certificates, execute requests using the "certificates" API method (determine administrator token before executing the request):
Add a certificate:
curl -v -X POST "<IP address or DNS sever name>/api/v2/security/certificates/" --header "accept: application/json" -H "Authorization: Bearer <administrator token>" -F 'certificate=@<absolute path to certificate file>/<certificate file name>.crt' -F 'name=<certificate name>'
The example of response:
{
"id":3,
"name":"name_certificate"
}
Get list of added certificates:
curl -v '<IP address or DNS server name>/api/v2/security/certificates/' --header 'Content-Type: application/json' -H 'Authorization: Bearer <administrator token>'
The example of response:
{
"results": [
{
"id": 1,
"name": "cert",
"sha1_fingerprint": "7D:89:B2:04:12:1D:30:28:F4:8D:F5:26:B1:DD:65:00:75:6D:4B:86",
"not_before": "2022-06-06T11:34:30+03:00",
"not_after": "2023-06-06T11:34:30+03:00"
}
]
}
Delete certificate:
curl -X DELETE -v '<IP address or DNS server name>/api/v2/security/certificates/<certificate identifier>/' --header 'Content-Type: application/json' -H 'Authorization: Bearer <administrator token>'
In the <certificate identifier> substitution use value of the id parameter returned on getting the list of added certificates.
The example of response:
204
See also: