Skip to content

Latest commit

 

History

History
523 lines (344 loc) · 18.3 KB

File metadata and controls

523 lines (344 loc) · 18.3 KB

Hostinger\DomainsPortfolioApi

All URIs are relative to https://developers.hostinger.com, except if the operation defines another base path.

Method HTTP request Description
claimFreeDomainV1() POST /api/domains/v1/portfolio/claim Claim free domain
disableDomainLockV1() DELETE /api/domains/v1/portfolio/{domain}/domain-lock Disable domain lock
disablePrivacyProtectionV1() DELETE /api/domains/v1/portfolio/{domain}/privacy-protection Disable privacy protection
enableDomainLockV1() PUT /api/domains/v1/portfolio/{domain}/domain-lock Enable domain lock
enablePrivacyProtectionV1() PUT /api/domains/v1/portfolio/{domain}/privacy-protection Enable privacy protection
getDomainAuthorizationCodeV1() GET /api/domains/v1/portfolio/{domain}/auth-code Get domain authorization code
getDomainDetailsV1() GET /api/domains/v1/portfolio/{domain} Get domain details
getDomainListV1() GET /api/domains/v1/portfolio Get domain list
getDomainRenewalInformationV1() GET /api/domains/v1/portfolio/{domain}/renewal Get domain renewal information
purchaseNewDomainV1() POST /api/domains/v1/portfolio Purchase new domain
updateDomainNameserversV1() PUT /api/domains/v1/portfolio/{domain}/nameservers Update domain nameservers

claimFreeDomainV1()

claimFreeDomainV1($domainsV1PortfolioClaimRequest): \Hostinger\Model\DomainsV1PortfolioClaimResource

Claim free domain

Claim a free domain available on your account and register it. Unlike purchasing a domain, this consumes a free domain you already have, so no payment method is required. A successful response means the domain is registered. If registration fails, login to hPanel and check domain registration status. If no WHOIS information is provided, default contact information for that TLD will be used. Before making request, ensure WHOIS information for desired TLD exists in your account. Some TLDs require additional_details to be provided and these will be validated before claiming. Requests which cannot be fulfilled are rejected with an error code in the response body, for example 2037 when no free domain is available. Use this endpoint to register a domain using a free domain from your account.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domainsV1PortfolioClaimRequest = new \Hostinger\Model\DomainsV1PortfolioClaimRequest(); // \Hostinger\Model\DomainsV1PortfolioClaimRequest

try {
    $result = $apiInstance->claimFreeDomainV1($domainsV1PortfolioClaimRequest);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->claimFreeDomainV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domainsV1PortfolioClaimRequest \Hostinger\Model\DomainsV1PortfolioClaimRequest

Return type

\Hostinger\Model\DomainsV1PortfolioClaimResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]

disableDomainLockV1()

disableDomainLockV1($domain): \Hostinger\Model\CommonSuccessEmptyResource

Disable domain lock

Disable domain lock for the domain. Domain lock needs to be disabled before transferring the domain to another registrar. Use this endpoint to prepare domains for transfer to other registrars.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domain = mydomain.tld; // string | Domain name

try {
    $result = $apiInstance->disableDomainLockV1($domain);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->disableDomainLockV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domain string Domain name

Return type

\Hostinger\Model\CommonSuccessEmptyResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]

disablePrivacyProtectionV1()

disablePrivacyProtectionV1($domain): \Hostinger\Model\CommonSuccessEmptyResource

Disable privacy protection

Disable privacy protection for the domain. When privacy protection is disabled, domain owner's personal information is visible in public WHOIS database. Use this endpoint to make domain owner's information publicly visible.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domain = mydomain.tld; // string | Domain name

try {
    $result = $apiInstance->disablePrivacyProtectionV1($domain);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->disablePrivacyProtectionV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domain string Domain name

Return type

\Hostinger\Model\CommonSuccessEmptyResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]

enableDomainLockV1()

enableDomainLockV1($domain): \Hostinger\Model\CommonSuccessEmptyResource

Enable domain lock

Enable domain lock for the domain. When domain lock is enabled, the domain cannot be transferred to another registrar without first disabling the lock. Use this endpoint to secure domains against unauthorized transfers.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domain = mydomain.tld; // string | Domain name

try {
    $result = $apiInstance->enableDomainLockV1($domain);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->enableDomainLockV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domain string Domain name

Return type

\Hostinger\Model\CommonSuccessEmptyResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]

enablePrivacyProtectionV1()

enablePrivacyProtectionV1($domain): \Hostinger\Model\CommonSuccessEmptyResource

Enable privacy protection

Enable privacy protection for the domain. When privacy protection is enabled, domain owner's personal information is hidden from public WHOIS database. Use this endpoint to protect domain owner's personal information from public view.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domain = mydomain.tld; // string | Domain name

