TableSetDataExpiration
Set Table Data Expiration
Request address
POST
http://OmsAddress/app/newoms.php/webservice/business/table/set-data-expiration?cmd=10016&ip-type=webservicerest&access-token=AccessTokenVal
POST request parameter description
| Parameter name | Data type | Description | Whether the field is required | Remarks |
|---|---|---|---|---|
| app_id | integer | set id of the target table for setting data expiration | Yes | |
| zone_id | integer | game zone id of the target table for setting data expiration | Yes | |
| table_name | string | table name of the target table for setting data expiration | Yes | |
| rule_type | integer | Data expiration level, 1: table level (default, previously supported only for this mode) 2: record level (new mode) | No | |
| age | integer | Unit: second, TTL. It is recommended to be greater than 450 s. Data beyond this time will be automatically deleted by the system. Range: [0, 9223372036854775807] | Yes | |
| list_empty_index_age | Integer (0 or 1) | Unit: second, TTL of the empty index in the list table. It is generally set to 0. Empty indexes beyond this time will be automatically deleted by the system. Rangd: [0, 922372036854775807] | Yes |
Data Parameters
Use json format to represent the record related information. The following is an example:
{
"app_id": 2,
"zone_id": 3,
"table_name": "table_list_1",
"age": 460,
"list_empty_index_age": 0
}
Return Syntax
Return Parameter Description
When the returned status code is not 200, it indicates that the check was unsuccessful, and the returned data is the transaction failure message
When the returned status code is 200, it indicates that the transaction was successfully created, and the data structure returned is as follows
| Parameter name | Data type | Description | Remarks |
|---|---|---|---|
| set_id | integer | set id where the table data expiration transaction is set | |
| trans_id | integer | transaction id that sets the table data expiration |
You can use the preceding information to check whether the table data expiration is complete.
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": "table_list_1",
"age": 460,
"list_empty_index_age": 0
}' http://omsaddress/app/newoms.php/webservice/business/table/set-data-expiration?cmd=10016&ip-type=webservicerest&access-token=\
Return Example
Successful Return Example
Status of http request = 200
{
"set_id": 126,
"trans_id": 535,
"user": "yunwei"
}
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_list_1": [
"can't find table (app_id:2,zone_id;3,table_name:table_list_1)"
]
}