NIS API
Application Programming Interface
Introduction
NIS can easily integrate with any third party software or inventory management solution.
Automatic API - Data Push
Automatically push data to your choice of URL for every inventory item without the need of human resource. This is called automatic data push, NIS can be configured to push data in comma separated clear text, XML and JSON formats. Once configured, data will always automatically be pushed to your choice of URL.
On-Demand Manual API - Data Pull
NIS can also be configured to allow on-demand data pull requests. This is called on-demand data pull request. Once configured your application can request data from NIS for specific inventory items. NIS can be configured to allow you to pull data in comma separated clear text, XML and JSON formats. Once configured you can request data from NIS by simply calling a URL and sending GET variables.
Manual API - Data Push
NIS can also be configured to push selective data manually. This can be done by pressing a button on the Backend, NIS can push data to choice of your URI / URL manually on-demand in comma separated clear text, XML and JSON formats.
1. Data Formats
NIS currently supports API data push/pull in following formats.
i) XML
See below example of XML format, all XML data will be pushed to your choice of URL in follow format.
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <data> <system> <customer>Default</customer> <batch>Default</batch> <origin>Default</origin> <custref>Default</custref> <ourref>Default</ourref> <comments>Default</comments> <manufacturer>LENOVO</manufacturer> <model>20208</model> <systype>Notebook</systype> <uuid>518B9081-52CF-11CB-8F56-F0B5DD36A750</uuid> <asset_tag>No Asset Information</asset_tag> <serial>WB12009458</serial> <boardserial>INVALID</boardserial> <proc_vendor>Intel(R) Corporation</proc_vendor> <proc_type>Central Processor</proc_type> <proc_family>Core i3</proc_family> <proc_cores>2</proc_cores> <proc_core_enabled>2</proc_core_enabled> <proc_thread_count>4</proc_thread_count> <proc_external_clock>100 MHz</proc_external_clock> <proc_max_speed>2400 MHz</proc_max_speed> <proc_speed>2400 MHz</proc_speed> <proc_socket>Socket rPGA988B</proc_socket> <proc_charateristic>64-bit capable</proc_charateristic> <proc_cache>256 kB</proc_cache> <ram>4GiB</ram> <ram_type>DDR3</ram_type> <pwr_on_pwd>Disabled</pwr_on_pwd> <key_pwd>Not Implemented</key_pwd> <admin_pwd>Disabled</admin_pwd> <front_panel_reset>Not Implemented</front_panel_reset> <on_board_device1>IBM Embedded Security hardware</on_board_device1> <on_board_device2>None</on_board_device2> <on_board_device3>None</on_board_device3> <on_board_device4>None</on_board_device4> <on_board_device5>None</on_board_device5> <port_connector1>Audio Port</port_connector1> <port_connector2>Network Port</port_connector2> <port_connector3>USB</port_connector3> <port_connector4>Video Port</port_connector4> <port_connector5>None</port_connector5> <port_connector6>None</port_connector6> <port_connector7>None</port_connector7> <port_connector8>None</port_connector8> <storage_controller1></storage_controller1> <storage_controller2></storage_controller2> <hard_disk1>320GB</hard_disk1> <hard_disk2>Card</hard_disk2> <hard_disk3>None</hard_disk3> <hard_disk4>None</hard_disk4> <optic_drive>DVD-RW</optic_drive> <display>Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)</display> <network>RTL811181688411 PCI Express Gigabit Ethernet Controller</network> <wirelessnetwork>None</wirelessnetwork> <multimedia>Intel Corporation 7 SeriesC216 Chipset Family High Definition Audio Controller (rev 04)</multimedia> <date>2020-02-11</date> <stime>19:14:01</stime> <grade>A</grade> <camera1>None</camera1> <battery_present>yes</battery_present> <battery_technology>lithium-ion</battery_technology> <battery_vendor>SANYO</battery_vendor> <battery_model>45N1043</battery_model> <battery_serial>27541</battery_serial> <battery_rechargeable>yes</battery_rechargeable> <battery_state>discharging</battery_state> <battery_designed_capacity>47.52 Wh</battery_designed_capacity> <battery_remaining_capacity>34.8899 Wh</battery_remaining_capacity> <energy_rate>14.074 W</energy_rate> <battery_voltage>11.897 V</battery_voltage> <battery_remaining_life>73.4217%</battery_remaining_life> <cpu_model>Intel(R) Core(TM) i3-3110M CPU 2.40GHz</cpu_model> </system>
Above XML data viewed in chrome web browser. See below.
screenshot truncated to fit screeen / page.
ii). JSON
See below example of JSON format, all JSON data will be pushed to your choice of URL in follow format.
{ "system": { "customer": "Default", "batch": "Default", "origin": "Default", "custref": "Default", "ourref": "Default", "comments": "Default", "manufacturer": "LENOVO", "model": "20C60054US", "systype": "Notebook", "uuid": "66481C02-3CA4-11E4-9F6E-28D244F3B428", "asset_tag": "No Asset Information", "serial": "PF04HG74", "boardserial": "1ZSUD49F2GE", "proc_vendor": "Intel(R) Corporation", "proc_type": "Central Processor", "proc_family": "Core i3", "proc_cores": "2", "proc_core_enabled": "2", "proc_thread_count": "4", "proc_external_clock": "100 MHz", "proc_max_speed": "2400 MHz", "proc_speed": "2400 MHz", "proc_socket": "Socket rPGA988B", "proc_charateristic": "64-bit capable", "proc_cache": "256 kB", "ram": "4GiB", "ram_type": "DDR3", "pwr_on_pwd": "Disabled", "key_pwd": "Not Implemented", "admin_pwd": "Disabled", "front_panel_reset": "Not Implemented", "on_board_device1": "IBM Embedded Security hardware", "on_board_device2": "None", "on_board_device3": "None", "on_board_device4": "None", "on_board_device5": "None", "port_connector1": "Audio Port", "port_connector2": "Network Port", "port_connector3": "USB", "port_connector4": "Video Port", "port_connector5": "None", "port_connector6": "None", "port_connector7": "None", "port_connector8": "None", "storage_controller1": "Intel Corporation 8 Series Chipset Family 4-port SATA Controller 1 [IDE mode] - Mobile (rev 04)", "storage_controller2": null, "hard_disk1": "320GB", "hard_disk2": "None", "hard_disk3": "None", "hard_disk4": "None", "optic_drive": "DVDRAM", "display": "Intel Corporation 4th Gen Core Processor Integrated Graphics Controller (rev 06)", "network": "RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller", "wireless_network": "None", "multimedia": "Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller (rev 06)", "date": "2020-02-13", "stime": "15:33:11", "grade": "A", "camera1": "None", "processorid": "C3 06 03 00 FF FB EB BF", "proc_voltage": "0.8 V", "proc_serial": "None", "proc_tag": "None", "proc_part": "None", "bios_vendor": "LENOVO", "bios_version": "J9ET93WW (2.13 )", "bios_date": "08/29/2014", "ram_capacity": "16 GB", "ram_slots": "2", "battery_present": "yes", "battery_technology": "lithium-ion", "battery_vendor": "SANYO", "battery_model": "LNV-45N1", "battery_serial": "10311", "battery_recharageable": "yes", "battery_state": "discharging", "battery_designed_capacity": "38.88 Wh", "battery_remaining_capacity": "38.8800 Wh", "energy_rate": "0 W", "battery_voltage": "12.144 V", "battery_remaining_life": "100%", "cpu_model": "Intel(R) Core(TM) i3-4000M CPU @ 2.40GHz" } }
See below screenshot. Above JSON data viewed in chrome web browser.
screenshot truncated to fit screeen / page.
iii). Clear Text Comma separated
See below example of clear TEXT format, all TEXT data will be pushed to your choice of URL in follow format.
customer=Default,batch=Default,origin=Default,custref=Default,ourref=Default,comments=Default,manufacturer=Dell Inc.,model=OptiPlex 780,systype=Desktop,uuid=44454C4C-4700-1032-8046-B7C04F31354A,asset_tag=None,serial=7G2F15J,boardserial=..CN137400CL02KB.,proc_vendor=Intel,proc_type=Central Processor,proc_family=Core 2 Solo,proc_cores=1,proc_core_enabled=1,proc_thread_count=1,proc_external_clock=1066 MHz,proc_max_speed=5200 MHz,proc_speed=2933 MHz,proc_socket=Socket LGA775,proc_charateristic=64-bit capable,proc_cache=3072 kB,ram=8GiB,ram_type=DDR3,pwr_on_pwd=Enabled,key_pwd=Not Implemented,admin_pwd=Enabled,front_panel_reset=Not Implemented,on_board_device1=Intel Graphics Media Accelerator 950,on_board_device2=None,on_board_device3=None,on_board_device4=None,on_board_device5=None,port_connector1=Audio Port,port_connector2=Network Port,port_connector3=Parallel Port PS2,port_connector4=Serial Port 16550A Compatible,port_connector5=USB,port_connector6=Video Port,port_connector7=None,port_connector8=None,storage_controller1=Intel Corporation 82801JDDO (ICH10 Family) 4-port SATA IDE Controller (rev 02),storage_controller2=Intel Corporation 82801JDDO (ICH10 Family) 2-port SATA IDE Controller (rev 02),hard_disk1=250GB,hard_disk2=8009MB,hard_disk3=None,hard_disk4=None,optic_drive=DVD+-RW,display=Intel Corporation 4 Series Chipset Integrated Graphics Controller (rev 03),network=82567LM-3 Gigabit Network Connection,wirelessnetwork=None,multimedia=Intel Corporation 82801JDDO (ICH10 Family) HD Audio Controller (rev 02),date=2018-02-21,stime=13:11:31,grade=A,camera1=None,battery_present=,battery_technology=,battery_vendor=,battery_model=,battery_serial=,battery_rechargeable=,battery_state=,battery_designed_capacity=,battery_remaining_capacity=,energy_rate=,battery_voltage=,battery_remaining_life=,cpu_model=Intel(R) Core(TM)2 Duo CPU E7500 2.93GHz
Automated Always On Data Push - API'
Application Programming Interface
User Guide
As already explained above, automated Always on Api Data - Push allows NIS to POST data to a URI of your choice. Regardless of destination server’s response, attempts are made to POST data to URL and results are displayed on each Inventory machine.
Currently NIS does not store response results in the DB for API Data push attempts. However, NIS can be modified to store results for each automated API call. This feature is currently not available but can be implemented for additional cost as it requires significant modification to the base code of NIS.
Automated Always on API, posts data for each inventory item to URL.
Configuration:
In order to configure always on automated data push API, go to home page:
http://192.168.1.253
Open the API link or visit http://192.168.1.253/api.php
You will have to provide following information.
URL / URI for example http://yourhost/apiuri.php this is where you want the data to be posted. NIS will post data to the URL you provide. Your URL or URI can be written in any language such as HTML, PHP, Javascript, ASP.net or any other language that you feel comfortable. An example is provided in this guide.
Destination URI / URL Address:
See above screenshot, you will have to provide destination URL. This is the URL that is hosted by third party. For example, you have your own inventory management system and you want NIS to send data for each inventory item to this third party inventory management system as well as store it locally in the database. This is where you specify the destination URL for the data to ship automatically.
Important Note: NIS network is configured with /16 supernet. 192.168.0.0/16 or 192.168.0.0/255.255.0.0. The gateway for this subnet is 192.168.1.254, this gateway configuration applies to all inventory workstations as well as NIS server and the DNS is 8.8.8.8. If your destination URI/URL is not inside this 192.168.0.0/255.255.0.0 subnet, NIS’s automated calls to POST data will always fail, because NIS network does not know how to reach your URL. You can either host your URL / URI on 192.168.0.0/24 subnet which is already excluded from DHCP ranges or you can introduce a network router or internet gateway with local IP address of 192.168.1.254/16 or 192.168.1.254/255.255.0.0.
If you decide to host your URL / URI on the same subnet as NIS then you don’t need a router or internet gateway. However, if you want the data to be posted to a host on the internet or to a URL hosted outside of 192.168.0.0/16 subnet then you will will need a internet / router gateway with local IP gateway address of 192.168.1.254. If you are having trouble with setting this up, please contact the author.
API Data Format:
NIS can currently ship data in following formats. Please select the desired data format.
Comma separated clear Text format
XML
JSON
Enable or Disable Automatic API Data Push:
Select the desired option, enabled or disabled, if enabled each inventory item’s data will be posted to API URI / URL as well as stored locally in the database. If Disable option is selected, data will only be stored locally and will not be shipped to third party URI / URL.
Enable or Disable Manual API Data Push
If this option is Enabled, this will allow you to push API data for selective items from the report section.
For example, you have 100 inventory items and you only want to send API data to third party only for 5 carefully selected items out of 100. Instead of automatic push you can enable this option and send data manually for the required inventory items. However, you can choose to enable both options at the same time. This section is a complete separate topic and is explained later in this document.
Once you have selected all the desired options, click Save and close this window.
NIS is now fully configured to automatically send data to your URI.
Client Side / Third Party API URI settings
In order to receive data from NIS, you should have following configured.
A web server such as Apache or IIS with ASP.NET, HTML, JAVA or PHP support.
Host a page that can accept POST variables;
For example, a page called “apiuri.php” has following PHP code. This code extracts the Posted data and writes to a local file name “dump.txt” within your web document root folder. This can be a good starting point.
<?php //echo "this is raw data"; //var_dump($_POST); $data = ($_POST[data]); file_put_contents('dump.txt', $data); ?>
NIS can send data to this URI, for example http://yourserver_Ip_address/apiuri.php you can choose to store this data into your database or do whatever desired to this data. You can extract POST data and insert into your own database and so on.
Test the API data push feature
Boot your inventory workstation / items. If the API automatic data push is enabled, you will see following on your inventory item’s screen.
Success - screenshot
Kindly pay attention to line indicating yellow arrows.
Automatic API data push is enabled, posting all data to http://your-uri-url/apiuri.php in XML format.
Regardless of status of the inventory item, at this point all above displayed data is already pushed to the choice of your API in the format you have chosen either XML/JSON or Clear text. Also the response SUCCESS or FAILURE has been displayed on the screen.
Test API Push Data Feature without Integrating to third party
To test this feature without integrating with third party. Make sure API URL is configured to http://192.168.1.253/apiuri.php
Now boot one of the inventory machine, when you see the message 200 OK message on the inventory machine. This means the data has been successfully pushed to test API URL.
Now you can view the last pushed data by using following API Testing tool page. http://192.168.1.253/test_api.php
See below a screen shot of this test tool.
Failure Screenshot
Conclusion Always ON automated API Data Push
We have discussed how NIS can be configured to automatically post data to your choice of URL, different data formats and how success and errors are handled.
For any question, get in touch with the author.
Proceed to next section : On-Demand Manual Pull API data
On-Demand Manual Pull API Data
User Guide
You can request NIS to provide data by using any web based application, such as smart phone, web browsers, application servers, third party inventory software or custom developed applications.
NIS currently provide data by passing only one parameter as GET variable that can be sent with the URL.
When data is requested from NIS, data will always be returned in the format that you configured in API settings page.
For example, you need to pull data for a system with serial number PF04HG74.
You will have to send request in following format to URL: http://192.168.1.253/api-data.php?serial=PF04HG74
See below screenshot Firefox web browser, sent a request to above mentioned URL for serial PF04HG74 and the data is returned in XML format. Because API settings is configured to return data in XML format. If you wish the data to return in different format. Please change data format settings in the API settings page.
Screenshot truncated to fit this page.
On-Demand Pull API accepted query parameters
Following field parameters are accepted by NIS, for example you want to view all systems by batch number “Default”. See below example
Pull API data in for batch “Default” in XML format.
Before sending query please make sure your API settings are configured for XML data output. Send following query to URL:
http://192.168.1.253/api-data.php?batch=Default
See below screen shot, NIS has returned all system with batch “Default”
Screen shot truncated to fit screen.
Another example pulling API data by system type such as Desktop, Notebook and etc,.
Send request to API URL to query all Notebook systems.
http://192.168.1.253/api-data.php?systype=Notebook
Following queries types are supported by NIS.
customer
batch
origin
custref
ourref
comments
manufacturer
model
systype
uuid
asset_tag
serial
boardserial
proc_vendor
proc_type
proc_family
proc_cores
proc_core_enabled
proc_thread_count
proc_external_clock
proc_max_speed
proc_speed
proc_socket
proc_charateristic
proc_cache
ram
ram_type
pwr_on_pwd
key_pwd
admin_pwd
front_panel_reset
on_board_device1
on_board_device2
on_board_device3
on_board_device4
on_board_device5
port_connector1
port_connector2
port_connector3
port_connector4
port_connector5
port_connector6
port_connector7
port_connector8
storage_controller1
storage_controller2
hard_disk1
hard_disk2
hard_disk3
hard_disk4
optic_drive
display
network
wirelessnetwork
multimedia
date
stime
grade
camera1
processorid
proc_voltage
proc_serial
proc_tag
proc_part
bios_vendor
bios_version
bios_date
ram_capacity
ram_slots
battery_present
battery_technology
battery_vendor
battery_model
battery_serial
battery_rechargeable
battery_state
battery_designed_capacity
battery_remaining_capacity
energy_rate
battery_voltage
battery_remaining_life
cpu_model
Another example pull on-demand data for all systems containing 320GB Hard Disk Drives.
Send request to NIS API URL for hard_disk1=320GB
http://192.168.1.253/api-data.php?hard_disk1=320GB
Conclusion - On-Demand Manual Pull API Data
In this section we have successfully demonstrated how to pull data by using various query methods. Currently NIS on-demand manual API pull data support single query. We have development in progress and soon multiple queries will be supported.
Should you have questions regarding On-Demand Manual Pull API Data, please get in touch with the author.
Proceed to next section: Manual Push API data for each inventory item.
Manual Push - API Data to Third Party
User Guide
In addition to 2 methods already explained above, a 3rd method of manually pushing API data to third party application is also supported.
You can choose to submit data to third party for individual inventory items.
For example: You have 100 inventory items and you do not want to automatically submit API data for all items to third party, instead you want to carefully choose only certain number of items to submit data.
In this case follow this guide.
Enable or Disable Manual API data Push
In order to enable this functionality please proceed to API settings page.
After configuring the API settings, proceed to run detailed report, please consult the NIS user guide for instructions to run detailed reports.
Report will produce results similar to following page. Scrolling from LEFT --> RIGHT you may notice a button “Push XML API Data”, the reason it says XML because we have configured API settings page to produce XML data, for other formats please change data format in the API settings page.
Pressing this button will cause NIS application to POST data to third party application / URL.
See below example.
Another example of manually posting data of an item to URL in JSON format.
See below screenshot.
Next page produced following results, indicating the the response from the third party. Data format can always be interchanged by selecting desired data formats from the API settings page.
Conclusion - Manual Push API Data to Third Party
In this section we discussed how we can manually Push NIS API data to third party for each inventory item. We have always discussed different data formats and how success and error response are handled.
Should you have questions please consult the author.
Custom API Integration
We understand this API may not be best suited to some businesses and you may have unique business requirements. Please understand that NIS is very flexible and can be modified to integrate with any system or software.
If you have unique integration requirements or want to add new features, or want to completely modify NIS to fit your business needs. This can be done for a cost. Kindly get in touch with the author.