User Tools

Site Tools


clientapi

Client APIs

At this time, we only provide a sample PHP client API. Other client APIs may be provided in the future.

We do not plan to provide any support concerning those client APIs.

PHP

Source code can be downloaded from our Github repository (direct link).

System Requirements

This client API requires:

  • PHP 5.2 or further version
  • cURL extension installed
  • (Optional) The cache mechanism provided by the EredanExtendedAPI class requires write-access to at least one folder

getAggregatesData()

array $EredanClientAPI->getAggregatesData();

Parameters

This function does not accept parameters.

Return values

Returns an array with all available aggregates and their data (id, name, visuals, …).

Array
(
    [guilds] => Array
        (
            [7] => Array
                (
                    [id] => 7
                    [name] => Desert Nomads
                    [color] => #f0c26b
                    [visuals] => Array
                        (
                            [big] => http://static.eredan.com/images/web_big/25fd5740bc64712b8353b56cd6a65bda.png
                            [medium] => http://static.eredan.com/images/web_mid/25fd5740bc64712b8353b56cd6a65bda.png
                            [small] => http://static.eredan.com/images/web_small/25fd5740bc64712b8353b56cd6a65bda.png
                        )

                )

            [...]
 		)

    [classes] => Array
        (
            [8] => Array
                (
                    [id] => 8
                    [name] => Berserker
                    [visuals] => Array
                        (
                            [big] => http://static.eredan.com/images/web_big/2dd0835cc885e1fcba61234813339d0d.png
                            [medium] => http://static.eredan.com/images/web_mid/2dd0835cc885e1fcba61234813339d0d.png
                            [small] => http://static.eredan.com/images/web_small/2dd0835cc885e1fcba61234813339d0d.png
                        )

                )

           [...]
        )
[...]
)

getData()

array $EredanClientAPI->getData(string $connection [, Array $params]);

Parameters

Name Type Mandatory Description
connectionstringyesAPI connection to use.
paramsarraynoArray of parameters and filters for the API call.
See table 1.1 for details
1.1 params
NameTypeMandatoryDescription
filtersarraynoAggregates filter to use with the API call.\\Key should contain the aggregate to filter, values contains the operator and values list to use with it.
http_methodstringnoHTTP method used for the API call.
Default : “GET”
Currently only “GET” called are supported by the API
query_paramsarraynoParameters for the API call (such as pagination parameters).\\All entries will be add to the query string parameters.
Exemple : $qp = array('start'⇒10,'count'⇒5);
1.11 params.filters
NameTypeMandatoryDescription
operatorstringyesDefines if the filter will use an union or an intersect of the given ids results
listarrayyesArray of values or ids to use to filter on the given aggregate

The following call is suitable to request the list of the 4 first Kotoba's mage characters :

$connection :
string "cards"

$params : 
Array
(
    [filters] => Array
        (
            [guilds] => Array
                (
                    [operator] => OR
                    [list] => Array
                        (
                            [0] => 1
                        )

                )

            [classes] => Array
                (
                    [operator] => OR
                    [list] => Array
                        (
                            [0] => 3
                        )

                )

            [cardtypes] => Array
                (
                    [operator] => OR
                    [list] => Array
                        (
                            [0] => 2
                        )

                )

        )

    [query_params] => Array
        (
            [start] => 0
            [count] => 4
        )

)

Return values

Returns an array of the cards informations.

Array
(
    [78] => Array
        (
            [id] => 78
            [name] => Aku
            [level] => 1
            [relations] => Array
                (
                    [series] => Array
                        (
                            [0] => 1
                        )

                    [types] => Array
                        (
                            [0] => 2
                        )

                    [genders] => Array
                        (
                            [0] => male
                        )

                    [guilds] => Array
                        (
                            [0] => 4
                        )

                    [classes] => Array
                        (
                            [0] => 2
                        )

                    [races] => Array
                        (
                            [0] => 5
                        )

                    [casts] => Array
                        (
                            [0] => 4
                        )

                )

            [rarity_id] => 1
            [tradable] => 1
            [visuals] => Array
                (
                    [big] => http://static.eredan.com/cards/web_big/us/rWyk7ZLZ.png
                    [medium] => http://static.eredan.com/cards/web_mid/us/rWyk7ZLZ.png
                    [small] => http://static.eredan.com/cards/web_small/us/rWyk7ZLZ.png
                )

            [release_date] => 2010-04-12
            [description] => Turns 2 and 7 : Spirit + 1.
            [flavor_text] => Remove this seal and you shall see my true power.
            [character_specs] => Array
                (
                    [spirit] => 2
                    [attack] => Array
                        (
                            [0] => 3
                            [1] => 5
                        )

                    [defense] => 2
                    [health] => 12
                )

        )
    [139] => Array
        (
          [id] => 141
          [name] => Akutsai
          [...]
        )
        [...]
)

getPagination()

array $EredanClientAPI->getPagination(string $connection);

Parameters

NameTypeMandatoryDescription
connectionstringyesThe connection to paginate

Return values

Return an array with the next and previous pages index.

Array
(
    [next] => 8
    [prev] => 0
)

api()

array $EredanClientAPI->api(string $connection, Array $params, string $method);

Parameters

NameTypeMandatoryDescription
connectionstringyesConnection and aggregate filters.
Exemple : “cards/guilds/1,2/races/1”
paramsarraynoQuery string parameters added to the request.
Exemple : array('start'⇒4,'count'⇒5,'locale'⇒'fr')
methodstringnoHTTP method to use.
Default : GET.
This API actually only support GET method

Return value

Returns an array of the API response.

clientapi.txt · Last modified: 2013/01/03 16:27 by admin