try {
    $result = $apiInstance->enablePrivacyProtectionV1($domain);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->enablePrivacyProtectionV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domain string Domain name

Return type

\Hostinger\Model\CommonSuccessEmptyResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getDomainAuthorizationCodeV1()

getDomainAuthorizationCodeV1($domain): \Hostinger\Model\DomainsV1PortfolioAuthCodeAuthCodeResource

Get domain authorization code

Retrieve the authorization (EPP) code for a specified domain so it can be transferred away from Hostinger to another registrar. Requesting a new code invalidates any code retrieved previously. Use this endpoint to obtain the code required to transfer a domain to another registrar.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domain = mydomain.tld; // string | Domain name

try {
    $result = $apiInstance->getDomainAuthorizationCodeV1($domain);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->getDomainAuthorizationCodeV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domain string Domain name

Return type

\Hostinger\Model\DomainsV1PortfolioAuthCodeAuthCodeResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getDomainDetailsV1()

getDomainDetailsV1($domain): \Hostinger\Model\DomainsV1DomainDomainExtendedResource

Get domain details

Retrieve detailed information for specified domain. Use this endpoint to view comprehensive domain configuration and status.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domain = mydomain.tld; // string | Domain name

try {
    $result = $apiInstance->getDomainDetailsV1($domain);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->getDomainDetailsV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domain string Domain name

Return type

\Hostinger\Model\DomainsV1DomainDomainExtendedResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getDomainListV1()

getDomainListV1(): \Hostinger\Model\DomainsV1DomainDomainResource[]

Get domain list

Retrieve all domains associated with your account. Use this endpoint to view user's domain portfolio.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);

try {
    $result = $apiInstance->getDomainListV1();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->getDomainListV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

This endpoint does not need any parameter.

Return type

\Hostinger\Model\DomainsV1DomainDomainResource[]

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getDomainRenewalInformationV1()

getDomainRenewalInformationV1($domain): \Hostinger\Model\DomainsV1PortfolioRenewalRenewalInformationResource

Get domain renewal information

Retrieve renewal information for a specified domain, including its status and current expiration date. Use this endpoint to build renewal automation and expiry monitoring for a single domain.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domain = mydomain.tld; // string | Domain name

try {
    $result = $apiInstance->getDomainRenewalInformationV1($domain);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->getDomainRenewalInformationV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domain string Domain name

Return type

\Hostinger\Model\DomainsV1PortfolioRenewalRenewalInformationResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]

purchaseNewDomainV1()

purchaseNewDomainV1($domainsV1PortfolioPurchaseRequest): \Hostinger\Model\BillingV1OrderOrderResource

Purchase new domain

Purchase and register a new domain name. If registration fails, login to hPanel and check domain registration status. If no payment method is provided, your default payment method will be used automatically. If no WHOIS information is provided, default contact information for that TLD will be used. Before making request, ensure WHOIS information for desired TLD exists in your account. Some TLDs require additional_details to be provided and these will be validated before completing purchase. Use this endpoint to register new domains for users.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domainsV1PortfolioPurchaseRequest = new \Hostinger\Model\DomainsV1PortfolioPurchaseRequest(); // \Hostinger\Model\DomainsV1PortfolioPurchaseRequest

try {
    $result = $apiInstance->purchaseNewDomainV1($domainsV1PortfolioPurchaseRequest);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->purchaseNewDomainV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domainsV1PortfolioPurchaseRequest \Hostinger\Model\DomainsV1PortfolioPurchaseRequest

Return type

\Hostinger\Model\BillingV1OrderOrderResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]

updateDomainNameserversV1()

updateDomainNameserversV1($domain, $domainsV1PortfolioUpdateNameserversRequest): \Hostinger\Model\CommonSuccessEmptyResource

Update domain nameservers

Set nameservers for a specified domain. Be aware, that improper nameserver configuration can lead to the domain being unresolvable or unavailable. Use this endpoint to configure custom DNS hosting for domains.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domain = mydomain.tld; // string | Domain name
$domainsV1PortfolioUpdateNameserversRequest = new \Hostinger\Model\DomainsV1PortfolioUpdateNameserversRequest(); // \Hostinger\Model\DomainsV1PortfolioUpdateNameserversRequest

try {
    $result = $apiInstance->updateDomainNameserversV1($domain, $domainsV1PortfolioUpdateNameserversRequest);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->updateDomainNameserversV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domain string Domain name
domainsV1PortfolioUpdateNameserversRequest \Hostinger\Model\DomainsV1PortfolioUpdateNameserversRequest

Return type

\Hostinger\Model\CommonSuccessEmptyResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]