Getting Started With Whalepass - whalepass/documentation GitHub Wiki

Getting Started With Whalepass

⚠️ Warning
THIS PAGE IS DEPRECATED! PLEASE USE THIS LINK INSTEAD

Whalepass.gg

⚠️ Warning
THIS PAGE IS DEPRECATED! PLEASE USE THIS LINK INSTEAD

The Whalepass API is designed with a RESTful architecture, featuring resource-oriented URLs that are predictable, accepting JSON requests and delivering JSON responses, while also utilizing standard HTTP response codes, authentication mechanisms, and verbs.

If you have any questions, comments or feedback the following avenues are available:

  • Joining the community discussion: Here
  • Joining our Discord server: Here
  • Reaching out via email: [email protected]
  • Reaching out via our contact page (Intercom): Here

Prerequisites

Log in to your Whalepass developer dashboard and setup the leveling system and challenges for your game. Fill out any rewards using the rewards page first so you can easily assign them for each level.

API Key & Authentication

Your API key can easily be found in your developer dashboard inside the API Key page.

Must be added as a header X-API-KEY

⚠️ Warning
Please be sure to only use this API key in the backend of your game

Enrolling A Player for your game

Request:

POST https://api.whalepass.gg/enrollments
{
  "playerId": "string", 
  "gameId": "string" 
}

Expected Response:

{
  "id": "string",
  "externalPlayerId": "string",
  "gameId": "string",
  "userId": "string",
  "accountConnected": true,
  "createdAt": "2023-12-26T13:05:17.428Z",
  "updatedAt": "2023-12-26T13:05:17.428Z"
}

Incrementing A Player's Experience Points

This endpoint doesn't accept battlepassId in the request body anymore. It will work for the ACTIVE Battlepass of the game in the request body.

To test specific DRAFT Battlepass, add X-Battlepass-Id header to request

Request:

POST https://api.whalepass.gg/players/{playerId}/progress/exp
{
  "gameId": "string",
  "additionalExp": 0
}

Expected response: 200 OK

Completing A Challenge For A Player

This endpoint doesn't accept battlepassId in the request body anymore. It will work for the ACTIVE Battlepass of the game in the request body.

To test specific DRAFT Battlepass, add X-Battlepass-Id header to request

Request:

POST https://api.whalepass.gg/players/{playerId}/progress/challenge
{
  "gameId": "string",
  "challengeId": "string"
}

Expected response: 200 OK

Completing a Game Action For A Player

Called when player completes a specific game action to update experience point To test specific DRAFT Battlepass, add X-Battlepass-Id header to request

Request:

POST https://api.whalepass.gg/players/{playerId}/progress/action
{
  "gameId": "string",
  "actionId": "string"
}

Expected Response:

{
  "playerBattlepassProgress": {
    "id": "string",
    "playerId": "string",
    "battlepassId": "string",
    "currentExp": 0,
    "lastCompletedLevel": 0,
    "completedLevels": [
      0
    ],
    "completedChallenges": [
      "string"
    ],
    "createdAt": "2023-12-27T09:53:34.155Z",
    "updatedAt": "2023-12-27T09:53:34.155Z"
  },
  "completedLevels": [
    {
      "id": "string",
      "battlepassId": "string",
      "level": 0,
      "expRequired": 0,
      "status": true,
      "freeTierRewards": [
        {
          "id": "string",
          "gameId": "string",
          "battlepassId": "string",
          "tokenId": "string",
          "amount": 0,
          "amountInDecimal": 0,
          "createdAt": "2023-12-27T09:53:34.155Z",
          "updatedAt": "2023-12-27T09:53:34.155Z"
        }
      ],
      "premiumTierRewards": [
        {
          "id": "string",
          "gameId": "string",
          "battlepassId": "string",
          "tokenId": "string",
          "amount": 0,
          "amountInDecimal": 0,
          "createdAt": "2023-12-27T09:53:34.155Z",
          "updatedAt": "2023-12-27T09:53:34.155Z"
        }
      ]
    }
  ]
}

Getting Player's Progress

To test specific DRAFT Battlepass, add X-Battlepass-Id header to request

Request:

GET https://api.whalepass.gg/players/{playerId}/progress?gameId={gameId}

Expected Response:

