8.Backup
1. Create backup
API address:/v1/backup/add
Request method:POST
Request data type:application/json
Response data type:*/*,application/json
Supported version: v1.17.0
API description:
Batch create backups
Request parameters:
| Parameter name | Parameter description | Location | Whether required | Data type | Description |
|---|---|---|---|---|---|
| instanceUuids | Container uuid | body | true | list | Single or multiple container data entries |
| callbackUrl | Notification callback address | body | false | string | POST request |
Request example:
POST "/openapi/v1/backup/add"
body:
{
"instanceUuids": ["348504568b904b7eb64264e488a2f79d","ae674f4546c74bf48c00c211334f214a"]
}
Response parameters:
| Parameter name | Parameter description | Type | Description |
|---|---|---|---|
| code | Return code | integer(int32) | |
| message | Return processing message | string | |
| success | Success flag | boolean | |
| result | Returned data object | List | |
| jobId | Task ID | string | |
| code | Task submission status code | integer | CorrespondingResponse status code table |
| message | Task submission description | string | |
| uuid | Container uuid | string | |
| command | Command | string | |
| nodeUuid | Node UUID | string | |
| timestamp | Timestamp | integer(int64) | |
| traceId | Request processing ID | string |
Response example:
{
"message": "操作成功",
"code": 200,
"result": [
{
"jobId": "fb3e172cbbc847e6ba18bdd991b79e72",
"code": 200,
"message": "success",
"uuid": "348504568b904b7eb64264e488a2f79d",
"command": "backupInstance",
"nodeUuid": "7a3eacab1939fefec0c1998e37d87ae2"
},
{
"jobId": "1e3388fddf3e4c1496fa109986c05383",
"code": 200,
"message": "success",
"uuid": "ae674f4546c74bf48c00c211334f214a",
"command": "backupInstance",
"nodeUuid": "7a3eacab1939fefec0c1998e37d87ae2"
}
],
"timestamp": 1691369821823,
"traceId": "E75320230807085701790"
}
2. Backup list
API address:/v1/backup/list
Request method:POST
Request data type:application/json
Response data type:*/*,application/json
Supported version: v1.17.0
API description:
Paginated query of backup list
Request parameters:
| Parameter name | Parameter description | Location | Whether required | Data type | Description |
|---|---|---|---|---|---|
| projectId | Project Id | body | false | string | Defaults to the current user's default project |
| nodeUuid | Node uuid | body | true | string | |
| instanceUuids | Container list | body | false | list<object> | Container list, query backups by container |
| instanceName | Container name | body | false | string | Fuzzy query by container name |
| jobId | Task ID | body | false | string | Task ID returned by the create backup API |
| name | Backup name | body | false | string | |
| pageNum | Current page number | body | false | integer | Default 1 |
| pageSize | Amount of data on the current page | body | false | integer | Default 10 |
Request example:
POST "/openapi/v1/backup/list"
body:
{
"pageNum": 1,
"pageSize": 10,
"projectId": "project_admin",
"name": "back-mi10",
"jobId": "fb3e172cbbc847e6ba18bdd991b79e72",
"instanceUuids": [
"ae674f4546c74bf48c00c211334f214a"
],
"instanceName": "mihayou"
}
Response parameters:
| Parameter name | Parameter description | Type | Description |
|---|---|---|---|
| code | Return code | integer(int32) | |
| message | Return processing message | string | |
| result | Returned data object | IPage<object> | |
| records | Data list on the current page | list<object> | |
| nodeUuid | Node uuid | string | |
| uuid | Backup uuid | string | |
| name | Backup name | string | false |
| size | Backup size | string | bytes |
| imageId | Backup image id | string | Backup source container image id |
| instanceUuid | Container ID | string | uuid of the container to which the backup source belongs |
| instanceName | Container name | string | Backup source container name |
| jobId | Task ID | string | |
| status | Task status | integer | 0: backing up 1:backup succeeded; 2: backup failed |
| createTime | Creation time | string | |
| total | Total number of records | integer | |
| current | Current page number | integer | |
| pages | Total pages | integer | |
| size | Number of items displayed per page | integer | |
| timestamp | Timestamp | integer(int64) | |
| traceId | Request processing ID | string |
Response example:
{
"code":200,
"message":"操作成功",
"result":{
"records":[
{
"nodeUuid":"a5b93c4e98224c84bb10957aa6175a92",
"uuid":"befd6ef1400d491db459e5681c6891ad",
"name":"xxx",
"size":1534654694,
"instanceUuid":"ae674f4546c74bf48c00c211334f214a",
"instanceName": "mihayou",
"jobId": "fb3e172cbbc847e6ba18bdd991b79e72",
"status": 1,
"imageId": "img-1743489439031",
"projectId": "f93afddd503d1fc6ada3174160852180",
"createTime":"2023-08-01 12:02:55"
}
],
"total":40,
"current":1,
"pages":4,
"size":10
},
"timestamp":1691464377302,
"traceId":"E07620230808111257302"
}
3. Restore backup
API address:/v1/backup/recovery
Request method:POST
Request data type:application/json
Response data type:*/*,application/json
Supported version: v1.17.0
API description:
Restore a single backup or backups in batches
Request parameters:
| Parameter name | Parameter description | Location | Whether required | Data type | Description |
|---|---|---|---|---|---|
| instanceBackups | Container restore list | body | true | list | List containing the containers and backup data to be restored. Each element is an object containing the following fields: |
| instanceUuid | Container uuid | true | string | Unique identifier of the container, a string with a length of 32 characters. | |
| backupUuid | Backup uuid | ture | string | Unique identifier of the backup, a string with a length of 32 characters. | |
| callbackUrl | Notification callback address | body | false | string | POST request |
| statusStartType | Container startup type | body | false | integer | 0:start (default option) 1:keep original (started/stopped) state |
Request example:
POST "/openapi/v1/backup/recovery"
body:
{
"instanceBackups":[{
"instanceUuid":"348504568b904b7eb64264e488a2f79d",
"backupUuid":"ae674f4546c74bf48c00c211334f214a"
}]
}
Response parameters:
| Parameter name | Parameter description | Type | Description |
|---|---|---|---|
| code | Return code | integer(int32) | |
| message | Return processing message | string | |
| success | Success flag | boolean | |
| result | Returned data object | List | |
| jobId | Task ID | string | |
| code | Task submission status code | integer | CorrespondingResponse status code table |
| message | Task submission description | string | |
| uuid | Container uuid | string | |
| command | Command | string | |
| nodeUuid | Node UUID | string | |
| timestamp | Timestamp | integer(int64) | |
| traceId | Request processing ID | string |
Response example:
{
"message": "操作成功",
"code": 200,
"result": [
{
"jobId": "fb3e172cbbc847e6ba18bdd991b79e72",
"code": 200,
"message": "success",
"uuid": "348504568b904b7eb64264e488a2f79d",
"command": "restoreInstance",
"nodeUuid": "7a3eacab1939fefec0c1998e37d87ae2"
}
],
"timestamp": 1691369821823,
"traceId": "E75320230807085701790"
}
4. Delete backup
API address: /v1/backup/remove
Request method:POST
Request data type:application/json
Response data type:*/*,application/json
Supported version: v1.17.0
API description:
Batch delete backups
Request parameters:
| Parameter name | Parameter description | Location | Whether required | Data type | Description |
|---|---|---|---|---|---|
| nodeUuid | Node uuid | body | true | list | |
| backupUuids | Backup uuid | body | true | list | Single or multiple container data entries |
Request example:
POST "/openapi/v1/backup/remove"
body:
{
"backupUuids": ["348504568b904b7eb64264e488a2f79d","ae674f4546c74bf48c00c211334f214a"]
}
Response parameters:
| Parameter name | Parameter description | Type | Description |
|---|---|---|---|
| code | Return code | integer(int32) | |
| message | Return processing message | string | |
| result | Returned data object | List | |
| timestamp | Timestamp | integer(int64) | |
| traceId | Request processing ID | string |
Response example:
{
"message": "操作成功!",
"code": 200,
"result": null,
"timestamp": 1718431861571,
"traceId": "C20240615141101571003"
}
5. Distribute backup
API address:/v1/backup/distribute
Request method:POST
Request data type:application/json
Response data type:*/*,application/json
Supported version: v1.17.0
API description:
Distribute backup
Request parameters:
| Parameter name | Parameter description | Location | Whether required | Data type | Description |
|---|---|---|---|---|---|
| backupUuids | Backup uuid | body | true | list | Single or multiple container data entries |
| nodeUuid | Node uuid | body | true | list | Distribution source node |
| nodeUuids | Node uuid list | body | true | list | Target node |
| callbackUrl | Notification callback address | body | false | string | POST request |
Request example:
POST "/openapi/v1/backup/distribute"
body:
{
"backupUuids": ["348504568b904b7eb64264e488a2f79d","ae674f4546c74bf48c00c211334f214a"],
"nodeUuid": "348504568b904b7eb64264e488a2f792",
"nodeUuids":["348504568b904b7eb64264e488a2f791","ae674f4546c74bf48c00c211334f2141"]
}
Response parameters:
| Parameter name | Parameter description | Type | Description |
|---|---|---|---|
| code | Return code | integer(int32) | |
| message | Return processing message | string | |
| success | Success flag | boolean | |
| result | Returned data object | List | |
| jobId | Task ID | string | |
| code | Task submission status code | integer | CorrespondingResponse status code table |
| message | Task submission description | string | |
| uuid | Backup uuid | string | |
| nodeUuid | Node UUID | string | |
| timestamp | Timestamp | integer(int64) | |
| traceId | Request processing ID | string |
Response example:
{
"message": "操作成功",
"code": 200,
"result": [
{
"jobId": "fb3e172cbbc847e6ba18bdd991b79e72",
"code": 200,
"message": "success",
"uuid": "348504568b904b7eb64264e488a2f79d",
"nodeUuid": "7a3eacab1939fefec0c1998e37d87ae2"
},
{
"jobId": "1e3388fddf3e4c1496fa109986c05383",
"code": 200,
"message": "success",
"uuid": "ae674f4546c74bf48c00c211334f214a",
"nodeUuid": "7a3eacab1939fefec0c1998e37d87ae2"
}
],
"timestamp": 1691369821823,
"traceId": "E75320230807085701790"
}
6 Import instance backup
API address:/v1/backup/load
Request method:POST
Request data type:application/json
Response data type:*/*,application/json
Supported version:v2.11.0
API description:
Download backup file from external URL and import it to edge node
Request example:
curl -X POST "http://192.168.50.26:1800/openapi/v1/backup/load" -H "accept: */*" -H "Content-Type: application/json" -H "Authorization: bearer dc4748f5-929a-433f-aced-74ef65c7d436" -d '{"nodeUuid":"161d73a7470b797fec133df3b5bbf20b","projectId":"default","backups":[{"instanceUuid":"i-7b0d8170ad5855f280e3a0079f67465a","downloadUrl":"http://192.168.50.40/backup/xxx.tar"}]}'
Request parameters:
| Parameter name | Parameter description | Location | Whether required | Data type | Description |
|---|---|---|---|---|---|
| nodeUuid | Node UUID | body | true | string | |
| projectId | Project ID | body | false | string | if not passed, use the user's default project |
| backups | Backup list | body | true | array | |
| nodeUuid | Node UUID | body | false | string | |
| projectId | Project ID | body | false | string | if not passed, use the user's default project |
| instanceUuid | Instance UUID | false | string | ||
| instanceName | Instance name | false | string | ||
| downloadUrl | download URL | true | string | Backup file download address | |
| uuid | Backup UUID | false | string | automatically generated if not passed | |
| imageId | Image ID | false | string |
Response parameters:
| Parameter name | Parameter description | Type | Description |
|---|---|---|---|
| code | Return code | integer(int32) | integer(int32) |
| message | Return processing message | string | |
| result | Returned data object | List | |
| jobId | Task ID | string | |
| uuid | Backup UUID | string | |
| code | Task submission status code | integer | 200 indicates success |
| message | Task submission description | string | |
| nodeUuid | Node UUID | string | |
| projectId | Project ID | string | |
| traceId | Request processing ID | string | |
| timestamp | Timestamp | integer(int64) | integer(int64) |
Response example:
{
"message": "操作成功",
"code": 200,
"result": [
{
"jobId": "f07e77c4dcd04359b56730dbd7d1162e",
"uuid": "b59b5f35f7d743d3ad740b8df05277bf",
"code": 200,
"message": "success",
"nodeUuid": "161d73a7470b797fec133df3b5bbf20b",
"projectId": "default"
}
],
"timestamp": 1691369668713,
"traceId": "E75020230807085428674"
}
7 Export instance backup
API address:/v1/backup/upload
Request method:POST
Request data type:application/json
Response data type:*/*,application/json
Supported version:v2.11.0
API description:
Export edge node backup to external storage
Request example:
curl -X POST "http://192.168.50.26:1800/openapi/v1/backup/upload" -H "accept: */*" -H "Content-Type: application/json" -H "Authorization: bearer dc4748f5-929a-433f-aced-74ef65c7d436" -d '{"nodeUuid":"161d73a7470b797fec133df3b5bbf20b","projectId":"default","backups":[{"instanceUuid":"i-7b0d8170ad5855f280e3a0079f67465a","uuid":"b59b5f35f7d743d3ad740b8df05277bf"}]}'
Request parameters:
| Parameter name | Parameter description | Location | Whether required | Data type | Description |
|---|---|---|---|---|---|
| nodeUuid | Node UUID | body | true | string | |
| projectId | Project ID | body | false | string | if not passed, use the user's default project |
| backups | Backup list | body | true | array | |
| storageUrl | Storage server address | true | string | OSS server address | |
| storageName | Bucket name | true | string | ||
| storagePath | Storage path | true | string | ||
| access | Authentication Access | true | string | OSS authentication access | |
| secret | Authentication Secret | true | string | OSS authentication secret | |
| pathStyle | Path style | true | boolean | Default true | |
| uuid | Backup UUID | true | string |
Response parameters:
| Parameter name | Parameter description | Type | Description |
|---|---|---|---|
| code | Return code | integer(int32) | integer(int32) |
| message | Return processing message | string | |
| result | Returned data object | List | |
| jobId | Task ID | string | |
| uuid | Backup UUID | string | |
| code | Task submission status code | integer | 200 indicates success |
| message | Task submission description | string | |
| nodeUuid | Node UUID | string | |
| projectId | Project ID | string | |
| traceId | Request processing ID | string | |
| timestamp | Timestamp | integer(int64) | integer(int64) |
Response example:
{
"message": "操作成功",
"code": 200,
"result": [
{
"jobId": "f07e77c4dcd04359b56730dbd7d1162e",
"uuid": "b59b5f35f7d743d3ad740b8df05277bf",
"code": 200,
"message": "success",
"nodeUuid": "161d73a7470b797fec133df3b5bbf20b",
"projectId": "default"
}
],
"timestamp": 1691369668713,
"traceId": "E75020230807085428674"
}