[tcallusdb knowledge base] restfulapi2 0 for generic table - [Pb] partkeygetrecord2 0 Introduction

brief introduction

Obtain relevant records according to the primary key index, which is defined in the table definition proto file. The primary key index is an index designed based on the primary key field. The interface also supports the return of filter fields. Specify the field name to be returned through the Select parameter; The number of records returned can be controlled and specified through the parameter Limit.

POST http://{Tcaplus_REST_URL}

Request syntax

Http request

#Tencent cloud console RESTful Endpoint, ip:80, port: 80 by default
#Tcallusdb local docker RESTful Endpoint, ip:31001, port default 31001

Http request header parameters

x-tcaplus-app-idyesnothingCorresponding service id number (aka, cluster access id)
x-tcaplus-zone-idyesnothingCorresponding zone number (aka, table group id)
x-tcaplus-protocol-versionyesnothingThe corresponding protocol version number is 2.0 by default
x-tcaplus-table-nameyesnothingCorresponding table name
x-tcaplus-pwd-md5yesnothingBusiness password (aka, cluster access password), enter the calculated md5 value
x-tcaplus-result-flagnonothing0: 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-checkno1: 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-versionnoSpecific version value


x-tcaplus-data-version-check: 3


Record related information in json format. Parameter Description:

  • Select: optional. Filter the returned field and specify the field name. It cannot be a primary key field name.
  • Limit: optional, which limits the number of records returned per request
  • Record: the primary key index field must be specified


    "Limit": 1,
    "Record": {
        "player_id": 5,
        "player_name": "5"
    "Select": ["game_server_id", "is_online", "pay"]

Full request example

curl -i -XPOST -H 'x-tcaplus-target: Tcaplus.GetRecordByPartKey' -H 'x-tcaplus-app-id: 70' -H 'x-tcaplus-zone-id: 1' -H 'x-tcaplus-protocol-version: 2.0' -H 'x-tcaplus-table-name: game_players' -H 'x-tcaplus-pwd-md5: 0972ad76decf4d11a69e2e0d9af335da' -H 'x-tcaplus-result-flag: 2' -H 'x-tcaplus-version: Tcaplus3.50.0' -H 'x-tcaplus-data-version-check: 3' -H 'x-tcaplus-idl-type: protobuf' -d '{
    "Record": {
    "Select":["game_server_id", "is_online", "pay"]

Return syntax

Return parameter description

Parameter nameexplain
ErrorCodeReturn code
ErrorMsgReturn information
RecordVersionRecord version number
MultiRecordsjson format, the successful Record returns the data array, and the array element is Record record Record data
TotalNumNumber of successful records

Return example

Successful return example

    "ErrorCode": 0,
    "ErrorMsg": "Succeed",
    "MultiRecords": [{
        "RecordVersion": 1,
        "Record": {
            "game_server_id": 55,
            "is_online": false,
            "pay": {
                "pay_id": 55,
                "amount": 55,
                "method": 55
            "player_email": "55",
            "player_id": 5,
            "player_name": "5"
    }, {
        "RecordVersion": 1,
        "Record": {
            "game_server_id": 5,
            "is_online": false,
            "pay": {
                "pay_id": 5,
                "amount": 5,
                "method": 5
            "player_email": "5",
            "player_id": 5,
            "player_name": "5"
    "TotalNum": 2

Failure return 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.

Keywords: Database nosql TcaplusDB

Added by rosegarden on Mon, 21 Feb 2022 04:35:16 +0200