Real-World Example
Viewing domain information (the show domain command) is one of the most common tasks performed in practice.
JSON
HTTP request...
POST /masterapi/server.php HTTP/1.0
Host: reseller.forpsi.hu
Content-Type: text/plain; charset=UTF-8
Content-Length: 63
Authorization: Basic R1I6VE9NRUs6dG90b19hc2lfbmVuaV9oZXNsbw==
{"command":"show domain","params":{"domain":"example.cz"}}
...and the response:
HTTP/1.0 200 OK
Date: Tue, 24 Sep 2013 14:41:02 GMT
Server: Apache
Content-Length: 302
Connection: close
Content-Type: text/json; charset=UTF-8
{
"status": "success",
"message": "Ok",
"data": {
"domain": "example.cz",
"registrant": "OWNER",
"nsset": "GRDNS",
"admin": [],
"tempcontact": [],
"registrar": "REG-GENREG",
"create_date": "2003-08-25",
"expiry_date": "2014-08-24",
"idacc": "PA:PARTNER",
"iddealer": "PA:PARTNER",
"status": {
"ok": "Object is without restrictions"
}
}
}
YAML
HTTP request...
POST /masterapi/server.php HTTP/1.0
Host: reseller.forpsi.hu
Content-Type: text/plain; charset=UTF-8
Content-Length: 60
Authorization: Basic R1I6VE9NRUs6dG90b19hc2lfbmVuaV9oZXNsbw==
---
command: show domain
params:
domain: example.cz
...and the response:
http response:
HTTP/1.0 200 OK
Date: Tue, 24 Sep 2013 14:42:06 GMT
Server: Apache
Content-Length: 294
Connection: close
Content-Type: text/plain; charset=UTF-8
---
status: success
message: Ok
data:
domain: example.cz
registrant: OWNER
nsset: GRDNS
admin: []
tempcontact: []
registrar: REG-GENREG
create_date: 2003-08-25
expiry_date: 2014-08-24
idacc: PA:PARTNER
iddealer: PA:PARTNER
status:
ok: Object is without restrictions
PHP Client
<?php
$result = $client->sendCommand("show domain",array("domain" => "example.cz"));
$result->isSuccess(); // true
echo $result->getMessage(); // "Ok"
print_r($result->getData()); // array("domain" => "example.cz", "registrant" => "OWNER", ... )