Úspěšné volání

Příkaz hello je určen pro otestování úspěšné odpovědi z Master API.

JSON

HTTP požadavek...

    POST /masterapi/server.php HTTP/1.0
    Host: www.domainmaster.cz
    Content-Type: text/plain; charset=UTF-8
    Content-Length: 31
    Authorization: Basic R1I6VE9NRUs6dG90b19hc2lfbmVuaV9oZXNsbw==

    {"command":"hello","params":[]}

... a odpověď:

    HTTP/1.0 200 OK
    Date: Tue, 24 Sep 2013 11:47:37 GMT
    Server: Apache
    Content-Length: 86
    Connection: close
    Content-Type: text/json; charset=UTF-8

    {"status":"success","message":"Ok","data":{"version":"0.1.0","code_name":"Acid Byte"}}

YAML

HTTP požadavek...

    POST /masterapi/server.php HTTP/1.0
    Host: www.domainmaster.cz
    Content-Type: text/plain; charset=UTF-8
    Content-Length: 31
    Authorization: Basic R1I6VE9NRUs6dG90b19hc2lfbmVuaV9oZXNsbw==

    ---
    command: hello
    params: []

... a odpověď:

    HTTP/1.0 200 OK
    Date: Tue, 24 Sep 2013 11:51:23 GMT
    Server: Apache
    Content-Length: 79
    Connection: close
    Content-Type: text/plain; charset=UTF-8

    ---
    status: success
    message: Ok
    data: 
        version: 0.1.0
        code_name: Acid Byte

PHP klient

    <?php
    $result = $client->sendCommand("hello");
    $result->isSuccess(); // true
    $result->isTemporaryError(); // false
    echo $result->getMessage(); // "Ok"
    print_r($result->getData()); // array("version" => "0.1.0", "code_name" => "Acid Byte")