Site API
  • 11 Jan 2023
  • 3 Minutes to read
  • Dark
    Light
  • PDF

Site API

  • Dark
    Light
  • PDF

Article summary

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

OutputTypeDescription
idstringThe Netreo internal identification number for the site name returned below.
namestringThe 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

OutputTypeDescription
dev_indexstringThe Netreo internal identification number for the device.
namestringThe name of the device as seen in the Netreo UI.
ipstringThe IP address of the device.
descriptionstringThis is the contents of the "Note" field seen in the HOST INFORMATION section of the device dashboard for this device.
categorystringThe ID number of the category to which this device belongs.
sitestringThe ID number of the site to which this device belongs.
modelstringThe device model designation as supplied by the device. This information is not found in the Netreo UI.
pollstringIndicates if the device is currently being polled for performance data. Treat as a boolean.
reportstringIndicates whether or not the device will be included in reports. Treat as a boolean.
monitorstringIndicates if the device is being monitored for host and service alarms. Treat as a boolean.
poll_intvlstringThe delay between performance polls for the device, in minutes.
template_persiststringIndicates if the device is set to use device templates. Treat as a boolean.
templatestringThe ID number of the device template assigned directly to this device in its "Main" device administration page.
create_timestringThe time this device was added to Netreo, as a UNIX timestamp.
snmp_versionstringThe version of SNMP being used to communicate with this device, as set in its "Authentication" administration page.
auto_configstringIndicates 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.

Was this article helpful?