getMailboxes

Description

Get a list of mailboxes.



Params

Name Type Description
apiKey string API key previously generated.
offset integer Optional parameter to specify offset.
count integer Optional parameter to specify the number of records.
id integer Optional parameter to search by id.
mailboxName string Optional parameter to search by mailbox name.
name string Optional parameter to search by name.
email string Optional parameter to search by email.
sortField string Optional parameter to specify a search field.
sortOrder string Optional parameter to specify a sort order. Accepted values are ASC and DESC (default).

 

Returned data

Type: array

Description: Return array with mailboxes data.

 

Json sample code

<?php

$curl = curl_init('https://your_address/ccm/admin/api/version/2/&type=json');

$postData = array(
    'function' => 'getMailboxes',
    'apiKey' => 'apiKey',
    'offset' => 0,
    'count' => 2,
);

curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($postData));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

$json = curl_exec($curl);
if ($json === false) {
    die('Request failed with error: '. curl_error($curl));
}

$result = json_decode($json);
if ($result->status == 0) {
    die('Bad status returned. Error: '. $result->error);
}

var_dump($result->data);

 

Result of API call

Array
(
    [0] => stdClass Object
        (
            [id] => 10
            [mailbox_name] => Demo (demo@mail.com)
            [name] => Demo User
            [email] => demo@mail.com
            [check] => 0
            [username] => 
            [password] => 
            [hostname] => 
            [imap] => 0
            [apop] => 0
            [delete] => 0
            [enable] => 1
        )

    [1] => stdClass Object
        (
            [id] => 9
            [mailbox_name] =>  (demo@mail.com)
            [name] => 
            [email] => demo@mail.com
            [check] => 0
            [username] => 
            [password] => 
            [hostname] => 
            [imap] => 0
            [apop] => 0
            [delete] => 0
            [enable] => 1
        )

)
Menu Title