TableDataImport
Generate Data Import Transaction
Request address
POST
http://OmsAddress/app/newoms.php/webservice/oamp/table-data/import?cmd=10013&ip-type=webservicerest&access-token=AccessTokenVal
POST request parameter description
| Parameter name | Data type | Description | Whether the field is required | Remarks | |
|---|---|---|---|---|---|
| set_id | integer | set id of the transaction | Yes | ||
| tableKeysList | Array | table list to be imported | Yes | ||
| importSpeed | integer | Data import speed, return: (0, 50000] | Yes | ||
| RollBackType | integer | Data import type 0: full import 1: partial rollback | Yes | ||
| DataType | integer | Data source type 0: associated transaction ID 1: manual input | Yes | ||
| RelateTransId | integer | When DataType = 0, it is the ID of the associated transaction | When DataType = 0, it is required | ||
| ipList | string | When DataType = 1, it is the path on the data machine, and its format is: ip username password rollback_dir, and the account password cannot contain (\ | ; - space), multiple values are separated by newlines, such as 1.1.1.1 tcaplus tcaplus/data/rollback_dir | When DataType = 1, it is required | |
| deleteBeforeImport | integer | Do you want to delete online data before importing? The default value is 0, not deleted, and 1 is deleted | NO |
Data Parameters
Use json format to represent the record related information. The following is an example:
{
"setId": 126,
"tableKeysList": [
{
"AppID": 2,
"ZoneID": 1,
"TableName": "type_right_4"
}
],
"ipList": "1.1.1.1 tcaplus tcaplus /data/rollback_dir",
"importSpeed": 2000,
"RollBackType": 0,
"DataType": 1
}
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
| 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,
"tableKeysList": [
{
"AppID": 2,
"ZoneID": 1,
"TableName": "type_right_4"
}
],
"ipList": "1.1.1.1 tcaplus tcaplus /data/rollback_dir",
"importSpeed": 2000,
"RollBackType": 0,
"DataType": 1
}' http://omsaddress/app/newoms.php/webservice/oamp/table-data/import?cmd=10013&ip-type=webservicerest&access-token=\
Return Example
Successful Return Example
Status of http request = 200
{
"SetId": "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": [
"can not find app_id(2),zone_id(3),table_name(add_table19)"
]
}