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

Category API

  • Dark
    Light
  • PDF

Article summary

Netreo's API system must be enabled to use this API. See 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 the list of Netreo categories.

This resource offers the following endpoints:

  • Category ID List
  • Category Device List

Resource URL

{your.netreo.ip.or.name}/fw/index.php?r=restful

Endpoints

Category ID List

POST
/category/list
Retrieves the current list of Netreo categories 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/category/list"

Curl using POST with API Authentication Enabled

curl -X POST
  "http://38.2.11.62/fw/index.php?r=restful/category/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": "Core Routers"
    },
    {
        "id": "15",
        "name": "Database Servers"
    },
    {
        "id": "10",
        "name": "Development Servers"
    },
    {
        "id": "18",
        "name": "New Devices"
    },
    {
        "id": "6",
        "name": "New Routers"
    },
    {
        "id": "7",
        "name": "New Servers"
    },
    {
        "id": "13",
        "name": "Power Devices"
    },
    {
        "id": "21",
        "name": "Test_Host Devices"
    },
    {
        "id": "14",
        "name": "VM_Host Servers"
    },
    {
        "id": "19",
        "name": "Window Servers"
    }
]

Response Schema

OutputTypeDescription
idstringThe Netreo internal identification number for the category name returned below. Use this number with other APIs to identify a specific category.
namestringThe name of the category as seen in Netreo.

Category Device List

POST
/category/device-list
Retrieves the list of devices and associated information from the category 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 category. Retrieve the list of category IDs using the "Category List" endpoint (above).

Request Examples

Curl using POST with API Authentication Disabled

curl -X POST \
  'http://38.2.11.62/fw/index.php?r=restful/category/device-list' \
  -F id=15

Curl using POST with API Authentication Enabled

curl -X POST \
  'http://38.2.11.62/fw/index.php?r=restful/category/device-list' \
  -F password=pass123 \
  -F id=15

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 category 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": "11",
        "name": "Oracle",
        "ip": "39.1.12.235",
        "description": "",
        "category": "15",
        "site": "3",
        "model": "",
        "poll": "1",
        "monitor": "0",
        "create_time": "1512771445",
        "snmp_version": null,
    },
    {
        "dev_index": "23",
        "name": "WinSQL",
        "ip": "10.200.36.3",
        "description": "",
        "category": "15",
        "site": "3",
        "model": "",
        "poll": "1",
        "monitor": "1",
        "create_time": "1513882312",
        "snmp_version": null,
    }
]

Response Schema

OutputTypeDescription
dev_indexstringThe Netreo internal identification number for the device.
namestringThe name of the device as seen in Netreo.
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.
monitorstringIndicates if the device is being monitored for host and service alarms. Treat as a boolean.
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.

Was this article helpful?