- 11 Jan 2023
- 3 Minutes to read
- Print
- DarkLight
- PDF
Site API
- Updated on 11 Jan 2023
- 3 Minutes to read
- Print
- DarkLight
- PDF
Netreo's API system must be enabled to use this API. See How to Enable Netreo API Access
Calls to this API are made using HTTP/HTTPS and must be sent as key/value pairs in a POST request.
Resource
The resource accessed by this API is a list of Netreo sites.
This resource offers the following endpoints:
- Site ID List
- Site Device List
Resource URL
{your.netreo.ip.or.name}/fw/index.php?r=restful
Endpoints
Site ID List
POST/site/list
Retrieves the current list of Netreo sites and their ID numbers.
Parameters
The parameters for this endpoint must be included as request body parameters in a POST request.
password
String/Required if authentication is enabled.
The API key set in Netreo’s API Administration. Case-sensitive.
pin
String/Required when using Netreo SaaS-based APIs. Not applicable to on-premise deployments.
The pin number supplied in Netreo’s API Administration.
Request Examples
Curl using POST with API Authentication Disabled
curl -X POST \ 'http://38.2.11.62/fw/index.php?r=restful/site/list' \
Curl using POST with API Authentication Enabled
curl -X POST \ 'http://38.2.11.62/fw/index.php?r=restful/site/list' \ -F password=pass123
Response
Supplying an incorrect password, or no password with API authentication enabled, will return an "Incorrect password" error.
A successful call to this API will return a standard JSON object array.
Note: The output will be returned as standard JSON without indentation or line breaks. It is formatted here to make the example easier to read.
Response Examples
Successful list retrieval.
[ { "id": "1", "name": "Unknown" }, { "id": "4", "name": "Austin" }, { "id": "5", "name": "Boston" }, { "id": "6", "name": "Dallas" }, { "id": "3", "name": "Headquarters" }, { "id": "7", "name": "Houston" }, { "id": "2", "name": "Internal" }, { "id": "9", "name": "R22003" } ]
Response Schema
Output | Type | Description |
---|---|---|
id | string | The Netreo internal identification number for the site name returned below. |
name | string | The name of the site as seen in the Netreo UI. |
Site Device List
POST/site/device-list
Retrieves the list of devices and associated information from the site ID specified in the parameters.
Parameters
The parameters for this endpoint must be included as request body parameters in a POST request.
password
String/Required if authentication is enabled.
The API key set in Netreo’s API Administration. Case-sensitive.
pin
String/Required when using Netreo SaaS-based APIs. Not applicable to on-premise deployments.
The pin number supplied in Netreo’s API Administration.
id
String/Required
The ID number of an Netreo site. Retrieve the list of site IDs using the "Site List" endpoint.
Request Examples
Curl using POST with API Authentication Disabled
curl -X POST \ 'http://38.2.11.62/fw/index.php?r=restful/site/device-list' \ -F id=4
Curl using POST with API Authentication Enabled
curl -X POST \ 'http://38.2.11.62/fw/index.php?r=restful/site/device-list' \ -F password=pass123 \ -F id=4
Response
A successful call to this API will return a standard JSON object array.
Supplying an incorrect password, or no password with API authentication enabled, will return an "Incorrect password" error. Failing to specify a correct site ID will return an empty array.
Note: The output will be returned as standard JSON without indentation or line breaks. It is formatted here to make the example easier to read.
Response Examples
Successful list retrieval.
[ { "dev_index": "22", "name": "AUS-Linux", "ip": "10.200.37.4", "description": "Test note for mobile+", "category": "7", "site": "4", "model": "", "poll": "1", "report": "1", "monitor": "1", "poll_intvl": "5", "template_persist": "0", "template": "0", "create_time": "1513113992", "snmp_version": null, "auto_config": "0" }, { "dev_index": "19", "name": "Austin-R1.austinr1.netreo.net", "ip": "10.200.37.1", "description": "", "category": "6", "site": "4", "model": "", "poll": "1", "report": "1", "monitor": "1", "poll_intvl": "5", "template_persist": "0", "template": "0", "create_time": "1513113802", "snmp_version": null, "auto_config": "0" }, { "dev_index": "35", "name": "Austin-S1.austins1.netreo.net", "ip": "10.200.37.2", "description": "", "category": "6", "site": "4", "model": "", "poll": "1", "report": "1", "monitor": "1", "poll_intvl": "5", "template_persist": "1", "template": "0", "create_time": "1518636729", "snmp_version": null, "auto_config": "0" } ]
Response Schema
Output | Type | Description |
---|---|---|
dev_index | string | The Netreo internal identification number for the device. |
name | string | The name of the device as seen in the Netreo UI. |
ip | string | The IP address of the device. |
description | string | This is the contents of the "Note" field seen in the HOST INFORMATION section of the device dashboard for this device. |
category | string | The ID number of the category to which this device belongs. |
site | string | The ID number of the site to which this device belongs. |
model | string | The device model designation as supplied by the device. This information is not found in the Netreo UI. |
poll | string | Indicates if the device is currently being polled for performance data. Treat as a boolean. |
report | string | Indicates whether or not the device will be included in reports. Treat as a boolean. |
monitor | string | Indicates if the device is being monitored for host and service alarms. Treat as a boolean. |
poll_intvl | string | The delay between performance polls for the device, in minutes. |
template_persist | string | Indicates if the device is set to use device templates. Treat as a boolean. |
template | string | The ID number of the device template assigned directly to this device in its "Main" device administration page. |
create_time | string | The time this device was added to Netreo, as a UNIX timestamp. |
snmp_version | string | The version of SNMP being used to communicate with this device, as set in its "Authentication" administration page. |
auto_config | string | Indicates whether or not autoconfiguration rules will be run on the device during a repoll. If set to 1, the rules will be run on the next repoll and the flag set back to 0. |