Anatomy of an API request
Router URL
Routers are exposed in Zenoss Resource Manager and Collection Zones via router endpoint URLs. Each router is available at a distinct URL. See the following chart for 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 API 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 }