[PB] ListGetAllRecords2.0

Initial version: 3.50.0

Brief Introduction

Get all records from the corresponding Key in a 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: Specify 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
#TcaplusDB Local docker RESTful Endpoint, ip: 31001, port: 31001 by default
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 or not Limitations Description
x-tcaplus-target Yes None Tcaplus.ListGetAllRecords
x-tcaplus-version Yes None Tcaplus3.50.0
x-tcaplus-app-id Yes None Correspond to the app id number(aka, cluster access id)
x-tcaplus-zone-id Yes None Correspond to the zone number (aka, table group id)
x-tcaplus-protocol-version Yes None Correspond to the protocol version number, default 2.0
x-tcaplus-table-name Yes None Correspond to the table name
x-tcaplus-pwd-md5 Yes None App password (aka, cluster access password), that is, the md5 value after the calculation
x-tcaplus-idl-type Yes None protobuf
x-tcaplus-result-flag No None 0: No data will be returned after successful operation; 1: After the operation is successful, the data that is consistent with the request will be returned; 2: After the operation is successful, the data after this update operation will be returned; 3: After the operation is successful, the data before the tcapsvr operation will be returned
x-tcaplus-data-version-check No 1: Detect the record version number. Only when the version number is the same as the server version number, the version number will automatically increase; 2: Do not detect the record version number, but force the client record version number to be written to the server; 3: Do not detect the record version number, and automatically increase the server version number
x-tcaplus-data-version No Version number

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

Use json format to represent the record related information. Specify

  • Offset: Specify the record offset
  • Limit: Specify the number of records returned each time. If the Limit is -1, all records will be returned,The number of all elements under the key can be set to 1
  • Record: specifies the primary key of the record to return.
{
    "Record": {
                "openid": 1,
                "timekey": "1",
                "tconndid": 1
        },
    "Offset": 0,
    "Limit": -1
}

Complete 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 Description
ErrorCode Return code
ErrorMsg Return message
RecordVersion Version number of the current record
SucceedRecords Data returned of successful records in json format. For details, refer to Data section
SucceedNum Number of successful records
FailedRecords Data returned of failed records in json format. For details, refer to Data section
FailedNum Number of failed records
TotalNum Total number of records

Return Example

Successful Return Example

{"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,"TotalNum":19}

Failed Return Example

{
    "ErrorCode": 261,
    "ErrorMsg": "Record does not exist"
}

Error code

Refer to Common Error Codes

Other Reference Documents

[PB List Table][C++ SDK] Interface Description for Getting All Elements from a List

[PB List Table] [Go SDK] Interface Description for Getting All Elements from a List

results matching ""

    No results matching ""