ApplyTableIndex
Apply for Creating a Table Index
This interface is used to create a table index. If the application forms for other table operations are not processed, a conflict will be reported
Request address
POST
http://OmsAddress/app/newoms.php/webservice/business/table/apply-table-index?cmd=10022&ip-type=webservicerest&access-token=AccessTokenVal
POST request parameter description
| Parameter | format | Required or not | Description |
|---|---|---|---|
| app_id | integer | Yes | App ID |
| zone_id | string | Yes | |
| table_name | string | Yes | |
| key_index_fields | Array | Yes | the selected key field as the index |
| value_index_fields | Array | Yes | the selected value field as the index |
| memo | Remarks | No | apply by webservice |
Data Parameters
Use json format to represent the record related information. The following is an example:
{
"app_id": 2,
"zone_id": 4,
"table_name": "T_CHESS_COMMENT",
"key_index_fields": [
"chess_id"
],
"value_index_fields": [
"thumb_num"
],
"memo": "apply by webservice"
}
Return Syntax
Return Parameter Description
The parameters we need to focus on are apply,info and id, which will be used during approval
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": 4,
"table_name": "T_CHESS_COMMENT",
"key_index_fields": [
"chess_id"
],
"value_index_fields": [
"thumb_num"
],
"memo": "apply by webservice"
}' http://omsaddress/app/newoms.php/webservice/business/table/apply-table-index?cmd=10022&ip-type=webservicerest&access-token=\
Return Example
Successful Return Example
Status of http request = 200
{
"apply": {
"ret": 0,
"info": {
"dba": "tcaplus;peterwong",
"set_id": 1,
"app_id": 2,
"app_name": "test_app",
"zone_list": "4",
"table_name": "T_CHESS_COMMENT",
"table_type": 0,
"apply_type": 14,
"user": "peterwong",
"write_time": "2020-10-16 14:21:56",
"memo": "apply by webservice",
"job_id": 21,
"key_struct": "[\"chess_id\"]",
"value_struct": "[\"thumb_num\"]",
"dm_ratio": 5,
"table_maxnum": 0,
"calc_resource_type": 1,
"attention_man": "",
"kelly_id": 0,
"resource_ratio": 1,
"sort_field_num": 0,
"sort_rule": 0,
"data_protocol_type": "TBD",
"id": 117
},
"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"
}
{
"source_ip": "ip:10.29.89.51 not in whitelist"
}