Jump to content

CUSTOM API DomainWhois - with premium domain pricing included in response


drosendo

Recommended Posts

Retrieve domain whois information with premium pricing if applicable

Request Parameters

Parameter Type Description Required
action string “getwhoistldpricing” Required
domain string The domain name to lookup Required

Response Parameters

Parameter Type Description
result string The result of the operation: success or error
status string The registration status: available or unavailable
whois string Whois server response

Example Request (CURL)

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
    http_build_query(
        array(
            'action' => 'getwhoistldpricing',
            // See https://developers.whmcs.com/api/authentication
            'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
            'password' => 'SECRET_OR_HASHED_PASSWORD',
            'domain' => 'example.com',
            'responsetype' => 'json',
        )
    )
);
$response = curl_exec($ch);
curl_close($ch);

Example Request (Local API)

$command = 'getwhoistldpricing';
$postData = array(
    'domain' => 'example.com',
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later

$results = localAPI($command, $postData, $adminUsername);
print_r($results);

Example Response JSON

{
    "example.com": {
        "result": "success",
        "status": "available",
        "whois": null,
        "premium": {
            "premiumCostExtra": {
                "to_amount": "-1.00",
                "markup": "20.00000"
            },
            "isPremium": true,
            "premiumCostPricing": {
                "transfer": "9.13",
                "create": "1596.73",
                "renew": "9.13",
                "sellingCurrencySymbol": "EUR"
            }
        }
    }
}

 

Just upload to /includes/api .

This is Working for ResellerClub, you may adjust to your reseller API, over on line 56 and 58.

    $params = getRegistrarConfigOptions('resellerclub');

    $url = 'https://test.httpapi.com/api/domains/available.json?auth-userid=' . $params['ResellerID'] . '&api-key=' . $params['APIKey'] . '&domain-name=' . $domainname . '&tlds=' . $tld . '&suggest-alternative=false';

 

Any contribution will be appreciated.

 

Cheers,

David

getwhoistldpricing.zip

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated