• Official Post


    Welcome!


    i will show you "how you send requests to our spaceinvasion apis" and "how you work with the responsed data"...


    When you would "test" the APIs and you dont want to register you for this test cases you can use our "sandbox" system... You can access all APIs without an authed project (and secure key) when you add the parameter sandbox=true on the URL.
    Attention: the responsed data are randomly generated!


    -------------------------------------------------------------------------------------

    When you have an existing project or you will create a project please register you on our "Registration" area!
    A guide "how you register a project" can you find here: How I register a new project to access the apis?


    First you need the following 2 variables before you can start:


    partner Ident: this value is the project (partner) ID where we can identify that your project will access our APIs.
    secure key: with this secure key you verify that your project is calling our APIs.


    With this 2 variables you can create a unique token to request our apis.
    This token is a md5 string on format:
    md5 ( outputType + clientIP + partnerID + secureKey )


    When you want to call the API you add the following 2 parameters:
    &partner=[PARTNERID]&token=[YOUR UNIQUE TOKEN]


    Example:
    This PHP Script call the API to get the Ranking.


    PHP
    $partnerID = 1;
    $secureKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    $token = md5('json'.'176.9.73.14'.$partnerID.$secureKey);
    $string = file_get_contents('http://api.spaceinvasion.info/api/ranking.php?output=json&instance=de1&modus=1&category=1&partner='.$partnerID.'&token='.$token);
    var_dump(json_decode($string));


    This should output a "object" of our SpaceInvasion Ranking (de1 universe, sorted by total points)




    How I work with the json result?


    in the most developer languages there are functions to decode json strings...


    PHP: http://php.net/manual/de/book.json.php
    JavaScript: http://www.json.org/js.html
    Java: http://json.org/java/
    Delphi: http://edn.embarcadero.com/article/40882


    You can work with the function result (object / array) and store this into databases / files / memory caches.



    How I work with the xml result?


    the xml output is based on XML RPC (http://de.wikipedia.org/wiki/XML-RPC).
    Many developer languages has an extension to work with this directly.
    Otherwise you can access this structure with simply xml functions.


    PHP: http://php.net/manual/en/book.xmlrpc.php
    JavaScript: http://phpxmlrpc.sourceforge.net/jsxmlrpc/
    Java: http://www.wordtracker.com/docs/api/ch03s02.html
    Delphi: http://sourceforge.net/projects/delphixml-rpc/


    The result should be an array / object you also can store into a database / cache system.



    Good Luck and Have Fun with our APIs!


    best regards
    Dschibait