Skip to content
phx00 edited this page Mar 24, 2016 · 1 revision

SURVARIUM API

General Information

API server receives GET-requests and replies with a JSON Object

Usage

It is a recommended example of API client for api.survarium.com. You can install it through composer by adding next lines to your composer.json

{
    "require" : {
        "survarium/api" : "dev-master@dev"
    }
}

If you do not use composer you should add next line to your php script

require  DIR  . '/autoload.php'; 

where DIR is filepath to root library directory. You can use $survariumApi object to retrieve necessary data:

$survariumApi = new \Survarium\Api\SurvariumApi('test', 'test');
$maxMatchId = $survariumApi->getMaxMatchId(); 

Register

In order to get personal credentials you should fill out a registration form on http://api.survarium.com/register and accept Terms of usage.

Examples of possible URLs:

http://api.survarium.com/v1.0/getnicknamesbypidarray?pids=17083592333428139024%2C7542784095223883934
http://api.survarium.com/v1.0/getmatchstatisticbyid?matchid=3200430&language=english
http://api.survarium.com/v1.0/getuserdatabypid?pid=17083592333428139024&language=english
http://api.survarium.com/v1.0/getclansamount
http://api.survarium.com/v1.0/getmatchescountbypid?pid=17083592333428139024
http://api.survarium.com/v1.0/getpublicidbynickname?nickname=%D0%A3%D0%B1%D0%B8%D1%82%D1%8C+%D0%B2%D1%80%D0%B0%D0%B3%D0%B0
http://api.survarium.com/v1.0/getmatchesidbypublicid?pid=17083592333428139024&matchAmount=20&offset=0
http://api.survarium.com/v1.0/getnicknamesbypidarray?pids=17083592333428139024%2C7542784095223883934
http://api.survarium.com/v1.0/getmatchstatisticbyid?matchid=3200430&language=english
http://api.survarium.com/v1.0/getuserdatabypid?pid=17083592333428139024&language=english
http://api.survarium.com/v1.0/getclansamount
http://api.survarium.com/v1.0/getclans?amount=20&offset=0
http://api.survarium.com/v1.0/getclaninfo?clanid=1
http://api.survarium.com/v1.0/getclanmembers?clanid=1
http://api.survarium.com/v1.0/getslotsdict?language=english
http://api.survarium.com/v1.0/getitemsdict?language=english
http://api.survarium.com/v1.0/getmapsdict?language=english
http://api.survarium.com/v1.0/getnewmatchesfrom?timestamp=1451001600&limit=10&offset=0
http://api.survarium.com/v1.0/getuserskills?pid=12886876036947614728

API Methods

Use methods of src/SurvariumAPI class for requests

getMaxMatchId()
Returns the current maximum identifier of a played match (i.e. the last played match at the moment)

matchesCountByPublicId($pid)
Returns number of matches played by a user with a specified public id
string $pid – a public user id

getPublicIdByNickname($nickname)
Returns public user id by the user’s nickname
string $nickname – user’s nickname

getMatchesIdByPublicId($pid, $amount, $offset)
Returns identifiers of a specified number of matches the user with a specified public id played. $offset determines an offset from the user’s last match
string $pid – user’s public id
int $amount (max:20) – quantity of returned matches’ ids
int $offset – an offset from the last match, played by the user

getNicknamesByPublicIds($pidArray)
Returns an array of the users’ nicknames
array $pidArray – an array containing the users’ public ids

getMatchStatistic($matchId, $localization)
Returns match statistics by its identifier in a specified language.
Please note that the minimum possible match id is 2253073. Minimum possible match id for extended statistics is 3096798.
int $matchId – match id
enum $localization ('russian', 'english') – reply language (localization)

getUserData($pid, $localization)
Returns basic information about the user and his equipment profiles in a specified language.
Please note that when the items are removed from the equipment profiles (for instance, after the huge updates), they are not available via this request.
string $pid – user public id
enum $localization ('russian', 'english') - reply language (localization)

getClanAmounts()
Returns quantity of active clans in the game

getClans($amount, $offset)
Returns id and names of the clans ordered by Elo rating
int $amount – quantity of clans
int $offset – an offset from the clan with the highest Elo rating

getClanInfo($clanId)
Returns information about the clan with a specified id
int $clanId – clan id

getClanMembers($clanId)
Returns a list of clan members with a specified id
int $clanId – clan id

getSlotsDict($localization)
Returns a dictionary of profile slots in a specified localization
enum $localization ('russian', 'english') - reply language (localization)

getItemsDict($localization)
Returns a list of available game items in a specified localization
enum $localization ('russian', 'english') - reply language (localization)

getMapsDict($localization)
Returns a list of available game locations with their game modes and weather in a specified localization
enum $localization ('russian', 'english') - reply language (localization)

getNewMatches($timestamp, $limit, $offset)
Returns a specified amount of match identifiers which were held since a specified date. The matches are ordered by date they were added to the statistics and match ids.
Note.
Returns a hash of [match id => date of match import to the statistics](not [match_id => date_of_match_start]).
int $timestamp – a minimum unix time stamp when matches were added to statistics
int $limit (max 50) – a number of returned matches
int $offset – an offset of returned matches from the minimal match corresponding to the request

getUserSkills($pid)
Returns a list of skills and their levels for the user with a specified public id
string $pid – user public id

Request to receive keys
To receive personal keys to access Survarium API, please register here: http://api.survarium.com/register Personal keys will be sent to your e-mail

Restrictions:

Requests Rate Maximum rate of requests sent from a single account cannot exceed 30 per second with a corresponding minimal interval between two consecutive requests

Error codes:

1 - An unknown error occurred.
2 - Invalid parameters in the request header.
3 - User Authorization failed.
4 - Too many requests per second.
5 - Invalid arguments or requested data does not exist.

Clone this wiki locally