Sarv.com

PHP

Choose Language

Sending Domains Calls

Info! This is Beta version if you have any problem in using Api please mail us at support@sarv.com

/settings/addSendingDomain

Add a new Sending Domains

Example Call


<?php
    try {
        require_once 'SarvMTA_PHP/Sarv.php';
        $sarv = new Sarv('owner_id', 'token', 'SarvTES_APP_DOMAIN');
        $result = $sarv->settings->addSendingDomain(domain);
        print_r($result);
        /*
        Array
        (
            [status] => "success"
            [message] => "Sending Domain Added"
        )
        */
    } catch(Sarv_Error $e) {
        // Sarv errors are thrown as exceptions
        echo "A sarv error occurred: " . get_class($e) . " - " . $e->getMessage();
    }
?>

Example Success Response


Array
(
    [status] => "success"
    [message] => "Sending Domain Added"
)

Example Error Response


Array
(
    [status]=> "error"
    [code]=> -1
    [name]=> "AuthenticationError"
    [message]=> "Token MissMatch"
)

Parameters
owner_id* string a valid Sarv User Id
token* string a valid token
SarvTES_APP_DOMAIN* string a valid SarvTES APP DOMAIN
domain* string domain name
* compulsory field
Return Value: Success
struct the results of newly Added Domain
status string always success
message string human readable message
Return Value: Error
struct the error results when attempt to add domain
status string error
message string human readable message
type string one of the error type as bellow table
Error types
ValidationError The parameters passed to the API call are invalid or not provided when required.
GeneralError An unexpected errors occurred processing the request. Sarv Developers will be notified.
AuthenticationError Provided owner_id and token was not matched.

/settings/checkSendingDomain

check Sending Domain

Example Call


<?php
    try {
        require_once 'SarvMTA_PHP/Sarv.php';
        $sarv = new Sarv('owner_id', 'token', 'SarvTES_APP_DOMAIN');
        $result = $sarv->settings->checkSendingDomain(domain);
        print_r($result);
        /*
        Array
        (
            [status] => "success"
            [domain] => "abc.com"
            [dkim] => array(
                            [valid] => "Yes" 
                        )
            [spf] => array(
                            [valid] => "No" 
                        )
            [valid_signing] => "No"
        )
        */
    } catch(Sarv_Error $e) {
        // Sarv errors are thrown as exceptions
        echo "A sarv error occurred: " . get_class($e) . " - " . $e->getMessage();
    }
?>

Example Success Response


Array
(
    [status] => "success"
    [domain] => "abc.com"
    [dkim] => array(
                    [valid] => "Yes" 
                )
    [spf] => array(
                    [valid] => "No" 
                )
    [valid_signing] => "No"
)

Example Error Response


Array
(
    [status]=> "error"
    [code]=> -1
    [name]=> "AuthenticationError"
    [message]=> "Token MissMatch"
)

Parameters
owner_id* string a valid Sarv User Id
token* string a valid token
SarvTES_APP_DOMAIN* string a valid SarvTES APP DOMAIN
domain* string domain name
* compulsory field
Return Value: Success
struct the results of verify dkim and spf
status string always success
message string human readable message
dkim[]struct dkim validation result
valid string value is either 'Yes' OR 'No'
spf[]struct spf validation result
valid string value is either 'Yes' OR 'No'
valid_signing string value is either 'Yes' OR 'No'
Return Value: Error
struct the error results when attempt verify dkim and spf
status string error
message string human readable message
type string one of the error type as bellow table
Error types
ValidationError The parameters passed to the API call are invalid or not provided when required.
GeneralError An unexpected errors occurred processing the request. Sarv Developers will be notified.
AuthenticationError Provided owner_id and token was not matched.

/settings/verifySendingDomain

Verify Sending Domain

Example Call


<?php
    try {
        require_once 'SarvMTA_PHP/Sarv.php';
        $sarv = new Sarv('owner_id', 'token', 'SarvTES_APP_DOMAIN');
        $result = $sarv->settings->verifySendingDomain(domain, mailbox);
        print_r($result);
        /*
        Array
        (
            [status] => "success"
            [message] => "Verification instruction has been sent to john@abc.com"
        )
        */
    } catch(Sarv_Error $e) {
        // Sarv errors are thrown as exceptions
        echo "A sarv error occurred: " . get_class($e) . " - " . $e->getMessage();
    }
?>

Example Success Response


Array
(
    [status] => "success"
    [message] => "Verification instruction has been sent to john@abc.com"
)

Example Error Response


Array
(
    [status]=> "error"
    [code]=> -1
    [name]=> "AuthenticationError"
    [message]=> "Token MissMatch"
)

Parameters
owner_id* string a valid Sarv User Id
token* string a valid token
SarvTES_APP_DOMAIN* string a valid SarvTES APP DOMAIN
domain* string domain name
mailbox* string mailbox name
* compulsory field
Return Value: Success
struct the results of Verify sending domain
status string always success
message string human readable message
Return Value: Error
struct the error results when attempt to verify Sending Domain
status string error
message string human readable message
type string one of the error type as bellow table
Error types
ValidationError The parameters passed to the API call are invalid or not provided when required.
GeneralError An unexpected errors occurred processing the request. Sarv Developers will be notified.
AuthenticationError Provided owner_id and token was not matched.

