# API: Get sub-orderpages

# getSubCategories

List sub-orderpages from orderpage.

# Required parameters

Parameter Description
id Orderpage ID

# Request

GET /admin/api.php?api_id=API_ID&api_key=API_KEY&call=getSubCategories&id=ID

# PHP Samples

$url = 'http://url_to_hb.com/admin/api.php';
$post = [
  'call' => 'getSubCategories',
  '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);
include 'class.hbwrapper.php';
HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key');
$params = [
  'id' => $ID,
];
$return = HBWrapper::singleton()->getSubCategories($params);
print_r($return);
/* Use this method to access HostBill api from HostBill modules */
$api = new ApiWrapper();
$params = [
  'id' => $ID,
];
$return = $api->getSubCategories($params);
print_r($return);

# Response

{
    "success": true,
    "subcategories": [
        {
            "id": "148",
            "parent_id": "147",
            "contains": "products",
            "name": "Paris",
            "description": "France",
            "visible": "1",
            "slug": "paris",
            "sort_order": "122",
            "template": "onestep_cloud_2019",
            "ctype": "onestep",
            "ptype": "Shared",
            "lptype": "shared",
            "otype": "onestep_onestep_cloud_2019",
            "products": "5",
            "subcategories": "0",
            "ptype_id": "1"
        },
        {
            "id": "149",
            "parent_id": "147",
            "contains": "products",
            "name": "Dallas",
            "description": "United States",
            "visible": "1",
            "slug": "dallas",
            "sort_order": "123",
            "template": "onestep_cloud_2019",
            "ctype": "onestep",
            "ptype": "Shared",
            "lptype": "shared",
            "otype": "onestep_onestep_cloud_2019",
            "products": "4",
            "subcategories": "0",
            "ptype_id": "1"
        },
        {
            "id": "154",
            "parent_id": "147",
            "contains": "products",
            "name": "Frankfurt",
            "description": "Germany",
            "visible": "1",
            "slug": "frankfurt",
            "sort_order": "123",
            "template": "onestep_cloud_2019",
            "ctype": "onestep",
            "ptype": "Shared",
            "lptype": "shared",
            "otype": "onestep_onestep_cloud_2019",
            "products": "5",
            "subcategories": "0",
            "ptype_id": "1"
        }
    ],
    "call": "getSubCategories",
    "server_time": 1599565445
}
Last Updated: 10/7/2024, 2:36:43 PM