{
  "player": {
    "id": "string",
    "externalPlayerId": "string",
    "gameId": "string",
    "userId": "string",
    "accountConnected": true,
    "createdAt": "2023-12-27T10:58:40.064Z",
    "updatedAt": "2023-12-27T10:58:40.064Z"
  },
  "battlepassProgress": {
    "battlepassId": "string",
    "currentExp": 0,
    "lastCompletedLevel": 0,
    "levels": [
      {
        "id": "string",
        "battlepassId": "string",
        "level": 0,
        "expRequired": 0,
        "active": true,
        "freeTierRewards": [
          {
            "id": "string",
            "gameId": "string",
            "battlepassId": "string",
            "name": "string",
            "amount": 0,
            "amountInDecimal": 0
          }
        ],
        "premiumTierRewards": [
          {
            "id": "string",
            "gameId": "string",
            "battlepassId": "string",
            "name": "string",
            "amount": 0,
            "amountInDecimal": 0
          }
        ],
        "completed": true
      }
    ],
    "challenges": [
      {
        "id": "string",
        "battlepassId": "string",
        "name": "string",
        "startDate": "2023-12-27T10:58:40.064Z",
        "endDate": "2023-12-27T10:58:40.064Z",
        "active": true,
        "premium": true,
        "rewards": [
          {
            "id": "string",
            "gameId": "string",
            "battlepassId": "string",
            "name": "string",
            "amount": 0,
            "amountInDecimal": 0
          }
        ],
        "completed": true
      }
    ]
  }
}

Getting Player Progress by Player Ids Search

To test specific DRAFT Battlepass, add X-Battlepass-Id header to request

Request:

GET https://api.whalepass.gg/players/progress
{
  "playerIds": ["string"],
  "gameId": "string"
}

Expected Response:

{
  "progressList": [
    {
      "player": {
        "id": "string",
        "externalPlayerId": "string",
        "gameId": "string",
        "userId": "string",
        "accountConnected": true,
        "createdAt": "2023-12-27T10:59:15.390Z",
        "updatedAt": "2023-12-27T10:59:15.390Z"
      },
      "battlepassProgress": {
        "battlepassId": "string",
        "currentExp": 0,
        "lastCompletedLevel": 0,
        "levels": [
          {
            "id": "string",
            "battlepassId": "string",
            "level": 0,
            "expRequired": 0,
            "active": true,
            "freeTierRewards": [
              {
                "id": "string",
                "gameId": "string",
                "battlepassId": "string",
                "name": "string",
                "amount": 0,
                "amountInDecimal": 0
              }
            ],
            "premiumTierRewards": [
              {
                "id": "string",
                "gameId": "string",
                "battlepassId": "string",
                "name": "string",
                "amount": 0,
                "amountInDecimal": 0
              }
            ],
            "completed": true
          }
        ],
        "challenges": [
          {
            "id": "string",
            "battlepassId": "string",
            "name": "string",
            "startDate": "2023-12-27T10:59:15.390Z",
            "endDate": "2023-12-27T10:59:15.390Z",
            "active": true,
            "premium": true,
            "rewards": [
              {
                "id": "string",
                "gameId": "string",
                "battlepassId": "string",
                "name": "string",
                "amount": 0,
                "amountInDecimal": 0
              }
            ],
            "completed": true
          }
        ]
      }
    }
  ]
}

Getting A Battlepass with Levels, Challenges and Rewards

Request:

GET https://api.whalepass.gg/battlepass/{battlepassId}?includeLevels=true&includeChallenges=true

Request Parameters:

includeLevels: default false
includeChallenges: default false

Expected Response:

{
  "id": "string",
  "gameId": "string",
  "organizationId": "string",
  "name": "string",
  "noTimeLimit": true,
  "premiumPrice": 0,
  "startDate": "2023-10-26T09:33:23.970Z",
  "endDate": "2023-10-26T09:33:23.970Z",
  "challenges": [
    {
      "id": "string",
      "battlepassId": "string",
      "name": "string",
      "startDate": "2023-10-26T09:33:23.970Z",
      "endDate": "2023-10-26T09:33:23.970Z",
      "active": true,
      "premium": true,
      "rewards": [
        {
          "id": "string",
          "gameId": "string",
          "battlepassId": "string",
          "name": "string",
          "amount": 0,
          "amountInDecimal": 0
        }
      ]
    }
  ],
  "levels": [
    {
      "id": "string",
      "battlepassId": "string",
      "level": 0,
      "expRequired": 0,
      "active": true,
      "freeTierRewards": [
        {
          "id": "string",
          "gameId": "string",
          "battlepassId": "string",
          "name": "string",
          "amount": 0,
          "amountInDecimal": 0
        }
      ],
      "premiumTierRewards": [
        {
          "id": "string",
          "gameId": "string",
          "battlepassId": "string",
          "name": "string",
          "amount": 0,
          "amountInDecimal": 0
        }
      ]
    }
  ]
}

Getting A Redirection Link for Player Whalepass Account Connection

Request:

GET https://api.whalepass.gg/players/{playerId}/redirect?gameId={gameId}

Expected Response:

{
  "redirectionLink": "string"
}