### PHP cURL Example: Get Client Tickets Source: https://api2.hostbillapp.com/clients/getClientTickets Example of how to fetch a client's support tickets using the HostBill Admin API with PHP cURL. Demonstrates setting up the request URL, POST data, and handling the response. ```PHP $url = 'http://url_to_hb.com/admin/api.php'; $post = [ 'call' => 'getClientTickets', 'api_id' => $API_ID, 'api_key' => $API_KEY, 'id' => $ID, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $data = curl_exec($ch); curl_close($ch); $return = json_decode($data, true); print_r($return); ``` -------------------------------- ### Get Client Details - HostBill Wrapper Example Source: https://api2.hostbillapp.com/clients/getClientDetails Shows how to retrieve client details using the HostBill API wrapper class, simplifying API interactions. ```php include 'class.hbwrapper.php'; HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key'); $params = [ 'id' => $ID, ]; $return = HBWrapper::singleton()->getClientDetails($params); print_r($return); ``` -------------------------------- ### Get Basic Account Details - PHP ApiWrapper Example Source: https://api2.hostbillapp.com/accounts/getAccountDetailsBasic Provides an example of accessing the HostBill API from within HostBill modules using the ApiWrapper class in PHP to get basic account details. ```PHP /* Use this method to access HostBill api from HostBill modules */ $api = new ApiWrapper(); $params = [ 'id' => $ID, ]; $return = $api->getAccountDetailsBasic($params); print_r($return); ``` -------------------------------- ### Get Client Files using ApiWrapper (PHP) Source: https://api2.hostbillapp.com/clients/getClientFiles Example of how to fetch client files using the HostBill Admin API directly from HostBill modules in PHP. ```PHP /* Use this method to access HostBill api from HostBill modules */ $api = new ApiWrapper(); $params = [ 'client_id' => $CLIENT_ID, ]; $return = $api->getClientFiles($params); print_r($return); ``` -------------------------------- ### Get Client Files using HBWrapper (PHP) Source: https://api2.hostbillapp.com/clients/getClientFiles Example of how to fetch client files using the HostBill Admin API with the HBWrapper class in PHP. ```PHP include 'class.hbwrapper.php'; HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key'); $params = [ 'client_id' => $CLIENT_ID, ]; $return = HBWrapper::singleton()->getClientFiles($params); print_r($return); ``` -------------------------------- ### Get Client Details - cURL Example Source: https://api2.hostbillapp.com/clients/getClientDetails Demonstrates how to fetch client details using a direct cURL request to the HostBill Admin API. ```php $url = 'http://url_to_hb.com/admin/api.php'; $post = [ 'call' => 'getClientDetails', 'api_id' => $API_ID, 'api_key' => $API_KEY, 'id' => $ID, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $data = curl_exec($ch); curl_close($ch); $return = json_decode($data, true); print_r($return); ``` -------------------------------- ### Get Client Files using cURL (PHP) Source: https://api2.hostbillapp.com/clients/getClientFiles Example of how to fetch client files using the HostBill Admin API with cURL in PHP. ```PHP $url = 'http://url_to_hb.com/admin/api.php'; $post = [ 'call' => 'getClientFiles', 'api_id' => $API_ID, 'api_key' => $API_KEY, 'client_id' => $CLIENT_ID, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $data = curl_exec($ch); curl_close($ch); $return = json_decode($data, true); print_r($return); ``` -------------------------------- ### PHP HBWrapper Example: Get Client Tickets Source: https://api2.hostbillapp.com/clients/getClientTickets Demonstrates fetching client support tickets using the HostBill API wrapper class (HBWrapper). Shows how to set API credentials and call the getClientTickets method with parameters. ```PHP include 'class.hbwrapper.php'; HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key'); $params = [ 'id' => $ID, ]; $return = HBWrapper::singleton()->getClientTickets($params); print_r($return); ``` -------------------------------- ### Get Server Details using HostBill Wrapper Source: https://api2.hostbillapp.com/apps/getServerDetails This example shows how to retrieve server details using the HostBill API wrapper class in PHP. It requires setting the API endpoint and credentials before calling the method. ```PHP include 'class.hbwrapper.php'; HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key'); $params = [ 'id' => $ID, ]; $return = HBWrapper::singleton()->getServerDetails($params); print_r($return); ``` -------------------------------- ### Activate Client as Affiliate (PHP Wrapper) Source: https://api2.hostbillapp.com/clients/activateAsAffiliate Example of activating a client as an affiliate using the HostBill API wrapper class in PHP. ```PHP include 'class.hbwrapper.php'; HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key'); $params = [ 'client_id' => CLIENT_ID, ]; $return = HBWrapper::singleton()->activateAsAffiliate($params); print_r($return); ``` -------------------------------- ### PHP Internal ApiWrapper Example: Get Client Tickets Source: https://api2.hostbillapp.com/clients/getClientTickets Example for accessing the HostBill API from within HostBill modules using the internal ApiWrapper class to retrieve client support tickets. ```PHP /* Use this method to access HostBill api from HostBill modules */ $api = new ApiWrapper(); $params = [ 'id' => $ID, ]; $return = $api->getClientTickets($params); print_r($return); ``` -------------------------------- ### HostBill Admin API - Account Module: Create Source: https://api2.hostbillapp.com/local API reference for creating a new account within the HostBill system. This section details the necessary parameters and expected outcomes for account creation. ```APIDOC Account module-Create: - Creates a new account. - Parameters: (Details not provided in the input text, but would typically include client details, package, etc.) - Returns: (Details not provided in the input text, but would typically include the new account ID or status.) ``` -------------------------------- ### Get Client Automation Settings - PHP Wrapper Example Source: https://api2.hostbillapp.com/clients/getClientAutomationSettings Shows how to retrieve client automation settings using the HostBill wrapper class. This method simplifies API interactions by abstracting the cURL requests. ```PHP include 'class.hbwrapper.php'; HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key'); $params = [ 'id' => $ID, ]; $return = HBWrapper::singleton()->getClientAutomationSettings($params); print_r($return); ``` -------------------------------- ### PHP ApiWrapper Example for Get Cancellations Source: https://api2.hostbillapp.com/accounts/getCancellations Illustrates how to access the HostBill API from within HostBill modules using the ApiWrapper class to get cancellation requests. ```php /* Use this method to access HostBill api from HostBill modules */ $api = new ApiWrapper(); $params = [ ]; $return = $api->getCancellations($params); print_r($return); ``` -------------------------------- ### HostBill Admin API Reference - Plugins Source: https://api2.hostbillapp.com/index This section provides API references for various HostBill plugins, enabling management of specific functionalities such as DNS zones, inventory, IP addresses, multi-branding, status updates, password management, SEPA Direct Debit, and virtual machine management. ```APIDOC Plugin: DNS Zone Editor Plugin: Inventory Manager Plugin: IPAM Plugin: MultiBrand Plugin: Status Updates Plugin: Password Manager Plugin: SEPA DD Plugin: VMManager ``` -------------------------------- ### Get Client Statistics using cURL Source: https://api2.hostbillapp.com/clients/getClientStats Example of how to fetch client statistics using a cURL request in PHP. ```PHP $url = 'http://url_to_hb.com/admin/api.php'; $post = [ 'call' => 'getClientStats', 'api_id' => $API_ID, 'api_key' => $API_KEY, 'id' => $ID, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $data = curl_exec($ch); curl_close($ch); $return = json_decode($data, true); print_r($return); ``` -------------------------------- ### List Affiliate Vouchers (cURL) Source: https://api2.hostbillapp.com/affiliates/getAffiliateVouchers Example of how to list affiliate vouchers using cURL in PHP. It demonstrates setting up the request, sending it to the API, and processing the JSON response. ```PHP $url = 'http://url_to_hb.com/admin/api.php'; $post = [ 'call' => 'getAffiliateVouchers', 'api_id' => $API_ID, 'api_key' => $API_KEY, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $data = curl_exec($ch); curl_close($ch); $return = json_decode($data, true); print_r($return); ``` -------------------------------- ### HostBill Admin API: Get Client Accounts (PHP ApiWrapper) Source: https://api2.hostbillapp.com/clients/getClientAccounts Example of how to get client accounts using the HostBill Admin API from within HostBill modules using the ApiWrapper class. ```PHP /* Use this method to access HostBill api from HostBill modules */ $api = new ApiWrapper(); $params = [ 'id' => $ID, ]; $return = $api->getClientAccounts($params); print_r($return); ``` -------------------------------- ### HostBill Admin API - Plugin: VMManager Source: https://api2.hostbillapp.com/remote API methods for managing Virtual Machines using the VMManager plugin. ```APIDOC Plugin: VMManager: ``` -------------------------------- ### HostBill API Response Example Source: https://api2.hostbillapp.com/clients/addClient This is an example of a successful response from the HostBill API after performing an action, such as adding a client. It includes success status, client ID, the called function, server time, and informational messages. ```JSON { "success": true, "client_id": "14", "call": "addClient", "server_time": 1323785423, "info": [ "New client account created" ] } ``` -------------------------------- ### Get Client Statistics using HostBill Wrapper Source: https://api2.hostbillapp.com/clients/getClientStats Example of how to fetch client statistics using the HostBill wrapper class in PHP. ```PHP include 'class.hbwrapper.php'; HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key'); $params = [ 'id' => $ID, ]; $return = HBWrapper::singleton()->getClientStats($params); print_r($return); ``` -------------------------------- ### PHP HBWrapper Example for Get Cancellations Source: https://api2.hostbillapp.com/accounts/getCancellations Shows how to retrieve cancellation requests using the HBWrapper class, a convenient wrapper for the HostBill API. ```php include 'class.hbwrapper.php'; HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key'); $params = [ ]; $return = HBWrapper::singleton()->getCancellations($params); print_r($return); ``` -------------------------------- ### HostBill Admin API: Get Client Accounts (PHP cURL) Source: https://api2.hostbillapp.com/clients/getClientAccounts Example of how to get client accounts using the HostBill Admin API with PHP and cURL. Demonstrates making a POST request with necessary parameters. ```PHP $url = 'http://url_to_hb.com/admin/api.php'; $post = [ 'call' => 'getClientAccounts', 'api_id' => $API_ID, 'api_key' => $API_KEY, 'id' => $ID, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $data = curl_exec($ch); curl_close($ch); $return = json_decode($data, true); print_r($return); ``` -------------------------------- ### List Affiliate Commission Plans (PHP Wrapper) Source: https://api2.hostbillapp.com/affiliates/getAffiliateCommisionPlans Demonstrates using the HostBill API wrapper class in PHP to fetch affiliate commission plans. This approach simplifies API interactions by providing a class-based interface. ```PHP include 'class.hbwrapper.php'; HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key'); $params = [ ]; $return = HBWrapper::singleton()->getAffiliateCommisionPlans($params); print_r($return); ``` -------------------------------- ### HostBill Admin API: Get Domains Response Structure Source: https://api2.hostbillapp.com/domains/getDomains Example JSON response structure for the getDomains API call, detailing domain properties. ```APIDOC { "success": true, "domains": [ { "id": "13", "manual": "0", "name": "silo3.mobi", "lastname": "Doe", "firstname": "John", "cid": "1", "period": "1", "recurring_amount": "9.95", "currency_id": "0", "module": "namesilo", "next_due": "2012-12-12", "expires": "2012-12-12", "status": "Active", "type": "Register", "date_created": "2011-12-12", "autorenew": "1", "reglock": "1", "idprotection": "1" }, { "id": "11", "manual": "0", "name": "netearthorg.org", "lastname": "Doe", "firstname": "John", "cid": "1", "period": "1", "recurring_amount": "9.95", "currency_id": "0", "module": "NetEarthOne", "next_due": "2012-11-22", "expires": "2012-11-22", "status": "Active", "type": "Register", "date_created": "2011-11-22", "autorenew": "1", "reglock": "1", "idprotection": "0" }, { "id": "10", "manual": "0", "name": "hbappreseller.co.uk", "lastname": "Blue", "firstname": "Mike", "cid": "6", "period": "2", "recurring_amount": "9.95", "currency_id": "0", "module": "NetEarthOne", "next_due": "2012-11-22", "expires": "0000-00-00", "status": "Pending", "type": "Register", "date_created": "0000-00-00", "autorenew": "1", "reglock": "0", "idprotection": "0" } ], "call": "getDomains", "server_time": 1323793581 } ``` -------------------------------- ### Add Client via HostBill Wrapper Source: https://api2.hostbillapp.com/clients/addClient This example shows how to add a client using the HostBill wrapper class. It involves setting the API credentials and then calling the addClient method with the client's details. ```PHP include 'class.hbwrapper.php'; HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key'); $params = [ 'firstname' => $FIRSTNAME, 'lastname' => $LASTNAME, 'email' => $EMAIL, 'password' => $PASSWORD, 'password2' => $PASSWORD2, ]; $return = HBWrapper::singleton()->addClient($params); print_r($return); ``` -------------------------------- ### HostBill Admin API: Get Clients List (cURL) Source: https://api2.hostbillapp.com/clients/getClients Example of how to fetch the client list using the HostBill Admin API with cURL in PHP. This snippet demonstrates setting up the request URL, POST data including API credentials and the 'getClients' call, and handling the response. ```PHP $url = 'http://url_to_hb.com/admin/api.php'; $post = [ 'call' => 'getClients', 'api_id' => $API_ID, 'api_key' => $API_KEY, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $data = curl_exec($ch); curl_close($ch); $return = json_decode($data, true); print_r($return); ``` -------------------------------- ### HostBill Admin API: Get Client Accounts (PHP HBWrapper) Source: https://api2.hostbillapp.com/clients/getClientAccounts Example of how to get client accounts using the HostBill Admin API with the HBWrapper PHP class. Shows setting API credentials and calling the getClientAccounts method. ```PHP include 'class.hbwrapper.php'; HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key'); $params = [ 'id' => $ID, ]; $return = HBWrapper::singleton()->getClientAccounts($params); print_r($return); ``` -------------------------------- ### HostBill Admin API - Plugin: MultiBrand Source: https://api2.hostbillapp.com/remote API methods for managing multi-brand configurations. ```APIDOC Plugin: MultiBrand: ``` -------------------------------- ### HostBill Admin API: Get App Servers (PHP Wrapper) Source: https://api2.hostbillapp.com/apps/getAppServers Demonstrates using the HostBill wrapper class to fetch the list of app servers. This provides a more object-oriented approach to interacting with the API. ```PHP include 'class.hbwrapper.php'; HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key'); $params = [ 'group' => $GROUP, ]; $return = HBWrapper::singleton()->getAppServers($params); print_r($return); ``` -------------------------------- ### HostBill Admin API - Get App Groups (cURL) Source: https://api2.hostbillapp.com/apps/getAppGroups Example of how to call the HostBill Admin API to get the list of app groups using cURL in PHP. This method demonstrates a direct HTTP POST request to the API endpoint. ```PHP $url = 'http://url_to_hb.com/admin/api.php'; $post = [ 'call' => 'getAppGroups', 'api_id' => $API_ID, 'api_key' => $API_KEY, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $data = curl_exec($ch); curl_close($ch); $return = json_decode($data, true); print_r($return); ``` -------------------------------- ### HostBill Admin API: Get App Servers (PHP cURL) Source: https://api2.hostbillapp.com/apps/getAppServers Example of how to call the HostBill Admin API to get the list of app servers using PHP cURL. This method sends a POST request with the necessary parameters. ```PHP $url = 'http://url_to_hb.com/admin/api.php'; $post = [ 'call' => 'getAppServers', 'api_id' => $API_ID, 'api_key' => $API_KEY, 'group' => $GROUP, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $data = curl_exec($ch); curl_close($ch); $return = json_decode($data, true); print_r($return); ``` -------------------------------- ### HostBill Admin API - Plugin: VMManager Source: https://api2.hostbillapp.com/local API reference for the VMManager plugin. This plugin is likely used for managing virtual machines, such as creation, deletion, and configuration. ```APIDOC Plugin: VMManager: - Manages virtual machines. - Functionality: (Details not provided in the input text, but would typically include VM lifecycle management and resource allocation.) ``` -------------------------------- ### HostBill Admin API: Create Account (ApiWrapper) Source: https://api2.hostbillapp.com/accounts/accountCreate Example of creating a HostBill account using the ApiWrapper class, intended for internal calls within HostBill modules. This provides direct access to the API methods. ```PHP /* Use this method to access HostBill api from HostBill modules */ $api = new ApiWrapper(); $params = [ 'id' => $ID, ]; $return = $api->accountCreate($params); print_r($return); ``` -------------------------------- ### HostBill Admin API: Get Client Orders (cURL) Source: https://api2.hostbillapp.com/clients/getClientOrders Example of how to fetch a client's orders using the HostBill Admin API with cURL in PHP. ```PHP $url = 'http://url_to_hb.com/admin/api.php'; $post = [ 'call' => 'getClientOrders', 'api_id' => $API_ID, 'api_key' => $API_KEY, 'id' => $ID, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $data = curl_exec($ch); curl_close($ch); $return = json_decode($data, true); print_r($return); ``` -------------------------------- ### List Affiliate Vouchers (HBWrapper) Source: https://api2.hostbillapp.com/affiliates/getAffiliateVouchers Example of how to list affiliate vouchers using the HostBill Wrapper class in PHP. This method simplifies API interactions. ```PHP include 'class.hbwrapper.php'; HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key'); $params = [ ]; $return = HBWrapper::singleton()->getAffiliateVouchers($params); print_r($return); ``` -------------------------------- ### Get Client Contacts using Internal API Wrapper Source: https://api2.hostbillapp.com/clients/getClientContacts Example of calling the getClientContacts method from within HostBill modules using the internal ApiWrapper class. ```PHP /* Use this method to access HostBill api from HostBill modules */ $api = new ApiWrapper(); $params = [ 'id' => $ID, ]; $return = $api->getClientContacts($params); print_r($return); ``` -------------------------------- ### Activate Client as Affiliate (PHP Internal) Source: https://api2.hostbillapp.com/clients/activateAsAffiliate Example of activating a client as an affiliate from within HostBill modules using the internal API wrapper in PHP. ```PHP /* Use this method to access HostBill api from HostBill modules */ $api = new ApiWrapper(); $params = [ 'client_id' => CLIENT_ID, ]; $return = $api->activateAsAffiliate($params); print_r($return); ``` -------------------------------- ### Get Client Invoices using cURL Source: https://api2.hostbillapp.com/clients/getClientInvoices Example of how to fetch a client's invoices using the HostBill Admin API via a cURL request in PHP. ```PHP $url = 'http://url_to_hb.com/admin/api.php'; $post = [ 'call' => 'getClientInvoices', 'api_id' => $API_ID, 'api_key' => $API_KEY, 'id' => $ID, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $data = curl_exec($ch); curl_close($ch); $return = json_decode($data, true); print_r($return); ``` -------------------------------- ### List Affiliate Campaigns using Internal ApiWrapper Source: https://api2.hostbillapp.com/affiliates/getAffiliateCampaigns This snippet demonstrates how to list affiliate campaigns by directly using the ApiWrapper class within HostBill modules. It initializes the wrapper and calls the getAffiliateCampaigns method. ```PHP /* Use this method to access HostBill api from HostBill modules */ $api = new ApiWrapper(); $params = [ ]; $return = $api->getAffiliateCampaigns($params); print_r($return); ``` -------------------------------- ### PHP Samples for Add Client Credit Source: https://api2.hostbillapp.com/clients/addClientCredit Provides multiple PHP code examples for interacting with the HostBill Admin API to add client credit. Demonstrates usage with cURL for external requests, a wrapper class for simplified calls, and an internal API call within HostBill modules. ```PHP $url = 'http://url_to_hb.com/admin/api.php'; $post = [ 'call' => 'addClientCredit', 'api_id' => $API_ID, 'api_key' => $API_KEY, 'client_id' => $CLIENT_ID, 'amount' => $AMOUNT, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $data = curl_exec($ch); curl_close($ch); $return = json_decode($data, true); print_r($return); ``` ```PHP include 'class.hbwrapper.php'; HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key'); $params = [ 'client_id' => $CLIENT_ID, 'amount' => $AMOUNT, ]; $return = HBWrapper::singleton()->addClientCredit($params); print_r($return); ``` ```PHP /* Use this method to access HostBill api from HostBill modules */ $api = new ApiWrapper(); $params = [ 'client_id' => $CLIENT_ID, 'amount' => $AMOUNT, ]; $return = $api->addClientCredit($params); print_r($return); ``` -------------------------------- ### Get Client Details - Internal API Call Example Source: https://api2.hostbillapp.com/clients/getClientDetails Illustrates how to call the getClientDetails function internally from within HostBill modules using the ApiWrapper class. ```php /* Use this method to access HostBill api from HostBill modules */ $api = new ApiWrapper(); $params = [ 'id' => $ID, ]; $return = $api->getClientDetails($params); print_r($return); ``` -------------------------------- ### HostBill Admin API: Get Cancellation Reasons (HBWrapper) Source: https://api2.hostbillapp.com/accounts/getCancellationReasons Example of how to fetch cancellation reasons using the HostBill Admin API with the HBWrapper PHP class. ```PHP include 'class.hbwrapper.php'; HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key'); $params = [ ]; $return = HBWrapper::singleton()->getCancellationReasons($params); print_r($return); ``` -------------------------------- ### HostBill Admin API: Set Client Automation Settings (PHP Wrapper) Source: https://api2.hostbillapp.com/clients/setClientAutomationSettings Demonstrates setting client automation settings using the HostBill wrapper class. This provides a more object-oriented approach to interacting with the API. ```PHP include 'class.hbwrapper.php'; HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key'); $params = [ 'id' => $ID, 'setting' => $SETTING, ]; $return = HBWrapper::singleton()->setClientAutomationSettings($params); print_r($return); ``` -------------------------------- ### Get Domain Details using Internal API Wrapper Source: https://api2.hostbillapp.com/domains/getDomainDetails Provides an example of accessing the HostBill API from within HostBill modules using the internal API wrapper. ```PHP /* Use this method to access HostBill api from HostBill modules */ $api = new ApiWrapper(); $params = [ 'id' => $ID, ]; $return = $api->getDomainDetails($params); print_r($return); ``` -------------------------------- ### Activate Client as Affiliate (PHP cURL) Source: https://api2.hostbillapp.com/clients/activateAsAffiliate Example of activating a client as an affiliate using PHP cURL to interact with the HostBill Admin API. ```PHP $url = 'http://url_to_hb.com/admin/api.php'; $post = [ 'call' => 'activateAsAffiliate', 'api_id' => API_ID, 'api_key' => API_KEY, 'client_id' => CLIENT_ID, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $data = curl_exec($ch); curl_close($ch); $return = json_decode($data, true); print_r($return); ``` -------------------------------- ### HostBill Admin API: Get Client Orders (HBWrapper) Source: https://api2.hostbillapp.com/clients/getClientOrders Example of how to fetch a client's orders using the HostBill Admin API with the HBWrapper class in PHP. ```PHP include 'class.hbwrapper.php'; HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key'); $params = [ 'id' => $ID, ]; $return = HBWrapper::singleton()->getClientOrders($params); print_r($return); ``` -------------------------------- ### List Affiliate Campaigns via HostBill Wrapper Source: https://api2.hostbillapp.com/affiliates/getAffiliateCampaigns This snippet shows how to list affiliate campaigns using the HostBill API wrapper class in PHP. It involves setting the API credentials and calling the getAffiliateCampaigns method. ```PHP include 'class.hbwrapper.php'; HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key'); $params = [ ]; $return = HBWrapper::singleton()->getAffiliateCampaigns($params); print_r($return); ``` -------------------------------- ### PHP Internal Call Example: Get Client Domains Source: https://api2.hostbillapp.com/clients/getClientDomains Illustrates how to call the getClientDomains function from within HostBill modules using the internal API wrapper in PHP. ```PHP /* Use this method to access HostBill api from HostBill modules */ $api = new ApiWrapper(); $params = [ 'id' => $ID, ]; $return = $api->getClientDomains($params); print_r($return); ``` -------------------------------- ### Add Addon to Account API Reference Source: https://api2.hostbillapp.com/accounts/addAddonToAccount This section details the 'addAddonToAccount' API call. It specifies the required parameters (account_id, addon_id) and optional parameters (invoice, cycle, payment_module, prorata) that control invoice generation, billing cycle, payment gateway, and prorating. The request format and a sample JSON response are provided. ```APIDOC API: Add Addon to Account addAddonToAccount Add an addon to existing account. Required parameters: Parameter | Description ---|--- `account_id` | Account ID `addon_id` | ID of addon from hb_addons table to add Optional parameters: Parameter | Description ---|--- `invoice` | Set to "true" if invoice for adding this addon should be generated `cycle` | Billing cycle for addon, allowed values: 'm','q','s','a','b','t','d','w','h' or 'Free' or 'Once' where m-monthly, q-quarterly etc. `payment_module` | If you choose to generate invoice, you can provide ID of payment gateway to use `prorata` | Set to '1' to pro-rate invoice and match due date of newly created addon to account one Request: GET /admin/api.php?api_id=API_ID&api_key=API_KEY&call=addAddonToAccount&account_id=ACCOUNT_ID&addon_id=ADDON_ID Response: { "success": true, "newaddon": true, "call": "addAddonToAccount", "server_time": 1366103631, "info": [ "Addon added" ] } ``` -------------------------------- ### HostBill Admin API - Get Client Access (Internal Call) Source: https://api2.hostbillapp.com/clients/getClientAccess Example of how to call the HostBill Admin API's getClientAccess method from within HostBill modules. ```PHP /* Use this method to access HostBill api from HostBill modules */ $api = new ApiWrapper(); $params = [ 'id' => $ID, ]; $return = $api->getClientAccess($params); print_r($return); ``` -------------------------------- ### HostBill Admin API - Get Client Access (PHP cURL) Source: https://api2.hostbillapp.com/clients/getClientAccess Example of how to call the HostBill Admin API's getClientAccess method using PHP cURL. ```PHP $url = 'http://url_to_hb.com/admin/api.php'; $post = [ 'call' => 'getClientAccess', 'api_id' => $API_ID, 'api_key' => $API_KEY, 'id' => $ID, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $data = curl_exec($ch); curl_close($ch); $return = json_decode($data, true); print_r($return); ``` -------------------------------- ### HostBill Admin API: Create Account (HBWrapper) Source: https://api2.hostbillapp.com/accounts/accountCreate Example of creating a HostBill account using the HBWrapper PHP class. This simplifies API interactions by providing a dedicated wrapper for HostBill API calls. ```PHP include 'class.hbwrapper.php'; HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key'); $params = [ 'id' => $ID, ]; $return = HBWrapper::singleton()->accountCreate($params); print_r($return); ``` -------------------------------- ### PHP cURL Example for Get Cancellations Source: https://api2.hostbillapp.com/accounts/getCancellations Demonstrates how to fetch cancellation requests using PHP's cURL library by making a POST request to the HostBill Admin API. ```php $url = 'http://url_to_hb.com/admin/api.php'; $post = [ 'call' => 'getCancellations', 'api_id' => $API_ID, 'api_key' => $API_KEY, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $data = curl_exec($ch); curl_close($ch); $return = json_decode($data, true); print_r($return); ```