Results 1 to 5 of 5

Thread: API Bug

  1. #1
    Fresh Spawn
    Join Date
    Apr 2018
    Posts
    3

    Unhappy API Bug

    I have so far found two bugs with the API. If anyone has a work around or a fix for either one, it would be very much appreciated. Or if anyone would like to report more bugs in order to generate a master list, you may do so in the comments below.

    1. The API doesn't pull the battle machine level for heroes unless they are a Town Hall 11. I think it tries to find the Grand Warden and when it returns a null value it skips over the Battle Machine value from the Builder Base.

    2. The player data for role seems to be returning the wrong role. It gives the role of admin to members that should be listed as elder. I am unsure why this is the only role that was given a name change from the actual game. All of the other roles are listed exactly the same. I think the potential work around for this would be to write an if statement checking for the role admin and if so replacing that with the name elder.
    Last edited by Panger95; April 29th, 2018 at 10:19 PM. Reason: Added an additional bug to the list.

  2. #2
    OnyxDS's Avatar
    Join Date
    Sep 2014
    Location
    Brexit Island
    Posts
    5,683
    I'm not sure either of these are actually bugs. For the first one, I've certainly seen the BM reported for lower TH players. Are you trying to extract the BM as the 4th hero in the list? Because the position may vary. See this thread:https://forum.supercell.com/showthre...Battle-Machine
    (And that thread includes samples i pulled from the API showing the BM on lower TH players)

    #2... yes the name is different. It's not uncommon for names inside software to be different. Remember "elder" would only be valid in English UI anyway. You just need to convert the name before you display it
    Forum cup organiser. The forum cup discord server is: https://discord.gg/KEUxV2e

  3. #3
    Fresh Spawn
    Join Date
    Apr 2018
    Posts
    3
    The first one I am pretty sure it is a bug because I just tried to pull my information directly from the API under try it and it doesn't return the Battle Machine. I have pasted a copy of the response body I received back below.

    Code:
    {
      "tag": "#2G902CVL",
      "name": "Andrew",
      "townHallLevel": 10,
      "expLevel": 98,
      "trophies": 2370,
      "bestTrophies": 2370,
      "warStars": 6,
      "attackWins": 1,
      "defenseWins": 0,
      "builderHallLevel": 6,
      "versusTrophies": 1852,
      "bestVersusTrophies": 1903,
      "versusBattleWins": 261,
      "role": "admin",
      "donations": 93,
      "donationsReceived": 70,
      "clan": {
        "tag": "#QQVJ9GUL",
        "name": "CL@n WaRr!Or++",
        "clanLevel": 11,
        "badgeUrls": {
          "small": "https://api-assets.clashofclans.com/badges/70/M4VY2X10IMQQqXmsPqdT1RQ_maefRwcePXLuEeP3kzI.png",
          "large": "https://api-assets.clashofclans.com/badges/512/M4VY2X10IMQQqXmsPqdT1RQ_maefRwcePXLuEeP3kzI.png",
          "medium": "https://api-assets.clashofclans.com/badges/200/M4VY2X10IMQQqXmsPqdT1RQ_maefRwcePXLuEeP3kzI.png"
        }
      },
      "league": {
        "id": 29000011,
        "name": "Crystal League II",
        "iconUrls": {
          "small": "https://api-assets.clashofclans.com/leagues/72/jhP36EhAA9n1ADafdQtCP-ztEAQjoRpY7cT8sU7SW8A.png",
          "tiny": "https://api-assets.clashofclans.com/leagues/36/jhP36EhAA9n1ADafdQtCP-ztEAQjoRpY7cT8sU7SW8A.png",
          "medium": "https://api-assets.clashofclans.com/leagues/288/jhP36EhAA9n1ADafdQtCP-ztEAQjoRpY7cT8sU7SW8A.png"
        }
      },
      "achievements": [
        {
          "name": "Bigger Coffers",
          "stars": 3,
          "value": 11,
          "target": 10,
          "info": "Upgrade a Gold Storage to level 10",
          "completionInfo": "Highest Gold Storage level: 11",
          "village": "home"
        },
        {
          "name": "Get those Goblins!",
          "stars": 3,
          "value": 153,
          "target": 150,
          "info": "Win 150 Stars on the Campaign Map",
          "completionInfo": "Stars in Campaign Map: 153",
          "village": "home"
        },
        {
          "name": "Bigger & Better",
          "stars": 3,
          "value": 10,
          "target": 8,
          "info": "Upgrade Town Hall to level 8",
          "completionInfo": "Current Town Hall level: 10",
          "village": "home"
        },
        {
          "name": "Nice and Tidy",
          "stars": 3,
          "value": 2072,
          "target": 500,
          "info": "Remove 500 obstacles (trees, rocks, bushes)",
          "completionInfo": "Total obstacles removed: 2072",
          "village": "home"
        },
        {
          "name": "Release the Beasts",
          "stars": 3,
          "value": 1,
          "target": 1,
          "info": "Unlock Dragon in the Barracks",
          "village": "home"
        },
        {
          "name": "Gold Grab",
          "stars": 2,
          "value": 42455719,
          "target": 100000000,
          "info": "Steal 100000000 gold",
          "completionInfo": "Total Gold looted: 42455719",
          "village": "home"
        },
        {
          "name": "Elixir Escapade",
          "stars": 2,
          "value": 44061869,
          "target": 100000000,
          "info": "Steal 100000000 elixir",
          "completionInfo": "Total Elixir looted: 44061869",
          "village": "home"
        },
        {
          "name": "Sweet Victory!",
          "stars": 3,
          "value": 2370,
          "target": 1250,
          "info": "Achieve a total of 1250 trophies in Multiplayer battles",
          "completionInfo": "Trophy record: 2370",
          "village": "home"
        },
        {
          "name": "Empire Builder",
          "stars": 3,
          "value": 6,
          "target": 4,
          "info": "Upgrade Clan Castle to level 4",
          "completionInfo": "Current Clan Castle level: 6",
          "village": "home"
        },
        {
          "name": "Wall Buster",
          "stars": 2,
          "value": 1252,
          "target": 2000,
          "info": "Destroy 2000 Walls in Multiplayer battles",
          "completionInfo": "Total walls destroyed: 1252",
          "village": "home"
        },
        {
          "name": "Humiliator",
          "stars": 2,
          "value": 247,
          "target": 2000,
          "info": "Destroy 2000 Town Halls in Multiplayer battles",
          "completionInfo": "Total Town Halls destroyed: 247",
          "village": "home"
        },
        {
          "name": "Union Buster",
          "stars": 2,
          "value": 676,
          "target": 2500,
          "info": "Destroy 2500 Builder's Huts in Multiplayer battles",
          "completionInfo": "Total Builder's Huts destroyed: 676",
          "village": "home"
        },
        {
          "name": "Conqueror",
          "stars": 2,
          "value": 286,
          "target": 5000,
          "info": "Win 5000 Multiplayer battles",
          "completionInfo": "Total multiplayer battles won: 286",
          "village": "home"
        },
        {
          "name": "Unbreakable",
          "stars": 2,
          "value": 1153,
          "target": 5000,
          "info": "Successfully defend against 5000 attacks",
          "completionInfo": "Total defenses won: 1153",
          "village": "home"
        },
        {
          "name": "Friend in Need",
          "stars": 2,
          "value": 7608,
          "target": 25000,
          "info": "Donate 25000 Clan Castle capacity worth of reinforcements",
          "completionInfo": "Total capacity donated: 7608",
          "village": "home"
        },
        {
          "name": "Mortar Mauler",
          "stars": 2,
          "value": 526,
          "target": 5000,
          "info": "Destroy 5000 Mortars in Multiplayer battles",
          "completionInfo": "Total Mortars destroyed: 526",
          "village": "home"
        },
        {
          "name": "Heroic Heist",
          "stars": 1,
          "value": 144562,
          "target": 250000,
          "info": "Steal 250000 Dark Elixir",
          "completionInfo": "Total Dark Elixir looted: 144562",
          "village": "home"
        },
        {
          "name": "League All-Star",
          "stars": 1,
          "value": 11,
          "target": 1,
          "info": "Reach the Masters League",
          "village": "home"
        },
        {
          "name": "X-Bow Exterminator",
          "stars": 1,
          "value": 178,
          "target": 250,
          "info": "Destroy 250 X-Bows in Multiplayer battles",
          "completionInfo": "Total X-Bows destroyed: 178",
          "village": "home"
        },
        {
          "name": "Firefighter",
          "stars": 1,
          "value": 55,
          "target": 250,
          "info": "Destroy 250 Inferno Towers in Multiplayer battles",
          "completionInfo": "Total Inferno Towers destroyed: 55",
          "village": "home"
        },
        {
          "name": "War Hero",
          "stars": 0,
          "value": 6,
          "target": 10,
          "info": "Score 10 Stars for your clan in Clan War battles",
          "completionInfo": "Total Stars scored for clan in Clan War battles: 6",
          "village": "home"
        },
        {
          "name": "Treasurer",
          "stars": 1,
          "value": 4924014,
          "target": 15000000,
          "info": "Collect 15000000 gold from the Treasury",
          "completionInfo": "Total gold collected in Clan War bonuses: 4924014",
          "village": "home"
        },
        {
          "name": "Anti-Artillery",
          "stars": 0,
          "value": 1,
          "target": 20,
          "info": "Destroy 20 Eagle Artilleries in Multiplayer battles",
          "completionInfo": "Total Eagle Artilleries destroyed: 1",
          "village": "home"
        },
        {
          "name": "Sharing is caring",
          "stars": 0,
          "value": 96,
          "target": 100,
          "info": "Donate 100 spell storage capacity worth of spells",
          "completionInfo": "Total spell capacity donated: 96",
          "village": "home"
        },
        {
          "name": "Keep your village safe",
          "stars": 1,
          "value": 1,
          "target": 1,
          "info": "Connect your account to a social network for safe keeping.",
          "completionInfo": "Completed!",
          "village": "home"
        },
        {
          "name": "Master Engineering",
          "stars": 2,
          "value": 6,
          "target": 8,
          "info": "Upgrade Builder Hall to level 8",
          "completionInfo": "Current Builder Hall level: 6",
          "village": "builderBase"
        },
        {
          "name": "Next Generation Model",
          "stars": 2,
          "value": 1,
          "target": 1,
          "info": "Unlock Cannon Cart in the Builder Barracks",
          "village": "builderBase"
        },
        {
          "name": "Un-Build It",
          "stars": 2,
          "value": 156,
          "target": 2000,
          "info": "Destroy 2000 Builder Halls in Versus battles",
          "completionInfo": "Total Builder Halls destroyed: 156",
          "village": "builderBase"
        },
        {
          "name": "Champion Builder",
          "stars": 2,
          "value": 1903,
          "target": 3000,
          "info": "Achieve a total of 3000 trophies in Versus battles",
          "completionInfo": "Versus Trophy record: 1903",
          "village": "builderBase"
        },
        {
          "name": "High Gear",
          "stars": 0,
          "value": 0,
          "target": 1,
          "info": "Gear Up one building using the Master Builder",
          "completionInfo": "Total buildings geared up: 0",
          "village": "builderBase"
        },
        {
          "name": "Hidden Treasures",
          "stars": 3,
          "value": 1,
          "target": 1,
          "info": "Rebuild Battle Machine",
          "village": "builderBase"
        },
        {
          "name": "Games Champion",
          "stars": 0,
          "value": 5645,
          "target": 10000,
          "info": "Earn 10000 points in Clan Games",
          "completionInfo": "Total Clan Games points: 5645",
          "village": "home"
        }
      ],
      "versusBattleWinCount": 261,
      "troops": [
        {
          "name": "Barbarian",
          "level": 6,
          "maxLevel": 7,
          "village": "home"
        },
        {
          "name": "Archer",
          "level": 6,
          "maxLevel": 7,
          "village": "home"
        },
        {
          "name": "Goblin",
          "level": 4,
          "maxLevel": 7,
          "village": "home"
        },
        {
          "name": "Giant",
          "level": 4,
          "maxLevel": 8,
          "village": "home"
        },
        {
          "name": "Wall Breaker",
          "level": 4,
          "maxLevel": 7,
          "village": "home"
        },
        {
          "name": "Balloon",
          "level": 6,
          "maxLevel": 7,
          "village": "home"
        },
        {
          "name": "Wizard",
          "level": 3,
          "maxLevel": 8,
          "village": "home"
        },
        {
          "name": "Healer",
          "level": 1,
          "maxLevel": 5,
          "village": "home"
        },
        {
          "name": "Dragon",
          "level": 1,
          "maxLevel": 6,
          "village": "home"
        },
        {
          "name": "P.E.K.K.A",
          "level": 1,
          "maxLevel": 7,
          "village": "home"
        },
        {
          "name": "Minion",
          "level": 5,
          "maxLevel": 7,
          "village": "home"
        },
        {
          "name": "Hog Rider",
          "level": 2,
          "maxLevel": 7,
          "village": "home"
        },
        {
          "name": "Valkyrie",
          "level": 1,
          "maxLevel": 6,
          "village": "home"
        },
        {
          "name": "Golem",
          "level": 1,
          "maxLevel": 7,
          "village": "home"
        },
        {
          "name": "Witch",
          "level": 1,
          "maxLevel": 3,
          "village": "home"
        },
        {
          "name": "Lava Hound",
          "level": 2,
          "maxLevel": 4,
          "village": "home"
        },
        {
          "name": "Baby Dragon",
          "level": 1,
          "maxLevel": 5,
          "village": "home"
        },
        {
          "name": "Miner",
          "level": 1,
          "maxLevel": 5,
          "village": "home"
        },
        {
          "name": "Raged Barbarian",
          "level": 8,
          "maxLevel": 16,
          "village": "builderBase"
        },
        {
          "name": "Sneaky Archer",
          "level": 8,
          "maxLevel": 16,
          "village": "builderBase"
        },
        {
          "name": "Beta Minion",
          "level": 5,
          "maxLevel": 16,
          "village": "builderBase"
        },
        {
          "name": "Boxer Giant",
          "level": 8,
          "maxLevel": 16,
          "village": "builderBase"
        },
        {
          "name": "Bomber",
          "level": 2,
          "maxLevel": 16,
          "village": "builderBase"
        },
        {
          "name": "Super P.E.K.K.A",
          "level": 1,
          "maxLevel": 16,
          "village": "builderBase"
        },
        {
          "name": "Cannon Cart",
          "level": 2,
          "maxLevel": 16,
          "village": "builderBase"
        },
        {
          "name": "Drop Ship",
          "level": 1,
          "maxLevel": 16,
          "village": "builderBase"
        },
        {
          "name": "Baby Dragon",
          "level": 4,
          "maxLevel": 16,
          "village": "builderBase"
        },
        {
          "name": "Night Witch",
          "level": 1,
          "maxLevel": 16,
          "village": "builderBase"
        }
      ],
      "heroes": [
        {
          "name": "Barbarian King",
          "level": 15,
          "maxLevel": 50,
          "village": "home"
        },
        {
          "name": "Archer Queen",
          "level": 15,
          "maxLevel": 50,
          "village": "home"
        }
      ],
      "spells": [
        {
          "name": "Lightning Spell",
          "level": 4,
          "maxLevel": 7,
          "village": "home"
        },
        {
          "name": "Healing Spell",
          "level": 4,
          "maxLevel": 7,
          "village": "home"
        },
        {
          "name": "Rage Spell",
          "level": 3,
          "maxLevel": 5,
          "village": "home"
        },
        {
          "name": "Jump Spell",
          "level": 1,
          "maxLevel": 3,
          "village": "home"
        },
        {
          "name": "Freeze Spell",
          "level": 1,
          "maxLevel": 6,
          "village": "home"
        },
        {
          "name": "Poison Spell",
          "level": 1,
          "maxLevel": 5,
          "village": "home"
        },
        {
          "name": "Earthquake Spell",
          "level": 1,
          "maxLevel": 4,
          "village": "home"
        },
        {
          "name": "Haste Spell",
          "level": 1,
          "maxLevel": 4,
          "village": "home"
        },
        {
          "name": "Clone Spell",
          "level": 1,
          "maxLevel": 5,
          "village": "home"
        },
        {
          "name": "Skeleton Spell",
          "level": 1,
          "maxLevel": 4,
          "village": "home"
        }
      ]
    }
    Last edited by Panger95; April 30th, 2018 at 01:40 PM.

  4. #4
    OnyxDS's Avatar
    Join Date
    Sep 2014
    Location
    Brexit Island
    Posts
    5,683
    Quote Originally Posted by Panger95 View Post
    The first one I am pretty sure it is a bug because I just tried to pull my information directly from the API under try it and it doesn't return the Battle Machine. I have pasted a copy of the response body I received back below.
    Yes, there's something odd there. I don't it's dependent on TH though - as you can see in that other thread you can get BM data for TH8 and under.

    My guess is it might be because the BM is level 1. There are some other oddities I believe where it doesn't distinguish level 1 and not-unlocked properly for BB troops.
    Forum cup organiser. The forum cup discord server is: https://discord.gg/KEUxV2e

  5. #5
    Centennial Club
    Join Date
    Feb 2016
    Posts
    188
    Hi!

    Yes I can confirm, the API returns level 1 for all troops in the BH level wether they are unlocked or not. Which mean there is no way to know if the troop is unlocked until it reaches level 2.
    I take that into account in Clash of Stats, it's been this way since the start of BH update and they never fixed it...

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •