[tcallusdb knowledge base] restfulapi2 0 for list table - [Pb] listgetallrecords2 0 Introduction
brief introduction
Query all records under the corresponding Key in the List PB table, and Limit the number of records returned each time through Limit and Offset.
- Limit: limit the number of records returned. If the limit is - 1, all records will be returned
- Offset: Specifies the record offset
POST http://{Tcaplus_REST_URL}
Request syntax
Http request
#Tencent cloud console RESTful Endpoint, ip:80, port: 80 by default http://172.17.0.22 #Tcallusdb local docker RESTful Endpoint, ip:31001, port default 31001 http://9.135.8.93:31001
Http head
x-tcaplus-target:Tcaplus.ListGetAllRecords x-tcaplus-app-id:{string} x-tcaplus-zone-id:{string} x-tcaplus-protocol-version:{string} x-tcaplus-table-name:{string} x-tcaplus-pwd-md5:{string} x-tcaplus-result-flag:result_flag x-tcaplus-version:{string} x-tcaplus-data-version-check:{string} x-tcaplus-idl-type:protobuf
Parameter Description:
name | Required | Restrictions | explain |
---|---|---|---|
x-tcaplus-target | yes | nothing | Tcaplus.ListGetAllRecords |
x-tcaplus-version | yes | nothing | Tcaplus3.50.0 |
x-tcaplus-app-id | yes | nothing | Corresponding service id number (aka, cluster access id) |
x-tcaplus-zone-id | yes | nothing | Corresponding zone number (aka, table group id) |
x-tcaplus-protocol-version | yes | nothing | The corresponding protocol version number is 2.0 by default |
x-tcaplus-table-name | yes | nothing | Corresponding table name |
x-tcaplus-pwd-md5 | yes | nothing | Business password (aka, cluster access password), enter the calculated md5 value |
x-tcaplus-idl-type | yes | nothing | protobuf |
x-tcaplus-result-flag | no | nothing | 0: no data will be returned after successful operation 1: data consistent with the request will be returned after successful operation 2: data after this update operation will be returned after successful operation 3: data before tcapsvr operation will be returned after successful operation |
x-tcaplus-data-version-check | no | 1: Detect the record version number. The version number will increase automatically only when it is the same as the server version number. 2: do not detect the record version number, and force the record version number of the client to be written to the server. 3: do not detect the record version number, and increase the server version number automatically | |
x-tcaplus-data-version | no | Specific version value |
Example:
x-tcaplus-target:Tcaplus.ListGetAllRecords x-tcaplus-app-id:3 x-tcaplus-zone-id:1 x-tcaplus-protocol-version:2.0 x-tcaplus-table-name:tb_online_list x-tcaplus-pwd-md5:4e81984efccfb4982333aeb1ff7968d5 x-tcaplus-result-flag:2 x-tcaplus-version:Tcaplus3.50.0 x-tcaplus-data-version-check: 3 x-tcaplus-idl-type:protobuf
Data
json format is used to represent relevant information. appoint
- Offset: Specifies the offset to get the record
- Limit: Specifies the number of records returned each time. A value of - 1 indicates the number of all records returned
- Record: Specifies the primary key of the record to get
{ "Record": { "openid": 1, "timekey": "1", "tconndid": 1 }, "Offset": 0, "Limit": -1 }
Full request example
curl -i -XPOST -H 'x-tcaplus-target: Tcaplus.ListGetAllRecords' -H 'x-tcaplus-app-id: 70' -H 'x-tcaplus-zone-id: 1' -H 'x-tcaplus-protocol-version: 2.0' -H 'x-tcaplus-table-name: tb_online_list' -H 'x-tcaplus-pwd-md5: 0972ad76decf4d11a69e2e0d9af335da' -H 'x-tcaplus-result-flag: 1' -H 'x-tcaplus-version: Tcaplus3.50.0' -H 'x-tcaplus-data-version-check: 1' -H 'x-tcaplus-idl-type: protobuf' http://172.17.32.17 -d '{ "Record": { "openid": 1, "timekey": "1", "tconndid": 1 }, "Offset": 0, "Limit": -1 }'
Return syntax
Return parameter description
Parameter name | explain |
---|---|
ErrorCode | Return code |
ErrorMsg | Return information |
RecordVersion | Version number of the current record |
SucceedRecords | json format, the returned Data of successful records, see the Data section in the text for details |
SucceedNum | Number of successful records |
FailedRecords | json format, return Data of failed records, see the Data section in the text for details |
FailedNum | Number of failed records |
Return example
Successful examples
{"ErrorCode":0,"ErrorMsg":"Succeed","SucceedRecords":[{"RecordVersion":27,"Index":3,"Record":{"openid":1,"tconndid":1,"timekey":"1","gamesvrid":"4","logintime":4,"lockid":[],"pay":{"total_money":4,"pay_times":4}}},{"RecordVersion":27,"Index":4,"Record":{"openid":1,"tconndid":1,"timekey":"1","gamesvrid":"1","logintime":1,"lockid":[],"pay":{"total_money":1,"pay_times":1}}},{"RecordVersion":27,"Index":5,"Record":{"openid":1,"tconndid":1,"timekey":"1","gamesvrid":"2","logintime":2,"lockid":[],"pay":{"total_money":2,"pay_times":2}}},{"RecordVersion":27,"Index":6,"Record":{"openid":1,"tconndid":1,"timekey":"1","gamesvrid":"3","logintime":3,"lockid":[],"pay":{"total_money":3,"pay_times":3}}},{"RecordVersion":27,"Index":7,"Record":{"openid":1,"tconndid":1,"timekey":"1","gamesvrid":"4","logintime":4,"lockid":[],"pay":{"total_money":4,"pay_times":4}}},{"RecordVersion":27,"Index":8,"Record":{"openid":1,"tconndid":1,"timekey":"1","gamesvrid":"1","logintime":1,"lockid":[],"pay":{"total_money":1,"pay_times":1}}},{"RecordVersion":27,"Index":9,"Record":{"openid":1,"tconndid":1,"timekey":"1","gamesvrid":"2","logintime":2,"lockid":[],"pay":{"total_money":2,"pay_times":2}}},{"RecordVersion":27,"Index":10,"Record":{"openid":1,"tconndid":1,"timekey":"1","gamesvrid":"3","logintime":3,"lockid":[],"pay":{"total_money":3,"pay_times":3}}},{"RecordVersion":27,"Index":11,"Record":{"openid":1,"tconndid":1,"timekey":"1","gamesvrid":"4","logintime":4,"lockid":[],"pay":{"total_money":4,"pay_times":4}}},{"RecordVersion":27,"Index":13,"Record":{"openid":1,"tconndid":1,"timekey":"1","gamesvrid":"2","logintime":2,"lockid":[],"pay":{"total_money":2,"pay_times":2}}},{"RecordVersion":27,"Index":14,"Record":{"openid":1,"tconndid":1,"timekey":"1","gamesvrid":"3","logintime":3,"lockid":[],"pay":{"total_money":3,"pay_times":3}}},{"RecordVersion":27,"Index":15,"Record":{"openid":1,"tconndid":1,"timekey":"1","gamesvrid":"4","logintime":4,"lockid":[],"pay":{"total_money":4,"pay_times":4}}},{"RecordVersion":27,"Index":16,"Record":{"openid":1,"tconndid":1,"timekey":"1","gamesvrid":"1","logintime":1,"lockid":[],"pay":{"total_money":1,"pay_times":1}}},{"RecordVersion":27,"Index":17,"Record":{"openid":1,"tconndid":1,"timekey":"1","gamesvrid":"2","logintime":2,"lockid":[],"pay":{"total_money":2,"pay_times":2}}},{"RecordVersion":27,"Index":18,"Record":{"openid":1,"tconndid":1,"timekey":"1","gamesvrid":"3","logintime":3,"lockid":[],"pay":{"total_money":3,"pay_times":3}}},{"RecordVersion":27,"Index":19,"Record":{"openid":1,"tconndid":1,"timekey":"1","gamesvrid":"4","logintime":4,"lockid":[],"pay":{"total_money":4,"pay_times":4}}},{"RecordVersion":27,"Index":20,"Record":{"openid":1,"tconndid":1,"timekey":"1","gamesvrid":"1","logintime":1,"lockid":[],"pay":{"total_money":1,"pay_times":1}}},{"RecordVersion":27,"Index":21,"Record":{"openid":1,"tconndid":1,"timekey":"1","gamesvrid":"3","logintime":3,"lockid":[],"pay":{"total_money":3,"pay_times":3}}},{"RecordVersion":27,"Index":22,"Record":{"openid":1,"tconndid":1,"timekey":"1","gamesvrid":"4","logintime":4,"lockid":[],"pay":{"total_money":4,"pay_times":4}}}],"SucceedNum":19}
Failure example
{ "ErrorCode": 261, "ErrorMsg": "Record does not exist" }
Tcallusdb is a distributed NoSQL database produced by Tencent. The storage and scheduling code is completely self-developed. It has the characteristics of cache + floor fusion architecture, PB level storage, millisecond delay, lossless horizontal expansion and complex data structure. At the same time, it has the characteristics of rich ecology, convenient migration, extremely low operation and maintenance cost and five nine high availability. Customers cover games, Internet, government affairs, finance, manufacturing, Internet of things and other fields.