Favorite API (Ömer Şafak Bebek) - bounswe/bounswe2023group7 GitHub Wiki

1a0c6980-7d0d-11eb-816e-fa44f42fa7af

About

The Clash of Clans API provides game related data to everyone that wants to develop amazing tools, applications and websites about the game in a secure and reliable way. In order to access the API, developers need a developer account and a key which is a JSON Web Token to authorize the requests. The token can be created on My Account page and the token must be passed in every API request in the Authorization HTTP header in Authorization: Bearer API_TOKEN format.

Why the API was chosen?

  • Our project is related to games and I thought this API (especially information types that are seen in the responses) can be a good guide for us.
  • I am playing Clash of Clans and I wonder how my player profile etc. looks like in the game database.

Things I Like

  • The API has a well-defined swagger documentation that enables the developer to try the endpoints easily.
  • The response bodies for different status codes are documented also. Thanks to this, the developers probably do not encounter unexpected responses.

Things I Dislike

  • Even though the API has detailed documentation, there are no example values for endpoint parameters. Maybe there can be some example player and clan tags.

An Example Call

Request URL: https://api.clashofclans.com/v1/players/%2390JUYPRO
Method: GET
Headers: Authorization: Bearer API_TOKEN
Description: Get information about the player with player tag #90JUYPRO. API_TOKEN in the Authorization header should be created and it is valid for only specified IP addresses.
StatusCode: 200
Response:

{
  "tag": "#90JUYPR0",
  "name": "Xecutioner",
  "townHallLevel": 13,
  "townHallWeaponLevel": 2,
  "expLevel": 183,
  "trophies": 3078,
  "bestTrophies": 4101,
  "warStars": 540,
  "attackWins": 0,
  "defenseWins": 0,
  "builderHallLevel": 9,
  "versusTrophies": 3961,
  "bestVersusTrophies": 4304,
  "versusBattleWins": 3715,
  "role": "admin",
  "warPreference": "out",
  "donations": 0,
  "donationsReceived": 0,
  "clanCapitalContributions": 73440,
  "clan": {
    "tag": "#RGQ28Y2V",
    "name": "HYDRA",
    "clanLevel": 9,
    "badgeUrls": {
      "small": "https://api-assets.clashofclans.com/badges/70/I8gAATsHLACQSQptqq-I99Og2gFNr1cD27hDy5wl_B8.png",
      "large": "https://api-assets.clashofclans.com/badges/512/I8gAATsHLACQSQptqq-I99Og2gFNr1cD27hDy5wl_B8.png",
      "medium": "https://api-assets.clashofclans.com/badges/200/I8gAATsHLACQSQptqq-I99Og2gFNr1cD27hDy5wl_B8.png"
    }
  },
  "achievements": [
    {
      "name": "Bigger Coffers",
      "stars": 3,
      "value": 14,
      "target": 10,
      "info": "Upgrade a Gold Storage to level 10",
      "completionInfo": "Highest Gold Storage level: 14",
      "village": "home"
    },
    {
      "name": "Get those Goblins!",
      "stars": 3,
      "value": 186,
      "target": 150,
      "info": "Win 150 Stars on the Campaign Map",
      "completionInfo": "Stars in Campaign Map: 186",
      "village": "home"
    },
    ...
  ],
  "troops": [
    {
      "name": "Barbarian",
      "level": 9,
      "maxLevel": 11,
      "village": "home"
    },
    {
      "name": "Archer",
      "level": 9,
      "maxLevel": 11,
      "village": "home"
    },
    ...
  ],
  "spells": [
    {
      "name": "Lightning Spell",
      "level": 9,
      "maxLevel": 10,
      "village": "home"
    },
    {
      "name": "Healing Spell",
      "level": 7,
      "maxLevel": 9,
      "village": "home"
    },
    ...
  ]
}
⚠️ **GitHub.com Fallback** ⚠️