Application Programming Interface

Change Reverse Host


Description:

This function enables you to change a reverse host associated with an IP Address.

URLs:
  • Sandbox URL: https://virtdedi.com/api-sandbox/v1/change_reverse_host
  • Real API URL: https://virtdedi.com/api/v1/change_reverse_host
Request Parameters:
Parameter Required Type Max Length Description
server_id Yes String 50 characters The ID of server you want to change its associated reverse host.
ip_address Yes String 50 characters The IP Adress
hostname Yes String 50 characters It should be FQDN (fully qualified domain name).
JSON Response:
    
        
{
    "code"    : "OK",
    "message" : "The reverse host has been changed.",
    "data"    : {
        "server_id"  : "12345",
        "ip_address" : "103.219.28.90",
        "hostname"   : "myserver.domain.com"
    }
}
    
XML Response:
    
        
<?xml version="1.0" encoding="utf-8"?>
<code>OK</code>
<message>The reverse host has been changed.</message>
<data>
    <server_id>12345</server_id>
    <ip_address>103.219.28.90</ip_address>
    <hostname>myserver.domain.com</hostname>
</data>
    
PHP Example:
    
        
<?php
$url      = "https://virtdedi.com/api-sandbox/v1/change_reverse_host";
//$url    = "https://virtdedi.com/api/v1/change_reverse_host";
$user_id  = "12312";
$API_key  = "hasdh6ghvhgFDa454565jasdbNBS";
$random   = rand(10000,99999).uniqid().rand(100000,999999);
$checksum = sha1(sha1(sha1($user_id.$API_key.$random)));
$data = array(
    "user_id"    => $user_id,
    "random"     => $random,
    "format"     => "json",
    "checksum"   => $checksum,
    "server_id"  => "12345",
    "ip_address" => "103.219.28.90",
    "hostname"   => "myserver.domain.com"
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$output = curl_exec($ch);
$curl_error = curl_errno($ch);
curl_close($ch);
if ($curl_error){
    echo "Unable to connect to API Server.";
} else {
    $outputArray = json_decode($output,true);
    if (!$outputArray){
        echo "Invalid JSON Format";
    } else {
        if ($outputArray["code"] == "OK"){
            print_r($outputArray);
            // Do what you want to do here if OK
        } else {
            echo "Error Message: ".$outputArray["message"];
            // Do what you want to do here if not OK
        }
    }
}