TableDetail
Get the details of the specified table
Request address
POST
http://OmsAddress/app/newoms.php/webservice/business/table/detail?cmd=10006&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 | Yes | |
| zone_id | integer | zone id of the table | Yes | |
| table_name | string | table name | ||
| get_table_attachs | Integer, 0 or 1 | Whether to get the list of files (including file id, file name, and file content) used for adding tables. If not, it is recommended to set it to 0 | No, the default value is 0 | Whatever the encoding format of the files used for adding tables, the content returned here is utf8 encoded |
| get_table_struct | Integer, 0 or 1 | Whether to get the table structure information. If not, it is recommended to set it to 0 | No, the default value is 0 | This function is not supported for tables defined using the proto files |
Data Parameters
Use json format to represent the record related information. The following is an example:
{
"app_id": "2",
"zone_id": 3,
"table_name": "list_tb",
"get_table_attachs": 1,
"get_table_struct": 1
}
Return Syntax
Return Parameter Description
When the returned status code is not 200, it indicates that the query was unsuccessful, and the returned data is error information
When the returned status code is 200, it indicates that the query was successful, and the returned information is the specified set_id and app_id
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": "list_tb",
"get_table_attachs": 1,
"get_table_struct": 1
}' http://omsaddress/app/newoms.php/webservice/business/table/detail?cmd=10006&ip-type=webservicerest&access-token=\
Return Example
Successful Return Example
Status of http request = 200
{
"set_id": 1,
"app_id": 2,
"zone_id": 3,
"table_name": "list_tb",
"fmt_type": "tdr",
"shard_factors": "uin",
"table_type": 0,
"table_maxnum": 0,
"key_fields": "{\"Num\":2,\"KeyField\":[{\"Name\":\"uin\",\"Type\":\"int32\",\"MaxLen\":4},{\"Name\":\"name\",\"Type\":\"string\",\"MaxLen\":64}]}",
"value_fields": "{\"Num\":3,\"ValueField\":[{\"Name\":\"level\",\"Type\":\"int32\",\"MaxLen\":4,\"Default\":\"1\"},{\"Name\":\"count\",\"Type\":\"uint8\",\"MaxLen\":1,\"Default\":\"0\"},{\"Name\":\"items\",\"Type\":\"array\",\"MaxLen\":80,\"Default\":\"\"}]}",
"dm_ratio": 5,
"create_date": "2021-06-28 16:50:21",
"modify_date": "0000-00-00 00:00:00",
"dbcluster_info": "{\"AppID\":2,\"ZoneID\":4,\"TableName\":\"table_test\",\"TableType\":0,\"DbSources\":{\"DbSourceNum\":1,\"DbSource\":[{\"DbSourceName\":\"DbSource\",\"Ip\":\"9.135.102.211\",\"Port\":3306,\"User\":\"tcaplus_dbuser\",\"Passwd\":\"OboxSEQqXa1pMmMaT0EJRg==\",\"DbName\":\"tcaplus_dbname\",\"ConnPoolSize\":10,\"CharacterSet\":\"utf8\"}]},\"DbTables\":{\"DbTableNum\":1,\"DbTable\":[{\"TablePrefix\":\"table_test_Z4_\",\"SubTableCount\":1,\"ValueFields\":{\"FieldNum\":3,\"Field\":[{\"FieldName\":\"level\",\"DbFieldName\":\"level\"},{\"FieldName\":\"count\",\"DbFieldName\":\"count\"},{\"FieldName\":\"items\",\"DbFieldName\":\"items\"}]},\"KeyFields\":{\"FieldNum\":2,\"Field\":[{\"FieldName\":\"uin\",\"DbFieldName\":\"uin\"},{\"FieldName\":\"name\",\"DbFieldName\":\"name\"}]},\"Deploy\":{\"SubTableStorePlaceNum\":1,\"SubTableStorePlace\":[{\"SubTableIndexStart\":0,\"SubTableIndexEnd\":1,\"DbSourceName\":\"DbSource\"}]}}]},\"FieldTypeStmts\":{\"TableTdrFile\":\"..\\/..\\/cfg\\/tcapdb_1_2_5_3\\/99ef1e51e751be07f16215bf71244305.tdr\",\"TableTdrName\":\"table_test\",\"KeyFieldStmts\":{\"FieldStmtNum\":0},\"ValueFieldStmts\":{\"FieldStmtNum\":0},\"TableIdlFile\":\"\",\"IdlType\":1},\"RouteKeyFields\":{\"FieldNum\":0},\"tdbank_conf\":{\"bid\":\"tcaplus\",\"tid\":\"tcaplus\",\"db_name\":\"tcaplus\",\"string_encode_manner\":1,\"msgtype\":2,\"tdbank_addr\":\"tcp:\\/\\/10.215.130.234:46801\"},\"DBType\":1,\"IndexInfo\":{\"ReplicationNum\":0,\"ShardNum\":0},\"PluginInfo\":{\"PluginName\":\"\",\"PluginFileID\":0,\"PluginFilePath\":\"\",\"WindowSize\":10,\"AlarmReceivers\":\"\"},\"KafkaInfo\":{\"Instance\":\"\",\"Address\":\"\",\"Topic\":\"\",\"User\":\"\",\"Password\":\"\"}}",
"table_attachs": [],
"table_struct_content": "",
"global_index_struct": [
{
"FieldName": "uin",
"DbFieldName": "uin"
},
{
"FieldName": "name",
"DbFieldName": "name"
},
{
"FieldName": "level",
"DbFieldName": "level"
},
{
"FieldName": "count",
"DbFieldName": "count"
},
{
"FieldName": "items",
"DbFieldName": "items"
}
]
}
Parameter Description of Successful Return
| Parameter name | Data type | Description |
|---|---|---|
| set_id | integer | Set id of a game zone |
| app_id | integer | App id of a zone |
| zone_id | integer | Zone id |
| table_name | string | Table Name |
| fmt_type | string | Table structure file type (file type used for adding table) |
| shard_factors | string | Shard factor |
| table_type | string | Table type: 0 indicates a generic table and 1 indicates a list table |
| table_maxnum | string | The maximum number of records in a list table. This parameter is valid when the table type is list |
| key_fields | string | Table key field description |
| value_fields | string | Table value field description |
| dm_ratio | integer | Obsolete fields, no need to pay attention |
| create_date | string | Table creation time |
| modify_date | string | Table modification time |
| dbcluster_info | string | Write buffer content |
| table_attachs | string | Files list used for adding tables, can only be returned if get_table_attachs is set in the request |
| table_struct_content | string | Table structure content, can only be returned if the get_table_struct is set in the request. This field is not supported in PB table |
| global_index_struct | string | Global index field mapping information |
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"
}
{
"table_name": [
"can't find table(app_id:2,zone_id;3,table_name:list_tb123)"
]
}