1
Inventory API standard
Idea shared by Tung Nguyen - October 2, 2016 at 2:44 PM
Planned
The current Inventory API return is hard to normalize when it missing a lot of data, Can we have detailed for each server returned by API?
 
 
{"Data_Center": "PNJ","Description": "Rapid Deploy Server - Dual Proc Intel Xeon E5 2620 V4 64 GB HDD (PNJ)","Detail": "16 Core Dual Intel Xeon E5 2620 V4<br/>\r\n64 GB DDR4 ECC Reg RAM<br />\r\n4 x 2 TB HDD<br />\r\nHardware RAID10<br />\r\nNew York City Metro Data Center<br/>","Product_Id": "145","Recurring_12_Month": "3553.2000","Recurring_1_Hour": "0","Recurring_1_Month": "329.0000","Recurring_24_Month": "6316.8000","Recurring_36_Month": "-1.0000","Recurring_3_Month": "-1.0000","Recurring_6_Month": "1875.3000","Setup_12_Month": "0.0000","Setup_1_Hour": "0","Setup_1_Month": "0.0000","Setup_24_Month": "0.0000","Setup_36_Month": "0.0000","Setup_3_Month": "0.0000","Setup_6_Month": "0.0000","Stock": 0,}
 
 
Above is current API, I could try to explode from detail into feature. But look like it is random text, not follow any standard form.
So I would like to suggest new struct return for Inventory API
 
{"Data_Center": "PNJ","Description": "Rapid Deploy Server - Dual Proc Intel Xeon E5 2620 V4 64 GB HDD (PNJ)","Detail": "16 Core Dual Intel Xeon E5 2620 V4<br/>\r\n64 GB DDR4 ECC Reg RAM<br />\r\n4 x 2 TB HDD Hardware RAID10<br />\r\nNew York City Metro Data Center<br/>","Product_Id": "145","Recurring_12_Month": "3553.2000","Recurring_1_Hour": "0","Recurring_1_Month": "329.0000","Recurring_24_Month": "6316.8000","Recurring_36_Month": "-1.0000","Recurring_3_Month": "-1.0000","Recurring_6_Month": "1875.3000","Setup_12_Month": "0.0000","Setup_1_Hour": "0","Setup_1_Month": "0.0000","Setup_24_Month": "0.0000","Setup_36_Month": "0.0000","Setup_3_Month": "0.0000","Setup_6_Month": "0.0000","Stock": 100,"features": {"CPU": "Dual Intel Xeon E5 2620 V4","Available": "64 GB DDR4 ECC Reg RAM","Maximium_RAM": "256GB DDR4 EEC Reg RAM","Available_Disk": "4 x 2 TB HDD Hardware RAID10","Maximium_Disk": "4","Available_IP": "5","Maximium_IP": "256","Network": "1Gbps Dedicated","Bandwidth": "10TB Premium"}}
 
 
I know the current API returned base on WHMCS database, but It would be nice if you can apply the struct above or has some "standard" for each Detail field returned from API, so we could transform it into another field
 
"Detail": "16 Core Dual Intel Xeon E5 2620 V4<br/>\r\n64 GB DDR4 ECC Reg RAM<br />\r\n4 x 2 TB HDD Hardware RAID10<br />\r\nNew York City Metro Data Center<br/>"
 

2 Replies

Reply to Thread
1
Radic D. Replied
October 3, 2016 at 10:41 PM
Employee Post
Rapid deploy servers cannot be customized. Have you tried pulling the details for a non-rapid deploy? You should be getting a list of all of the options available for the server as well.
0
Tung Nguyen Replied
October 5, 2016 at 7:56 AM
Okay thank you. I didn't know about that.
Btw, the document for Inventory API is wrong, you should fix it.
1. AddonGroupsList : parameter is pStrProductId
2. AddonList: Should be AddonsList
 
Here are my simple PHP  to make it work with current API, hope it help someone else.
<?php
/**
 * Created by PhpStorm.
 * User: tung
 * Date: 10/1/16
 * Time: 3:09 PM
 */
error_reporting(E_ALL);
ini_set('display_errors', 1);
header("Access-Control-Allow-Origin: *");
header('Content-Type: application/json');

$apiUrl = 'api.reliablesite.net/inventory.svc?wsdl';

try {
    $soap = new SoapClient($apiUrl, [
        'uri'=>'schemas.xmlsoap.org/soap/envelope/',
        'style'=>SOAP_RPC,
        'use'=>SOAP_ENCODED,
        'soap_version'=>SOAP_1_1,
        'cache_wsdl'=>WSDL_CACHE_NONE,
        'connection_timeout'=>15,
        'trace'=>true,
        'encoding'=>'UTF-8',
        'exceptions'=>true,
    ]);
    $serverList = $soap->ServersList();
    $addonGroupsList = $soap->AddonGroupsList([
        'pStrProductId' => '104'
    ]);
    $addonList = $soap->AddonsList([
        'pStrGroupId' => 647
    ]);
    echo json_encode([
        'serverList' => $serverList,
        'addonGroupList' => $addonGroupsList,
        'addonList' => $addonList
    ]);
} catch (Exception $e) {
    die($e->getMessage());
}
 

Reply to Thread