Skip to content

Player API

atsanan edited this page Sep 16, 2019 · 17 revisions

1. Player API

1.1 Get player info

GET /api/v1/player/info?fields=player,user

Query parameters:

Field Description Optional Auth
fields Set of fields selections (user, player) NO Yes

Returns:

{
    "data": {
        "player": {
            "id": "5b2ca882bdfdd84f1fa5fe44",
            "userId": "5b2ca881bdfdd84f1fa5fe40",
            "playerName": "undefined",
            "teamPlayerId": -1,
            "coin": 501,
            "diamond": 10,
            "costumeSelectId": 1,
            "costumeList": [
                1,
                2
            ],
            "createAt": "0001-01-01T00:00:00Z",
            "lastModified": "2018-06-22T11:10:52.845Z"
        },
        "user": {
            "id": "5b2ca881bdfdd84f1fa5fe40",
            "name": "Nattapon Rattajak",
            "firstname": "Nattapon",
            "lastname": "Rattajak",
            "gender": "male",
            "birthdate": "11/06/1989",
            "password": "",
            "email": "nattapon.r@live.com",
            "tel": "",
            "authenTypeId": 1,
            "authenId": "10203051208741885",
            "authenToken": "",
            "verified": true,
            "verifiedAt": "2018-06-22T07:47:35.04Z",
            "createAt": "2018-06-22T07:47:35.04Z",
            "lastModified": "0001-01-01T00:00:00Z"
        }
    },
    "isSuccess": true
}

1.2 Get and update player coin/diamond

GET /api/v1/player/coinAndDiamond 
    **(No longer maintenance please use /player/info instead.)**
POST /api/v1/player/coinAndDiamond

Query parameters:

Field Description Optional Auth
coin Coin is the currency, that use in game can get in play Yes Yes
diamond Diamond is rare currnecy, that is used for in-app purchase Yes Yes

Returns:

{
    "data": {
        "_id": "5b2ca882bdfdd84f1fa5fe44",
        "coin": 501,
        "diamond": 10
    },
    "isSuccess": true
}

1.3 Update player costumes (select/update/new)

  • GET /api/v1/player/costume (No longer maintenance please use /player/info instead.)
  • POST /api/v1/player/costume
  • POST /api/v1/player/costume/new (buy new costume)

Query parameters:

Field Description Optional Auth
costumeSelectId ID of the selected costume No Yes

Returns:

{
    "data": {
        "id": "5b2ca882bdfdd84f1fa5fe44",
        "userId": "5b2ca881bdfdd84f1fa5fe40",
        "playerName": "undefined",
        "teamPlayerId": -1,
        "coin": 501,
        "diamond": 10,
        "costumeSelectId": 2,
        "costumeList": [
            1,
            2
        ],
        "createAt": "0001-01-01T00:00:00Z",
        "lastModified": "2018-06-22T10:59:44.144Z"
    },
    "isSuccess": true
}

1.4 Update player.teamplayer (update)

  • GET /api/v1/player/teamplayer (No longer maintenance please use /player/info instead.)

  • POST /api/v1/player/teamplayer

Query parameters:

Field Description Optional Auth
teamPlayerId Team type of game No Yes

Returns:

{
    "data": {
        "id": "5b2ca882bdfdd84f1fa5fe44",
        "userId": "5b2ca881bdfdd84f1fa5fe40",
        "playerName": "undefined",
        "teamPlayerId": 1,
        "coin": 501,
        "diamond": 10,
        "costumeSelectId": 1,
        "costumeList": [
            1,
            2
        ],
        "createAt": "0001-01-01T00:00:00Z",
        "lastModified": "2018-06-22T11:58:12.412Z"
    },
    "isSuccess": true
}

1.5 Get players list (backend)

  • GET /api/v1/player/all?page=0&limit=10

Query parameters:

Field Description Optional Default Authen
page Current index of page Yes 0 admin
limit Maximum number of page Yes 10 admin

Returns:

{
    "data": {
        "pageIndex": 0,
        "pageLimit": 1,
        "pages": 2,
        "paging": {
            "next": "/api/v1/players?page=1&limit=1",
            "previous": ""
        },
        "players": [
            {
                "id": "5b2ca882bdfdd84f1fa5fe44",
                "userId": "5b2ca881bdfdd84f1fa5fe40",
                "playerName": "undefined",
                "teamPlayerId": 1,
                "coin": 501,
                "diamond": 10,
                "costumeSelectId": 1,
                "costumeList": [
                    1,
                    2
                ],
                "createAt": "0001-01-01T00:00:00Z",
                "lastModified": "2018-06-22T11:58:12.412Z"
            }
        ]
    },
    "isSuccess": true
}

1.6 Delete player (backend)

DELETE /api/v1/player/{id} **Not yet implemented**

Note

Delete data table "MonsterPlayer" where playerId
Delete data table "ItemPlayer" where playerId
Delete data table "JoinChannel" where playerId
Delete data table "MonsterStickers" where sendFromId or sendToId

Query parameters: Returns:

{
    isSuccess : bool,
    errorCode : int,
    errorMessage : string
}

1.7 Update player (backend)

POST /api/v1/player/{id : string}
JSON body :
Field Description Optional Auth
playerName Name of the player No admin
teamPlayerId Team's ID from selected No
coin Current coins of player No
diamond Current diamonds of player No
costumeSelectId Selected costume ID No
costumeList All Costume's ID, that player have No
Returns:
{
    "data": {
        "id": "5b2ca882bdfdd84f1fa5fe44",
        "userId": "5b2ca881bdfdd84f1fa5fe40",
        "playerName": "test boobo",
        "teamPlayerId": 1,
        "coin": 1,
        "diamond": 500,
        "costumeSelectId": 1,
        "costumeList": [],
        "createAt": "0001-01-01T00:00:00Z",
        "lastModified": "2018-06-25T11:40:46.218Z"
    },
    "isSuccess": true
}

1.7 Update player

POST /api/v1/player/{id : string}
FormData :
Field Description Optional Auth
gender gender No admin
costumeList costumeList No admin
Returns:
{
    "data": {
        "id": "5b2ca882bdfdd84f1fa5fe44",
        "userId": "5b2ca881bdfdd84f1fa5fe40",
        "playerName": "test boobo",
        "teamPlayerId": 1,
        "coin": 1,
        "diamond": 500,
        "costumeSelectId": 1,
        "costumeList": [],
        "createAt": "0001-01-01T00:00:00Z",
        "lastModified": "2018-06-25T11:40:46.218Z"
    },
    "isSuccess": true
}

Clone this wiki locally