Hi everyone,
I was working on a small personal project that pulls data from the Hearthstone Battlegrounds API —specifically looking for hero data—when I discovered a discrepancy : the number of heroes returned by the API doesn’t match the number of hero powers.
Upon investigation, I found three heroes whose heroPowerId is not included as a childId of the hero itself.
For reference, here is the raw API data:
A. F. Kay →
heroPowerId: 59891|childIds: [59891, 77774]Mocri →
heroPowerId: 129174|childIds: NoneRakanishu →
heroPowerId: 122960|childIds: [77823]Yogg-Saron, End of Hope →
heroPowerId: 122958|childIds: [77853]
Breakdown of each case:
| Hero | heroPowerId | childIds | Status | Notes |
|---|---|---|---|---|
| A.F. Kay | 59891 | [59891, 77774] | Hero power + Buddy included | |
| Mocri | 129174 | None | No Buddy, but hero power should be here | |
| Rakanishu | 122960 | [77823] | Only Buddy shown, hero power missing | |
| Yogg-Saron | 122958 | [77853] | Only Buddy shown, hero power missing |
Key observations:
- A.F. Kay → Works as expected.
heroPowerIdappears inchildIds. - Mocri →
childIdsisNone. Since Mocri has no Buddy,childIdsshould at least contain129174. - Rakanishu →
childIdsonly contains the Buddy (77823). Hero power122960is missing. - Yogg-Saron →
childIdsonly contains the Buddy (77853). Hero power122958is missing.
This creates problems when programmatically mapping heroes to their hero powers using childIds as the reference.
My questions are:
- Is this an intentional design choice , or is it a bug in the API response?
- What is the recommended way to reliably map a hero to its hero power? Should I always fall back to
heroPowerIddirectly, or is there another field or endpoint I should be using?
I’d prefer to avoid hardcoding exceptions , but I’m happy to do so if this is expected behavior.
Any clarification or official guidance would be much appreciated.
Thanks in advance!