Jump to content

CardBase API


Lord NullPointer

Recommended Posts

CardBase API

For those interested in making applications with BattleForge data, we expose the CardBase API.
Note that we are still expanding the CardBase in functionality, so it could be that your application becomes useless in the future..

Just sayin~

 

This API provides data about Cards and Maps in json format.
On this page I will give you the endpoints and required data to make use of this API.

 

 

Each Response from this API returns the data inside a wrapper APIWrap<T> which looks like this:

public class APIWrap<T>  //T = Return Type of API Call
{
        public ExceptionData Exception { get; set; }
        public T Result { get; set; }
        public bool Success { get; set; }
}

public class ExceptionData
{
        public int Code { get; set; }
        public string Name { get; set; }
        public string Details { get; set; }
}

 

 

EndPoints

 

For Cards

EndPoint:

http://cardbase.skylords.eu/Cards/GetCards

 

ResultSet:

Response of this call is a List<Card>, where Card is the following class:

public class Card
    {

        public string Name { get; set; }

        public Rarity Rarity { get; set; }
        public int Cost { get; set; }

        public Edition Edition { get; set; }
        public CardType Type { get; set; }

        public Color Color { get; set; }
        public Affinity Affinity { get; set; }

        public bool IsRanged { get; set; }
        public int Defense { get; set; }
        public int Offense { get; set; }
        public DefenseType DefenseType { get; set; }
        public OffenseType OffenseType { get; set; }
        public int UnitCount { get; set; }
        public int ChargeCount { get; set; }
        public string Category { get; set; }

        public List<Ability> Abilities { get; set; } = new List<Ability>();
        public List<Upgrade> Upgrades { get; set; } = new List<Upgrade>();

        public OrbInfo OrbInfo { get; set; }

        public string Extra { get; set; }
        public Media Image { get; set; }
    }

 

Essentially parameters for this call is ?[Property1]=[Value]&[Property2]=[Value], if the property is a string it will check if given value is inside property value.

Example: http://cardbase.skylords.eu/Cards/GetCards?Name=Dread will return all cards with "Dread" in their name.

Note that some properties have integers as values, some of these properties represent enums.

 

Property Enums:
 

public enum Rarity
    {
        Common = 0,
        Uncommon = 1,
        Rare = 2,
        UltraRare = 3
    }
public enum Edition
    {
        Twilight = 1,
        Renegade = 2,
        LostSouls = 4,
        Amii = 8
    }
public enum CardType
    {
        Spell = 0
        Creature = 2,
        Building = 3,
    }
public enum OffenseType
    {
        Small = 0,
        Medium = 1,
        Large = 2,
        XL = 3,
        Special = 4
    }
public enum DefenseType
    {
        Small = 0,
        Medium = 1,
        Large = 2,
        XL = 3,
        Building = 4
    }
public enum AbilityType
    {
        Attack = 0,
        Passive = 1,
        Activated = 2,
        Interval = 3,
        Cast = 4
    }
public enum Difficulty
    {
        Standard = 0,
        Advanced = 1,
        Expert = 2
    }

 

For Maps

EndPoint:

http://cardbase.skylords.eu/Maps/GetMaps

 

ResultSet:

Response of this call is a List<Map>, where Map is the following class:

public class Map
    {

        public string Name { get; set; }
        public string SubTitle { get; set; }
        public string Campaign { get; set; }
        public int Players { get; set; }
        public Edition Edition { get; set; }
        public string Description { get; set; }

        public List<string> Goals { get; set; }
        public List<string> Unlocks { get; set; }
        public List<string> Prerequisite { get; set; }

        public Media Image { get; set; }
        public Media Map { get; set; }

        public List<string> Difficulties { get; set; } = new List<string>();
        public YoutubeVideo WalkThrough { get; set; }

        public List<Loot> Standard { get; set; }
        public List<Loot> Advanced { get; set; }
        public List<Loot> Expert { get; set; }

        public class Loot
        {
            public string CardName { get; set; }
            public int Era { get; set; }
        }
    }

 

Essentially parameters for this call is ?[Property1]=[Value]&[Property2]=[Value], if the property is a string it will check if given value is inside property value.

Example: http://cardbase.skylords.eu/Maps/GetMaps?Name=Soul will return all maps with "Soul" in their name.

Note that some properties have integers as values, some of these properties represent enums.

 

Property Enums:

public enum Edition
    {
        Twilight = 1,
        Renegade = 2,
        LostSouls = 4,
        Amii = 8
    }

 

Infinitesimal likes this
Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...
  • 2 years later...
17 hours ago, Mynoduesp said:

Is this API still supported/up to date? @Zyna @Ladadoos (sry for taging)

The API still works, although is not update with any changes we have done (which aren't many regardless, since none of the balance changes for example are live yet). That being said, I believe only the Cards work correctly. We might in the future update this and the cardbase too.

Edited by Ladadoos
Link to comment
Share on other sites

4 minutes ago, Mynoduesp said:

So the official cardlist on https://allcards.skylords.eu/ isn't up to date...? That's a bummer, but alright, I wont play with it before release then. Would be nice to have an API after launch though. :^)

Yeah unfortunately it isn't completely up to date. I'll export more accurate card data from the game database once I get the time, but we don't plan on changing the API format. So you could start using the API for your application :)

Link to comment
Share on other sites

30 minutes ago, Zyna said:

Yeah unfortunately it isn't completely up to date. I'll export more accurate card data from the game database once I get the time, but we don't plan on changing the API format. So you could start using the API for your application :)

I'm not very familiar with APIs and the information I was hoping to find in the there isn't part of the API either (CardIDs and more importantly AbilityIDs). So I won't use it any time soon anyways. ;)

That said, an up to date API is still a nice feature to have. Deckbuilding and such still work with not quite up to date data I know. :P
I'm curious what the future brings though, maybe you'll implement a deck import/export feature to Skylords reborn as a QoL feature, things like that would cause trouble if not maintained. :^)

Link to comment
Share on other sites

3 hours ago, Mynoduesp said:

I'm curious what the future brings though, maybe you'll implement a deck import/export feature to Skylords reborn as a QoL feature, things like that would cause trouble if not maintained. :^)

I actually started working on a feature like this years ago, but looks like I never finished it. And probably won't anytime soon considering the more pressing features there are to add and bugs to fix.

Mynoduesp likes this
Link to comment
Share on other sites

  • 1 month later...

Hi I'm working on an Discordbot which should display the cards as MessageEmbed in my Discord Server. The Problem is that the API Image Response is not an PNG or JPG Image, if you post this link in Discord for example: https://cardbase.skylords.eu/lrms/GetMediaData?id=5f3324a2c6ee954ccfe9bdc8 you will not get an Image displayed.

Is it possible that you could provide the images in PNG Format?

Thanks.

Link to comment
Share on other sites

8 minutes ago, Crypto5842 said:

Hi I'm working on an Discordbot which should display the cards as MessageEmbed in my Discord Server. The Problem is that the API Image Response is not an PNG or JPG Image, if you post this link in Discord for example: https://cardbase.skylords.eu/lrms/GetMediaData?id=5f3324a2c6ee954ccfe9bdc8 you will not get an Image displayed.

Is it possible that you could provide the images in PNG Format?

Thanks.

The issue you are facing isn't because it's not PNG, as in fact it's MIME type is PNG. Your issue ist that first of all those images are cached, thus may not display immediately, to avoid this I'd suggest caching them locally with their IDs and check whether the image already exists in that folder & if not download it and provide it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use