/settings/listSendingDomain

List Sending Domain

Example Call


<?php
    try {
        require_once 'SarvMTA_PHP/Sarv.php';
        $sarv = new Sarv('owner_id', 'token', 'SarvTES_APP_DOMAIN');
        $result = $sarv->settings->listSendingDomain();
        print_r($result);
        /*
        Array
        (
            [status] => "success"
            [sending_domain_list] => array(
                                array(
                                    [domain] => "abc.com"
                                    [create_date] => 67457775764
                                    [dkim] => array(
                                                    [valid] => "Yes"
                                                )
                                    [spf] => array(
                                                    [valid] => "Yes"
                                                )
                                    [verify_domain] => array(
                                                    [valid] => "Yes"
                                                )
                                ),
                                array(
                                    [domain] => "xyz.com"
                                    [create_date] => 67457775891
                                    [dkim] => array(
                                                    [valid] => "Yes"
                                                )
                                    [spf] => array(
                                                    [valid] => "Yes"
                                                )
                                    [verify_domain] => array(
                                                    [valid] => "No"
                                                )
                                )
                            )
        )
        */
    } catch(Sarv_Error $e) {
        // Sarv errors are thrown as exceptions
        echo "A sarv error occurred: " . get_class($e) . " - " . $e->getMessage();
    }
?>

Example Success Response


Array
(
    [status] => "success"
    [sending_domain_list] => array(
                        array(
                            [domain] => "abc.com"
                            [create_date] => 67457775764
                            [dkim] => array(
                                            [valid] => "Yes"
                                        )
                            [spf] => array(
                                            [valid] => "Yes"
                                        )
                            [verify_domain] => array(
                                            [valid] => "Yes"
                                        )
                        ),
                        array(
                            [domain] => "xyz.com"
                            [create_date] => 67457775891
                            [dkim] => array(
                                            [valid] => "Yes"
                                        )
                            [spf] => array(
                                            [valid] => "Yes"
                                        )
                            [verify_domain] => array(
                                            [valid] => "No"
                                        )
                        )
                    )
)

Example Error Response


Array
(
    [status]=> "error"
    [code]=> -1
    [name]=> "AuthenticationError"
    [message]=> "Token MissMatch"
)

Parameters
owner_id* string a valid Sarv User Id
token* string a valid token
SarvTES_APP_DOMAIN* string a valid SarvTES APP DOMAIN
* compulsory field
Return Value: Success
struct the results of List Sending Domain
status string always success
message string human readable message
sending_domain_list[]struct information of single Sending Domain
domain string domain name
create_date integer create date in micro seconds
dkim[]struct dkim validation result
valid string value is Either 'Yes' OR 'No'
spf[]struct spf validation result
valid string value is Either 'Yes' OR 'No'
verify_domain[]struct verify_domain validation result
valid string value is Either 'Yes' OR 'No'
Return Value: Error
struct the error results when attempt to list Sending Domain
status string error
message string human readable message
type string one of the error type as bellow table
Error types
ValidationError The parameters passed to the API call are invalid or not provided when required.
GeneralError An unexpected errors occurred processing the request. Sarv Developers will be notified.
AuthenticationError Provided owner_id and token was not matched.

/settings/deleteSendingDomain

Delete Sending Domain

Example Call


<?php
    try {
        require_once 'SarvMTA_PHP/Sarv.php';
        $sarv = new Sarv('owner_id', 'token', 'SarvTES_APP_DOMAIN');
        $result = $sarv->settings->deleteSendingDomain(domain);
        print_r($result);
        /*
        Array
        (
            [status] => "success"
            [message] => "Sending Domain Deleted"
        )
        */
    } catch(Sarv_Error $e) {
        // Sarv errors are thrown as exceptions
        echo "A sarv error occurred: " . get_class($e) . " - " . $e->getMessage();
    }
?>

Example Success Response


Array
(
    [status] => "success"
    [message] => "Sending Domain Deleted"
)

Example Error Response


Array
(
    [status]=> "error"
    [code]=> -1
    [name]=> "AuthenticationError"
    [message]=> "Token MissMatch"
)

Parameters
owner_id* string a valid Sarv User Id
token* string a valid token
SarvTES_APP_DOMAIN* string a valid SarvTES APP DOMAIN
domain* string domain name
* compulsory field
Return Value: Success
struct the results of Delete sending domain
status string always success
message string human readable message
Return Value: Error
struct the error results when attempt to Delete Sending Domain
status string error
message string human readable message
type string one of the error type as bellow table
Error types
ValidationError The parameters passed to the API call are invalid or not provided when required.
GeneralError An unexpected errors occurred processing the request. Sarv Developers will be notified.
AuthenticationError Provided owner_id and token was not matched.