【TcaplusDB知识库】检查指定的的xml、tdr、proto文件定义的表
加表时支持proto文件
请求地址
POST
http://OmsAddress/app/newoms.php/webservice/attachment?app_id=appId&zone_id=zoneId&cmd=10001&ip-type=webservicerest&access-token=AccessTokenVal
url中GET参数说明
| 字段名称 | 数据类型 | 说明 | 是否为必填字段 | 备注 |
|---|---|---|---|---|
| app_id | 整型 | 上传文件所属业务id | 否 | 建议指定app_id参数的值,这样使用接口上传的文件在tcaplus oms页面上也可以使用,同时方便查询问题 |
| zone_id | 整型 | 上传文件所属游戏区的id | 否 |
POST请求参数说明
| 字段名称 | 数据类型 | 说明 | 是否为必填字段 | 备注 |
|---|---|---|---|---|
| filename | 字符串 | 需要上传的文件的名称 | 是 | |
| content | 字符串 | 需要上传的文件的内容(上传的文件内容上限为10M) | 是 |
Data参数
使用json格式表示记录相关信息,示例如下:
{
"filename": "check_modify_generic_table.xml",
"content": "<?xml version=\"1.0\" encoding=\"GBK\" standalone=\"yes\" ?> "
}
上传proto文件示例:
{
"filename": "test_table.proto",
"content": "syntax = \"proto3\";package myTcaplusTable;import \"tcaplusservice.optionv1.proto\;"
}
返回语法
返回参数说明
| 字段名称 | 数据类型 | 说明 | 备注 |
|---|---|---|---|
| id | 整型 | 上传的文件的id,“3.5.2 申请(tdr/xml)文件加表”、申请修改表时需要使用此值 | |
| file_name | 字符串 | 上传的文件名称 | |
| file_size | 字符串 | 上传的文件大小(B) | |
| file_ext | 字符串 | 上传的文件后缀 |
请求示例
通过 curl 方法发起请求
命令中的红色部分是需要用户自行填写的参数,请参阅
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=
返回示例
成功返回示例
http请求的Status=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"
}
错误返回
http请求的Status!=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"
}
