Upload a Certificate

Upload a certificate to the PBX's temporary storage are.

Note:
  • Calling this interface only stores the certificate file temporarily; it does NOT add the certificate to the PBX's certificate list. To formally add and use the certificate, you must subsequently call the Add a Certificate interface.
  • The system will automatically clean up the uploaded certificate files that have been stored for over 1 hour at 1:00 AM daily.

Request URL

POST {base_url}/{api_path}/certificate/upload?access_token={access_token}

Request parameters

Parameter Required Type Description
file Yes File The desired certificate file, uploaded via form-data.
type Yes String Specify the certificate type.
Valid value:
  • trusted: Trusted CA certificate.
  • server: PBX server certificate.

Response parameters

Table 1.
Parameter Type Description
errcode Integer Returned error code.
  • 0: Succeed.
  • Non-zero value: Failed.
Note: You can check the error code and error message in Error Code and Error Message.
errmsg String Returned message.
  • SUCCESS: Succeed.
  • FAILURE: Failed.
file String The file name of the certificate.

Examples

Request example

POST /openapi/v1.0/certificate/upload?access_token=wOODrqhysk0aELacF87qd4lBvmbBY4IZ HTTP/1.1
Host: 192.168.5.150:8088

Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="type"

trusted
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="/D:/project/certificate/example.domain.com.crt"
Content-Type: <Content-Type header here>

(data)
------WebKitFormBoundary7MA4YWxkTrZu0gW--
Figure 1. Request example in Postman

Response example

HTTP/1.1 200 OK
{
    "errcode": 0,
    "errmsg": "SUCCESS",
    "file": "example.domain.com.crt"
}