BackupSvrDataApply
Apply for Data Backup Based on Tables
Request address
POST
http://OmsAddress/app/newoms.php/webservice/business/backup-svr-data/apply?cmd=10009&ip-type=webservicerest&access-token=AccessTokenVal
POST request parameter description
| Parameter name | Data type | Description | Whether the field is required | Remarks |
|---|---|---|---|---|
| set_id | integer | set id of the backup data | Yes | |
| app_id | integer | app id of the set where the backup data is located | Yes | |
| zone_id | integer | zone id of the backup data | No | If there is no table in this zone, an error message will be returned |
| table_name | string | Back up the data of the specified table | No | |
| svr_ids | Array or 0 | Server ID | No | If it is a non-slavej process, an error will be returned. Filling in 0 indicates that the SVR for all apps will be backed up. At this time, the zone_id and table_name should be filled with an empty string |
| auto_approve | Integer (0 or 1) | Whether to automatically approve the table-truncating application (the set where the table is located allows automatic approval of the table-truncating application) | No, the default is not auto-approval |
Data Parameters
Use json format to represent the record related information. The following is an example:
{
"set_id": "126",
"app_id": "2",
"zone_id": "0",
"svr_ids": [
"126.2.2.2",
"126.2.2.3"
],
"auto_approve": "0"
}
Forms rejected for approval (data backup)
Version requirements: 3.55.1
{
"apply_id": "100",
"memo":"test"
}
Return Syntax
Return Parameter Description
| Parameter name | Data type | Description | Remarks |
|---|---|---|---|
| apply | json | ret: indicates whether the application is successful. 0 indicates success; others indicate failure. msg: indicates the error message when ret is not equal to 0. id: id of the data backup form that has been successfully approved, which is required when approving the application for data backup | |
| check | json | ret: indicates whether the approval is successful. 0 indicates success, others indicate failure. msg: indicates the error message when ret is not equal to 0. trans_id: indicates the transaction id of the generated data backup |
Request Example
Send A Request through the Curl Method
For the parameters in the command, please refer to the "Description of POST Request Parameters" on this page. For the method to obtain access-token, see: Get access-token
curl -H "Content-type: application/json" -X "POST" -d '{
"set_id": "126",
"app_id": "2",
"zone_id": "0",
"svr_ids": [
"126.2.2.2",
"126.2.2.3"
],
"auto_approve": "0"
}' http://omsaddress/app/newoms.php/webservice/business/backup-svr-data/apply?cmd=10009&ip-type=webservicerest&access-token=\
Return Example
Successful Return Example
Status of http request = 200
Successful example 1: backup according to the specified svr_id
{
"apply": {
"ret": 0,
"msg": "success to apply backup svr table",
"id": 558
}
}
Successful example 2: backup the slaves of all tables under all set_ids and app_ids
{
"apply": {
"ret": 0,
"msg": "success to apply backup svr table",
"id": 559
},
"check": {
"ret": 0,
"msg": "",
"trans_id": 260
}
}
Forms rejected for approval (data backup)
true
Failed Return Example
Status of http request != 200
{
"name": "Unauthorized",
"message": "You are requesting with an invalid credential.",
"code": 0,
"status": 401,
"type": "yii\\web UnauthorizedHttpException"
}
{
"source_ip": "ip:10.29.89.51 not in whitelist"
}
Forms rejected for approval (data backup)
{
"apply_id": [
"can't find apply_list(apply_id=100)"
]
}