Manage the TLS certificate of the web interface
The device serves its web interface and this API over HTTPS with a certificate stored on the device. Out of the box, and whenever the stored certificate is missing or invalid, a self-signed certificate is generated. An administrator can upload a certificate issued by a certificate authority or generate a new self-signed one. Either action takes effect immediately: the web server is restarted, so open browser sessions must reconnect.
Path: /api/ssl/import
Method: POST
Minimum user role: admin
Request body: multipart/form-data with two file parts, each at most 128 KiB:
certificate - the certificate in PEM formatkey - the matching private key in PEM format, RSA or EC, not password protectedRequirements checked before the pair is installed:
subjectAltName extension;extendedKeyUsage extension.Response on success (200 OK): {"message": "Successfully saved certificate and key", "data": null}
Response on failure:
{"message": "Both certificate and key fields must be present on multiform data.", "data": null} when a part is missing or the body is not multipart{ "response": "The size of the payload (<bytes>) is above the specified limit: 131072." } when a part exceeds 128 KiB{"message": "Provided certificate-key pair is invalid", "data": null} when any requirement above fails; the previous certificate stays in placeExample:
curl -k -X POST -H "authorization: <token>" -F "certificate=@server.crt" -F "key=@server.key" https://<ip-address>/api/ssl/import/api/ssl/generatePOSTadmin{"message": "Successfully generated new certificate", "data": null}{"message": "Could not generate new certificate", "data": null}CN = Profitap BV, with subjectAltName DNS:Profitap BV, DNS:iota.profitap.com. The previous certificate and key are replaced immediately.