auth
- API documentation entry for "auth"
- Username and password are used to obtain an Auth-ID
Request
{
"jsonrpc":"2.0",
"method":"auth",
"params":{
"user":"test_account",
"pass":"123456"
},
"id":"1"
}
Response after success
{
"jsonrpc":"2.0",
"result":{
"session":"LV;N%5TD7)64y&JOpK956fbe591dd89b8.38138624",
"level":"account"
},
"id":"1"
}
Response to a request containing invalid access credentials
{
"jsonrpc":"2.0",
"error":{
"code":2,
"message":"Access denied"
},
"id":"1"
}
PHP API client:
<?php
require_once './api.mailbox.org.client.php';
$api = new api_mailbox_org_client();
$params = array('user' => 'test_account', 'pass' => '123456');
$r = $api->call('auth', $params);
if ($r === FALSE) {
echo $api->error_code().': '.$api->error_message();
} else {
echo $r['session'];
}
deauth
- API documentation entry for "deauth"
- Deleting an Auth-ID (logout)
Request with valid Auth-ID
{
"jsonrpc":"2.0",
"id":"1",
"method":"deauth",
"params":""
}
Response
{
"jsonrpc":"2.0",
"result":true,
"id":"1"
}
PHP API client:
<?php
require_once './api.mailbox.org.client.php';
// assuming Auth-ID in some $_SESSION variable
$session = $_SESSION['api_auth_id'];
$api = new api_mailbox_org_client($session);
$r = $api->call('deauth');
if ($r === FALSE) {
echo $api->error_code().': '.$api->error_message();
} else {
echo 'success';
}
hello.world
- API documentation entry for "hello.world"
- Anonymous test command
Request
{
"jsonrpc":"2.0",
"id":"1",
"method":"hello.world",
"params":""
}
Response
{
"jsonrpc":"2.0",
"result":"Hello World!",
"id":"1"
}
hello.innerworld
- API documentation entry for "hello.innerworld"
- Test command requiring a valid session to work
Request with valid Auth-ID
{
"jsonrpc":"2.0",
"id":"1",
"method":"hello.innerworld",
"params":""
}
Response
{
"jsonrpc":"2.0",
"result":"Hello Inner-World!",
"id":"1"
}
domain.list
- API documentation entry for "domain.list"
- Returns a list of all domains held by an account
Request with valid Auth-ID
{
"jsonrpc":"2.0",
"id":"1",
"method":"domain.list",
"params":{
"account":"test_account"
}
}
Response
{
"jsonrpc":"2.0",
"result":[
{
"domain":"domain1.test",
"count_mails":2
},
{
"domain":"domain2.test",
"count_mails":0
},
{
"domain":"domain3.test",
"count_mails":33
},
{
"domain":"domain4.test",
"count_mails":0
}
],
"id":"1"
}