Domain Registrant API

getAll()

Description

Returns the list of registrants.

Signature

Throws

Example

<?php

use Dreamscape\ResellerApiSdk\Api;
use Dreamscape\ResellerApiSdk\Authenticator\ApiKey;
use Dreamscape\ResellerApiSdk\Http\Adapter\Curl;
use Dreamscape\ResellerApiSdk\Filter;
use Dreamscape\ResellerApiSdk\PredefinedValue;

$api = new Api(new Curl(new ApiKey('YourAPIKeyGoesHere'), 'https://reseller-api.sandbox.ds.network'));

$filters = Filter\Domain\Registrant\GetAll::build();
$filters->page = 1;
$filters->limit = 10;

$registrants = $api->domains->registrants->getAll($filters);

try {
    foreach ($registrants as $registrant) {
        echo 'Registrant ID: ' . $registrant->id . PHP_EOL;
        echo 'First Name: ' . $registrant->firstName . PHP_EOL;
        echo 'Last Name: ' . $registrant->lastName . PHP_EOL;

        if ($registrant->accountType === PredefinedValue\Domain\Registrant::ACCOUNT_TYPE_BUSINESS) {
            echo 'Business Name: ' . $registrant->businessName . PHP_EOL;
        }
    }
} catch (Exception\NotFoundException $e) {
    // Handle the exception.
}

getDetails()

Description

Returns the details about single registrant.

Signature

getDetails(int $registrant_id): DataObject\Domain\Registrant\Existing

Throws

Example

<?php

use Dreamscape\ResellerApiSdk\Api;
use Dreamscape\ResellerApiSdk\Authenticator\ApiKey;
use Dreamscape\ResellerApiSdk\Http\Adapter\Curl;
use Dreamscape\ResellerApiSdk\Exception;

$api = new Api(new Curl(new ApiKey('YourAPIKeyGoesHere'), 'https://reseller-api.sandbox.ds.network'));

try {
    $registrant = $api->domains->registrants->getDetails(123456);

    echo 'Registrant ID: ' . $registrant->id . PHP_EOL;
    echo 'First Name: ' . $registrant->firstName . PHP_EOL;
    echo 'Last Name: ' . $registrant->lastName . PHP_EOL;
} catch (Exception\NotFoundException $e) {
    // Handle the exception.
}

create()

Description

Creates new registrant.

Signature

Throws

Example

<?php

use Dreamscape\ResellerApiSdk\Api;
use Dreamscape\ResellerApiSdk\Authenticator\ApiKey;
use Dreamscape\ResellerApiSdk\Http\Adapter\Curl;
use Dreamscape\ResellerApiSdk\DataObject;
use Dreamscape\ResellerApiSdk\Exception;
use Dreamscape\ResellerApiSdk\PredefinedValue;

$api = new Api(new Curl(new ApiKey('YourAPIKeyGoesHere'), 'https://reseller-api.sandbox.ds.network'));

try {
    $new_registrant = DataObject\Domain\Registrant\Create::build()
        ->setFirstName('John')
        ->setLastName('Doe')
        ->setAddress('123 Example Street')
        ->setCity('Testville')
        ->setCountry('AU')
        ->setState('WA')
        ->setPostCode('00000')
        ->setCountryCode(61)
        ->setPhone('912345678')
        ->setEmail('john.doe@crazydomains.com.au')
        ->setAccountType(PredefinedValue\Domain\Registrant::ACCOUNT_TYPE_BUSINESS)
        ->setBusinessName('John & Doe Corp')
        ->setBusinessNumberType('ABN')
        ->setBusinessNumber('12345678');
    $registrant = $api->domains->registrants->create($new_registrant);

    echo 'Registrant ID: ' . $registrant->id . PHP_EOL;
} catch (Exception\BadRequestException $e) {
    // Handle the errors in $e->getErrors().
}

update()

Description

Updates the details of the single registrant.

Signature

Throws

Example

<?php

use Dreamscape\ResellerApiSdk\Api;
use Dreamscape\ResellerApiSdk\Authenticator\ApiKey;
use Dreamscape\ResellerApiSdk\Http\Adapter\Curl;
use Dreamscape\ResellerApiSdk\DataObject;
use Dreamscape\ResellerApiSdk\Exception;

$api = new Api(new Curl(new ApiKey('YourAPIKeyGoesHere'), 'https://reseller-api.sandbox.ds.network'));

try {
    $update_registrant = DataObject\Domain\Registrant\Update::build();
    $update_registrant->firstName = 'John';
    $update_registrant->lastName = 'Doe';

    $registrant = $api->domains->registrants->update(123456, $update_registrant);

    echo 'Registrant ID: ' . $registrant->id . PHP_EOL;
} catch (Exception\NotFoundException $e) {
    // Handle the exception.
} catch (Exception\BadRequestException $e) {
    // Handle the errors in $e->getErrors().
}