Internal API Doc for v0.1.x

SoluteDNS for WHMCS v2.xx.xxx and lower
Locked
User avatar
Daniel
Support
Posts: 200
Joined: 02 Aug 2013, 17:50

01 Sep 2015, 13:40

This only applies to the 0.1.x branch versions. See documentation for updated Internal API code.


SoluteDNS allows developers to add own scripted points where zones need to be edited. A developer can call three functions to add, edit or delete a record from a zone.

Add record:

Code: Select all

$domain = "example.com";
$newrecord = array(
    "name" => "example.com",
    "type" => "A",
    "content" => "192.168.2.1",
    "prio" => "0",
    "ttl" => "3600",
);
$api_call = solutedns_api_add($domain,$newrecord);


Edit record:

Code: Select all

$domain = "example.com";
$newrecord = array(
    "name" => "example.com",
    "type" => "MX",
    "content" => "127.0.0.5",
    "prio" => "0",
    "ttl" => "3600",
);
$current = array(
    "name" => "example.com",
    "type" => "A",
    "content" => "192.168.2.1",
);
$api_call = solutedns_api_edit($domain,$current,$newrecord);


Delete record

Code: Select all

$domain = "example.com";
$delete = array(
    "name" => "example.com",
    "type" => "A",
    "content" => "192.168.2.1",
);
$api_call = solutedns_api_delete($domain,$delete);


Retrieve DNSsec zone keys

Code: Select all

$domain = "example.com";
$api_call = solutedns_api_dnsseckeys($domain);


Retrieve full zone

Code: Select all

$domain = "example.com";
$api_call = solutedns_api_getzone($domain);


Returned Answer
When calling the api function the function will return an answer in a array consisting the status: success or error, and a message description.

Success message:

Code: Select all

Array ( [status] => success [description] => Record has been added to: test.com )

Error message:

Code: Select all

Array ( [status] => error [description] => Record has not been found. Unable to delete! )

API calls which return data instead of the result of an action are returning a data array instead of a success status answer.

Review returned results
To review the returned results of the API call you can use this code:

Code: Select all

echo '<pre>';
var_dump($api_call);
echo'</pre>';
Locked