Skip to content

Anatomy of an API request

Routers are available through endpoint URLs and each router has a discrete URL. The following table shows some common router endpoints:

Router name Router endpoint URL
DeviceRouter /zport/dmd/device_router
EventsRouter /zport/dmd/evconsole_router
JobsRouter /zport/dmd/jobs_router
ImpactRouter /zport/dmd/enterpriseservices_router

HTTP Headers

Content-Type

The Content-Type must be set to application/json.

Authorization

Authorization (a username and password or API key) need to be present in the headers of your API request.

Payload

Action

Routers require an action field to be defined, which is typically the name of the router being invoked.

Method

When making an API call, the method being invoked needs to be specified in the router request's method field.

Data

Most router methods accept, or even require, other pieces of information. Arguments used by router methods are passed in the data field.

TID

A TID is a temporary transaction ID for a router request.

Example request

  • To:
    • https://zenoss.,example.com/zport/dmd/device_router
  • Headers:

    • Content-Type: application/json
    • Authentication: Username and Password or API key
  • Payload:

    • Action: DeviceRouter
    • Method: addDevice
    • Data:
      • deviceName: device.example.com
      • deviceClass: /Server/Linux
      • productionState: 1000
    • Tid: 1

Example JSON payload

{
   "action": "DeviceRouter",
   "method": "addDevice",
   "data": [
      {
         "deviceName": "device.example.com",
         "deviceClass": "/Server/Linux",
         "productionState": "1000"
      }
   ],
   "tid": 1
}