TableDataMake
Generate Table Data Construction Transaction
It is allowed to construct table data under one zone at a time.
Request address
POST
http://OmsAddress/app/newoms.php/webservice/oamp/table-data/make?cmd=10011&ip-type=webservicerest&access-token=AccessTokenVal
POST request parameter description
| Parameter name | Data type | Description | Whether the field is required | Remarks |
|---|---|---|---|---|
| setId | integer | set id of the transaction | Yes | |
| tableInfoList | Array | table for constructing data. It is allowed to construct data under one zone | Yes | |
| ipList | string | path on the machine where the data is located. The format is: ip username password, and the account password cannot contain (\ l ; - Space). Multiple values are separated by newline, such as 1.1.1.1 tcaplus tcaplus.(When useSlaveMachine is 1 or useSlaveOnlineData is 1, it can be an empty string.) | Yes | |
| uLogBackupTime | string | Ulog construction data time point, format: xxxx-xx-xx xx:xx:xx, such as 2018-03-05 16:00:04 | Yes | |
| maxConcurrentActionNum | integer | Transaction parallelism, range: [1, 50], default value: 10 | No | |
| useSlaveOnlineData | integer | When useSlaveOnlineData is set to 1, both ipList and uLogBackUpTime are empty for hot standby construction | No | |
| useSlaveMachine | integer | When constructing data on a Slave machine and the data is set to 1, the ipList can be left blank. | No | |
| isDeletedTable | integer | Indicates whether it is a deleted table. When isDeletedTable is 1, uLogBackUpTime and deleteTableLastBackUpTime are required, ipList cannot be empty, and useSlaveMachine is 0. | No |
Data Parameters
Use json format to represent the record related information. The following is an example:
{
"setId": 126,
"tableInfoList": {
"2-3-add_table1": {
"AppID": 2,
"ZoneID": 3,
"TableName": "add_table1",
"ShardNun": 1,
"ShardList": [
1
]
},
"2-3-add_table2": {
"AppID": 2,
"ZoneID": 3,
"TableName": "add_table2",
"ShardNum": 1,
"ShardList": [
6
]
} //When constructing all shards of the table, ShardList=["All"]
},
"ipList":"1.1.1.1 tcaplus tcaplus",
"uLogBackupTime":"2018-03-07",
"backType":1,"maxConcurrentActionNum":10
}
//Note: The key format in tableInfoList is: {app_id}-{zone_id}-{table_name}
Return Syntax
Return Parameter Description
When the returned status code is not 200, it indicates failure. The returned data is the message about the failure to construct table data
When the returned status code is 200, it indicates that the table data structure was created successfully. The returned data structure is as follows:
| Field name | Data type | Description | Remarks |
|---|---|---|---|
| trans_id | integer | id of the corresponding transaction executed | |
| set_id | integer | Set of the transaction |
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 '{
"setId": 126,
"tableInfoList": {
"2-3-add_table1": {
"AppID": 2,
"ZoneID": 3,
"TableName": "add_table1",
"ShardNun": 1,
"ShardList": [
1
]
},
"2-3-add_table2": {
"AppID": 2,
"ZoneID": 3,
"TableName": "add_table2",
"ShardNum": 1,
"ShardList": [
6
]
} //When constructing all shards of the table, ShardList=["All"]
},
"ipList":"1.1.1.1 tcaplus tcaplus",
"uLogBackupTime":"2018-03-07",
"backType":1,"maxConcurrentActionNum":10
}
//Note: The key format in tableInfoList is: {app_id}-{zone_id}-{table_name}' http://omsaddress/app/newoms.php/webservice/oamp/table-data/make?cmd=10011&ip-type=webservicerest&access-token=\
Return Example
Successful Return Example
Status of http request = 200
{
"set_id": "126",
"TransId": 108,
"username": "username"
}
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"
}
{
"Error": [
"The Ulog retraction time point must be greater than the cold backup date"
]
}