Attachment
Upload xml/tdr File Defining Table Structure
Support proto files when adding tables
Request address
POST
http://OmsAddress/app/newoms.php/webservice/attachment?app_id=appId&zone_id=zoneId&cmd=10001&ip-type=webservicerest&access-token=AccessTokenVal
GET parameter description in url
| Field name | Data type | Description | Whether it is required | Remarks |
|---|---|---|---|---|
| app_id | integer | app id of the uploaded file | No | It is recommended to specify the value of the app_id parameter, so that the file uploaded using the interface can not only be used on the tcaplus oms page, but also be convenient to query problems |
| zone_id | integer | game zone id of the uploaded file | No |
POST request parameter description
| Field name | Data type | Description | Whether it is required | Remarks |
|---|---|---|---|---|
| filename | string | name of the file to be uploaded | Yes | |
| content | string | The content of the file to be uploaded (the maximum content of the uploaded file is 10M) | Yes |
Data Parameters
Use json format to represent the record related information. The following is an example:
{
"filename": "check_modify_generic_table.xml",
"content": "<?xml version=\"1.0\" encoding=\"GBK\" standalone=\"yes\" ?> <metalib name=\"table_test\" tagsetversion=\"1\" version=\"1\"><struct name=\"test_table_generic_modify\" version=\"1\" splittablekey=\"gameid\" primarykey=\"gameid,itemid,name\"><entry name=\"gameid\" type=\"uint\" /><entry name=\"itemid\" type=\"uint\" /><entry name=\"name\" type=\"string\" size=\"250\" /><entry name=\"typeid\" type=\"uint8\"/><entry name=\"Data\" type=\"tinyuint\" defaultvalue=\"9\"/><entry name=\"uname\" type=\"string\" size=\"5\" defaultvalue=\"ab\"/><index name=\"index1\" column=\"gameid\" /></struct></metalib>"
}
Example of uploading proto file:
{
"filename": "test_table.proto",
"content": "syntax = \"proto3\";package myTcaplusTable;import \"tcaplusservice.optionv1.proto\;"
}
Return Syntax
Return Parameter Description
| Field name | Data type | Description | Remarks |
|---|---|---|---|
| id | integer | id of the uploaded file, "3.5.2 Table Addition Application (tdr/xml)", and this value is required when applying for table modification | |
| file_name | string | name of the uploaded file | |
| file_size | string | size of the uploaded file | |
| file_ext | string | suffix of the uploaded file |
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 '{
"filename": "check_modify_generic_table.xml",
"content": "<?xml version=\"1.0\" encoding=\"GBK\" standalone=\"yes\" ?> \\ "\ \ \ \ \ \ \
}' http://omsaddress/app/newoms.php/webservice/attachment?app_id=\&zone_id=\ &cmd=10001&ip-type=webservicerest&access-token=\
Return Example
Successful Return Example
Status of http request = 200
{
"id": 99,
"file_name": "check_modify_generic_table",
"file_size": 545,
"file_ext": "xml",
"url": "http://10.123.16.72/app/global/uploadfile/2017/03/02/2017030219481393920952.xml"
}
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"
}
{
"source_ip": "ip:10.29.89.51 not in whitelist"
}