【TcaplusDB知识库】如何申请创建表索引


【TcaplusDB知识库】如何申请创建表索引

申请创建表索引,如果有其他表操作申请单未处理,会报冲突

请求地址

POST
http://OmsAddress/app/newoms.php/webservice/business/table/apply-table-index?cmd=10022&ip-type=webservicerest&access-token=AccessTokenVal

POST请求参数说明

参数格式是否必填说明
app_id 整型 业务ID
zone_id 字符串  
table_name 字符串  
key_index_fields 数组 选择哪个key字段作为索引
value_index_fields 数组 选择哪个value字段作为索引
memo 备注 apply by webservice

 

Data参数

使用json格式表示记录相关信息,示例如下:

{
  "app_id": 2,
  "zone_id": 4,
  "table_name": "T_CHESS_COMMENT",
  "key_index_fields": [
      "chess_id"
  ],
  "value_index_fields": [
      "thumb_num"
  ],
  "memo": "apply by webservice"
}

返回语法

返回参数说明

需要关注的参数是 apply,info,id, 在审核的时候需要用到

请求示例

通过 curl 方法发起请求

命令中的红色部分是需要用户自行填写的参数,请参阅url中GET参数说明

curl -H "Content-type: application/json" -X "POST" -d '{ "app_id": 2, "zone_id": 4, "table_name": "T_CHESS_COMMENT", "key_index_fields": [ "chess_id" ], "value_index_fields": [ "thumb_num" ], "memo": "apply by webservice" }' http://omsaddress/app/newoms.php/webservice/business/table/apply-table-index?cmd=10022&ip-type=webservicerest&access-token=

返回示例

成功返回示例

http请求的Status=200

{
  "apply": {
      "ret": 0,
      "info": {
          "dba": "tcaplus;peterwong",
          "set_id": 1,
          "app_id": 2,
          "app_name": "test_app",
          "zone_list": "4",
          "table_name": "T_CHESS_COMMENT",
          "table_type": 0,
          "apply_type": 14,
          "user": "peterwong",
          "write_time": "2020-10-16 14:21:56",
          "memo": "apply by webservice",
          "job_id": 21,
          "key_struct": "[\"chess_id\"]",
          "value_struct": "[\"thumb_num\"]",
          "dm_ratio": 5,
          "table_maxnum": 0,
          "calc_resource_type": 1,
          "attention_man": "",
          "kelly_id": 0,
          "resource_ratio": 1,
          "sort_field_num": 0,
          "sort_rule": 0,
          "data_protocol_type": "TBD",
          "id": 117
      },
      "msg": ""
  }
}

错误返回

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"
}

更多信息请关注TcaplusDB微信公众号,风里雨里,我们一直在等你!

img

TcaplusDB是腾讯出品的分布式NoSQL数据库,存储和调度的代码完全自研。具备缓存+落地融合架构、PB级存储、毫秒级时延、无损水平扩展和复杂数据结构等特性。同时具备丰富的生态、便捷的迁移、极低的运维成本和五个九高可用等特点。客户覆盖游戏、互联网、政务、金融、制造和物联网等领域。