Scheduled SnapshotCA Authentication
Project: Device API Document (New Version) | page_id: 1771
Upload CA Configuration API Document
Overview
Used to query and update the device upload CA configuration.
Route registration location:
- /xsw/api/sys/getUploadCAConf
- /xsw/api/sys/setUploadCAConf
Supported methods:
- GET
- POST
Common error return structure:
| Field | Type | Description |
|---|---|---|
| code | int32 | 0 on success; error code, usually 1000 on failure |
| msg | string | Error message |
1. Get Upload CA Configuration
API Information
- Path:
/xsw/api/sys/getUploadCAConf - Method:
GET/POST - Request body: none
Return Structure
On success, the object UploadCAConf is returned:
| Field | Type | Description |
|---|---|---|
| enable | int32 | Upload CA verification mode |
| content | string | CA file text content |
Notes:
- enable is read from the configuration item syscontrol.0.upload_ca_enable.
- When the CA file does not exist, content returns an empty string.
Success Example
{
"enable": 1,
"content": "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n"
}
Failure Example
{
"code": 1000,
"msg": "...error reason..."
}
2. Set Upload CA Configuration
API Information
- Path:
/xsw/api/sys/setUploadCAConf - Method:
GET/POST - Recommended
Content-Type:application/json
Request Body
{
"enable": 1,
"content": "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n"
}
Field description:
| Field | Type | Required | Description |
|---|---|---|---|
| enable | int32 | Yes | Verification mode, allowed values: 0, 1, 2, 101 |
| content | string | No | CA file content; the CA file is not updated when it is an empty string |
Parameter validation rules:
- enable only allows 0/1/2/101; otherwise the error is returned: enable should be 0,1,2,101.
- The request body must be valid JSON; otherwise the error is returned: invalid json body: ....
Processing Logic
- Parse the JSON request body into
UploadCAConf. - Verify whether
enableis within the allowed range. - If
contentis not empty, write the CA file. - Update the configuration field
syscontrol.0.upload_ca_enable. - Persist the configuration.
Success Response
{
"code": 0,
"msg": ""
}
Failure Response
{
"code": 1000,
"msg": "...error reason..."
}
3. cURL Examples
Get Configuration
curl -X GET "http://<host>/xsw/api/sys/getUploadCAConf"
Update Configuration (Mode Only)
curl -X POST "http://<host>/xsw/api/sys/setUploadCAConf" \
-H "Content-Type: application/json" \
-d '{"enable":2,"content":""}'
Update Configuration (Mode + CA Content)
curl -X POST "http://<host>/xsw/api/sys/setUploadCAConf" \
-H "Content-Type: application/json" \
-d '{"enable":1,"content":"-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n"}'