TableTruncating

Apply for Truncating Tables

Request address

POST
http://OmsAddress/app/newoms.php/webservice/business/table/truncating?cmd=10004&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 truncated Yes
zone_id integer zone id of the table to be truncated Yes
table_name string, string array name of the table to be truncated. When there are multiple tables, the table name can be transfered using an array. The data items in the array are the table names(Example:["table1","table2","table3"....]) Yes
auto_approve Integer (0 or 1) Whether to automatically approve the table-truncating application (the set where the table is located allows automatic approval of the table-truncating application) No, the default is not auto-approval
auto_exec_trans Integer (0 or 1) Whether to generate a table-truncating transaction after automatically approving the table-truncating application (the set where the table is located allows automatic execution of the table-truncating transaction, and auto_exec_trans=1 is valid only when auto_approve=1) No, the default is not auto-execution
attention_man string Separated by semicolon ";" and the maximum length of the field is 200,Interested people can perform this document task No

Data Parameters

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

{
    "app_id": 2,
    "zone_id": 3,
    "table_name": "test_table_generic_modify",
    "auto_approve": 1,
    "auto_exec_trans": "",
}

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 when ret is not equal to 0. info: indicates the form information for a successful truncation application, where uid represents the form id, which is required when approving the application for truncating tables
check json ret: indicates whether the approval is successful. 0 indicates success; others indicate failure. msg: indicates the error message when ret is not equal to 0. info: where trans_id indicates the generated transaction to truncate the table, set_id indicates the set where the transaction is located (the set where the table is located)

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": 1,
    "auto_exec_trans": "" }' http://omsaddress/app/newoms.php/webservice/business/table/truncating?cmd=10004&ip-type=webservicerest&access-token=\

Return Example

Successful Return Example

Status of http request = 200

{
    "apply": {
        "ret": 0,
        "msg": "success to apply truncate table",
        "info": {
            "app_id": 2,
            "app_name": "t_app",
            "set_id": 126,
            "zone_list": "3",
            "table_name": "test_table_generic_modify",
            "table_type": 0,
            "estimated_write_load": 0,
            "estimated_read_load": 0,
            "type": "xml",
            "table_maxnum": 0,
            "write_time": "2017-03-02 21:52:25",
            "apply_type": 2,
            "key_avarage_record_size": 1,
            "value_avarage_record_size": 1,
            "compress": 0,
            "active_record_num": "0",
            "total_record_num": "3",
            "memo": "",
            "tdr": "-1",
            "pcu": 1,
            "relationship_chain_interval": 60,
            "relationship_chain_count": 1,
            "index_count": 1,
            "read_index_interval": 60,
            "read_index_count": 1,
            "read_interval": 60,
            "write_interval": 60,
            "calc_resource_type": 2,
            "dm_ratio": 5,
            "user": "tcaplus",
            "job_id": "42",
            "id": 112,
            "task_id": 407,
            "trans_id": 407,
            "execute_user": "tcaplus",
            "execute_status": 1,
            "audit_memo": ""
        },
        "find_dba": {
            "need_find_dba": 0,
            "dba_name": "eteet"
        }
    },
    "check": {
        "ret": 0,
        "msg": "",
        "info": {
            "set_id": 126,
            "trans_id": 407
        }
    }
}

Failed Return Example

Status of http request != 200

Example 1: Without permission, token authentication failed

{
    "name": "Unauthorized",
    "message": "You are requesting with an invalid credential.",
    "code": 0,
    "status": 401,
    "type": "yii\\web UnauthorizedHttpException"
}
  1. The operation table has already applied for other operations, and the previous application documents need to be processed first
{
    "apply": {
        "ret": -1,
        "msg": "table_name: have applied for another table operation app:2 zone:3 table_name:test_table_generic_modify apply id:113 apply type:2 error type:1",
        "info": null
    }
}

results matching ""

    No results matching ""