TableRebuild
Apply for Rebuilding Tables
Request address
POST
http://OmsAddress/app/newoms.php/webservice/business/table/rebuild?cmd=10023&ip-type=webservicerest&access-token=AccessTokenVal
POST request parameter description
| Parameter name | Data type | Description | Whether the field is required | Remarks |
|---|---|---|---|---|
| app_id | integer | app id of the table to be rebuilt | Yes | |
| zone_id | integer | game zone id of the table to be rebuilt | Yes | |
| table_name | string | name of the table to be rebuilt | Yes | |
| attach_id | Array | id list of the file that defines the modified table structure, obtained by using the interface "3.4.1 Upload the xml/tdr file that defines the table structure" | ||
| auto_approve | Integer (0 or 1) | Whether to automatically approve the table-rebuilding application (the set where the table is located allows automatic approval of the table-rebuilding application) | No, the default is not auto-approval | |
| auto_exec_trans | Integer (0 or 1) | Whether to generate a table-rebuilding transaction after automatically approving the table-rebuilding application (the set where the table is located allows automatic execution of the table-rebuilding transaction, and auto_exec_trans=1 is valid only when auto_approve=1) | No, the default is not auto-execution | |
| attention_man | string | Use semicolon ";" to separate attention men, and the maximum length of the field is 200 | No |
Data Parameters
Use json format to represent the record related information. The following is an example:
Example 1
{
"app_id": 2,
"zone_id": 3,
"table_name": "test_table_generic_modify",
"auto_approve": 0,
"auto_exec_trans": 0
}
Example 2
{
"app_id": 2,
"zone_id": 3,
"table_name": "test_table_generic_modify",
"auto_approve": 1,
"auto_exec_trans": 1
}
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 info when ret is not equal to 0. info: indicates the form information for a successful rebuild application, where uid represents the form id, which is required when approving the application | |
| check | json | ret: indicates whether the approval is successful. 0 indicates success, others indicate failure. msg: indicates the error message info when ret is not equal to 0. info: where trans_id indicates the generated transaction to rebuild the table, set_id indicates the set where the transaction is located (the set where the table is located) | |
| exec | Json | ret: indicates whether the execution is successful, and 0 indicates success; others indicates failure. msg: indicates the error message when ret is not equal to 0 |
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 '{
"app_id": 2,
"zone_id": 3,
"table_name": "test_table_generic_modify",
"auto_approve": 0,
"auto_exec_trans": 0
}' http://omsaddress/app/newoms.php/webservice/business/table/rebuild?cmd=10023&ip-type=webservicerest&access-token=\
Return Example
Successful Return Example
When the Status of the http request is 200, the returned information only needs to pay attention to whether the ret is 0 (0 is successful), get the id (application form id) in the info mesage, and check whether the app_id、zone_list、table_name are matched. Other fields do not need to be paid attention to.
Example 1
{
"apply": {
"ret": 0,
"info": {
"app_id": 2,
"app_name": "tdr_app",
"set_id": 1,
"zone_list": "4",
"table_name": "table_list_name_diff",
"table_type": 0,
"estimated_write_load": 1,
"estimated_read_load": 1,
"type": "xml",
"table_maxnum": 0,
"write_time": "2021-03-16 22:06:11",
"apply_type": 4,
"key_avarage_record_size": 1,
"value_avarage_record_size": 1,
"compress": 1,
"active_record_num": "1",
"total_record_num": "1",
"memo": "",
"tdr": "3",
"pcu": 0,
"engine_parameters": "bnum=7500000#xmsiz=200000000#xikmsiz=80000000#kmapow=6#kfapow=6#vmapow=6#vfapow=6#lnum=2",
"relationship_chain_interval": 0,
"relationship_chain_count": 0,
"index_count": 0,
"read_index_interval": 0,
"read_index_count": 0,
"read_interval": 0,
"write_interval": 0,
"calc_resource_type": 1,
"data_protocol_type": "TBD",
"user": "username",
"job_id": "7",
"attention_man": "",
"sort_rule": 0,
"sort_field_num": 0,
"dm_ratio": 5,
"id": 245
},
"msg": ""
}
}
Example 2
{
"apply": {
"ret": 0,
"info": {
"app_id": 2,
"app_name": "tdr_app",
"set_id": 1,
"zone_list": "4",
"table_name": "table_list_name_diff",
"table_type": 0,
"estimated_write_load": 1,
"estimated_read_load": 1,
"type": "xml",
"table_maxnum": 0,
"write_time": "2021-03-16 22:07:28",
"apply_type": 4,
"key_avarage_record_size": 1,
"value_avarage_record_size": 1,
"compress": 1,
"active_record_num": "1",
"total_record_num": "1",
"memo": "",
"tdr": "3",
"pcu": 0,
"engine_parameters": "bnum=7500000#xmsiz=200000000#xikmsiz=80000000#kmapow=6#kfapow=6#vmapow=6#vfapow=6#lnum=2",
"relationship_chain_interval": 0,
"relationship_chain_count": 0,
"index_count": 0,
"read_index_interval": 0,
"read_index_count": 0,
"read_interval": 0,
"write_interval": 0,
"calc_resource_type": 1,
"data_protocol_type": "TBD",
"user": "username",
"job_id": "7",
"attention_man": "",
"sort_rule": 0,
"sort_field_num": 0,
"dm_ratio": 5,
"id": 246
},
"msg": ""
},
"check": {
"ret": 0,
"info": {
"set_id": 1,
"trans_id": 238
},
"msg": ""
},
"exec": {
"ret": 0,
"info": {
"set_id": 1,
"trans_id": 238,
"user_name": "username"
},
"msg": ""
}
}
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"
}
{
"apply": {
"ret": -1,
"info": null,
"msg": "table_name:ip(10.28.2.18) not in whitelist for applying to rebuild table(cmd:10023) of app_id:2 zone_id:4 table_name:table_list_name_diff"
}
}