Chybná odpověď

Příkaz fail je určen pro otestování chybového stavu.

Chyba tohoto typu nastane, když se např. pokusíte registrovat již existující doménu.

JSON

HTTP požadavek...

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

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

... a odpověď:

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

    {"status":"fail","message":"oops, something went wrong... in fact this is just a testing response"}

YAML

HTTP požadavek...

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

    ---
    command: fail
    params: []

... a odpověď:

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

    ---
    status: fail
    message: oops, something went wrong... in fact this is just a testing response

PHP klient

    <?php
    $result = $client->sendCommand("fail");
    $result->isSuccess(); // false
    $result->isTemporaryError(); // false
    echo $result->getMessage(); // "oops, something went wrong... in fact this is just a testing response"
    print_r($result->getData()); // null