TableBatchapply

(Batch) Apply for Adding Tables through xml/tdr/proto File

The interface for applying for adding tables supports adding multiple tables under different game zones of the same app, and the cmd value of the interface is 10002.

Request address

POST
http://OmsAddress/app/newoms.php/webservice/business/table/batchapply?cmd=10002&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 added table Yes
attachment_id Array List of xml file ids that define the table structure Yes
attention_man string Separated by semicolon ";" and the maximum length of the field is 200,Interested people can perform this document task No
table_info Array Each array item of table_info is the table adding information applied under each zone of the specified app_id. Its data structure is shown in the following table Yes

When applying for adding tables, the structure of each data item of table_info:

zone_id Zone id of a table
tables Array. A data item in the array is the information of a table. The information filled in the table is as shown on the right Parameter name Field name Array type Description
table_name table name string The length is 1 to 31, which can only contain letters, numbers and underscores. The first letter is letters or underscores
table_type Table type integer 0 is generic, 1 is list, and the default is 0
table_maxnum Maximum number of elements in List integer When table_type is 1, it is required, and the range is 1 to 10000
auto_approve_add_table_trans Whether to approve this application automatically integer For automatic approval, the permission of the set where the table is added is required
auto_execute_add_table_trans Whether to execute the transaction corresponding to this application automatically integer When auto_approve_add_table_trans = 1, the automatic execution here is valid, and the permission of the set where the table is added is required
compress Table compression integer 0 is not to enable table compression, 1 is to enable table compression, the default is 1
calc_resource_type Calculate the table resource type integer 1 is simple type, 2 is expert type, and the default is 1
active_record_num Number of active records integer When calc_resource_type is 1, the range is 1 to 2147483647
total_record_num Total number of records integer Required when calc_resource_type is 1 or 2
estimated_read_load Read frequency integer Required when calc_resource_type is 1
estimated_write_load Write frequency integer Required when calc_resource_type is 1
key_avarage_record_size Maximum key size integer Required when calc_resource_type is 1 or 2
value_avarage_record_size Average value size integer Required when calc_resource_type is 1 or 2
pcu Highest online (PCU) integer Required when calc_resource_type is 2
relationship_chain_interval Relationship chain reading interval per player (seconds) integer Required when calc_resource_type is 2
relationship_chain_count Number of relationship chain records read at one time by player (pieces) integer Required when calc_resource_type is 2
index_count Number of indexes/lists integer Required when calc_resource_type is 2
read_index_interval Index/list reading interval per player (seconds) integer Required when calc_resource_type is 2
read_index_count Average number of index/list records read at one time (pieces) integer Required when calc_resource_type is 2
read_interval Single read interval triggered per player (seconds) integer Required when calc_resource_type is 2
write_interval Single write interval triggered per player (seconds) integer Required when calc_resource_type is 2

Data Parameters

Use json format to represent the record related information. The following is an example:

{
    "table_info": [
        {
            "tables": [
                {
                    "relationship_chain_count": 1,
                    "table_type": 0,
                    "compress": 0,
                    "value_avarage_record_size": 1,
                    "active_record_num": "2",
                    "total_record_num": "3",
                    "estimated_read_load": "4",
                    "read_index_interval": 60,
                    "index_count": 1,
                    "calc_resource_type": 2,
                    "write_interval": 60,
                    "pcu": 1,
                    "relationship_chain_interval": 60,
                    "table_name": "test_table_generic_modify",
                    "estimated_write_load": "5",
                    "key_avarage_record_size": 1,
                    "read_interval": 60,
                    "read_index_count": 1
                }
            ],
            "zone_id": "3"
        }
    ],
    "memo": "by auto test",
    "attachment_id": [
        99
    ],
    "app_id": "2"
}

Return Description

  1. When the Status of the http request is 200, it indicates that the request was successful, and the returned data is the table adding information; See "Request Example" for the returned data structure
  2. When the Status of the http request is not 200, it indicates that the request was unsuccessful, and the returned data is an error message description in json format

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 '{
    "table_info": [
        {
            "tables": [
                {
                    "relationship_chain_count": 1,
                    "table_type": 0,
                    "compress": 0,
                    "value_avarage_record_size": 1,
                    "active_record_num": "2",
                    "total_record_num": "3",
                    "estimated_read_load": "4",
                    "read_index_interval": 60,
                    "index_count": 1,
                    "calc_resource_type": 2,
                    "write_interval": 60,
                    "pcu": 1,
                    "relationship_chain_interval": 60,
                    "table_name": "test_table_generic_modify",
                    "estimated_write_load": "5",
                    "key_avarage_record_size": 1,
                    "read_interval": 60,
                    "read_index_count": 1
                }
            ],
            "zone_id": "3"
        }
    ],
    "memo": "by auto test",
    "attachment_id": [
        99
    ],
    "app_id": "2"
}' http://omsaddress/app/newoms.php/webservice/business/table/batchapply?cmd=10002&ip-type=webservicerest&access-token=\

Return Example

Successful Return Example

When the Status of the http request is 200, just pay attention to whether the ret in the return message is 0 (0 is successful) and get the id in the info message (application id), and check whether the app_id、zone_list、table_name is right, other fields do not need too much attention unless special circumstances. ||

[
    {
        "relationship_chain_count": 1,
        "table_type": 0, //table type, 0: generic; 1: list
        "compress": 0,
        "value_avarage_record_size": 1,
        "active_record_num": "2",
        "total_record_num": "3",
        "estimated_read_load": "4",
        "read_index_interval": 60,
        "index_count": 1,
        "calc_resource_type": 2,
        "write_interval": 60,
        "pcu": 1,
        "relationship_chain_interval": 60,
        "table_name": "test_table_generic_modify",//table name
        "estimated_write_load": "5",
        "key_avarage_record_size": 1,
        "read_interval": 60,
        "read_index_count": 1,
        "resource_ratio": 1,
        "zone_list": "3",//game zone id of the table
        "set_id": 126,//set id of the table
        "app_id": "2",//app id of the table
        "app_name": "t_app",
        "memo": "by auto test",
        "attention_man": "",
        "user": "tcaplus",
        "type": "xml",
        "apply_type": "0",
        "tdr": "99",
        "write_time": "2017-03-02 20:20:10",
        "dm_ratio": 5,
        "kelly_id": 0,
        "table_maxnum": 0,
        "id": 108//id of the table-adding application form 
    }
]

Failed Return Example

Status of http request != 200

[
    "ip(10.29.89.51) not in whitelist for applying to add table(cmd:10002) of set_id:126 app_id:2 zone_id:3"
]
{
    "name": "Unauthorized",
    "message": "you are not allowed to access this app:app_id:2",
    "code": 0,
    "status": 401,
    "type": "yii\\web ForbiddenHttpException"
}
[
    "table_name: have applied for another table operation app:2 zone:3 table_name:test_table_generic_modify apply id:108 apply type:{applytype} error type:{errortype}"
]
[
    "table_name: have applied for another table operation app:2 zone:3 table_name:test_table_generic_modify apply id:108 apply type:{applytype} error type:{errortype}"
]

results matching ""

    No results matching ""