Using cURL

API calls to Zenoss Resource Manager and Zenoss Cloud Collection Zones can be made using the Linux curl command.


For Resource Manager, specify the username and password in quotes with a colon between them using the -u switch

-u "api-username:api-password"

For Zenoss Cloud, specify your api key in the headers of the request

-H "z-api-key: <your_api_key>"

Request type and other headers

Set the request method to POST with -X


Set content-type to “application/json” in the headers

-H "Content-Type: application/json"

JSON body

Send your JSON data with -d

  • The entire JSON body must be quoted when invoking curl from the shell.
  • JSON syntax requires that all strings are in double quotes.
  • The easiest way to meet both requirements is to surround the JSON data in single quotes as shown below.

-d '{"action": "DeviceRouter", "method": "addDevice", "data": [{"deviceName": "", "deviceClass": "/Server/Linux"}], "tid": 1}'

URL endpoint

Specify the URL of the router

Resource Manager example endpoint
Zenoss Cloud example endpoint

Example Requests

Adding a device to Zenoss Resource Manager with cURL
curl -u "api-username:api-password"  -X POST -H "Content-Type: application/json" -d '{"action": "DeviceRouter", "method": "addDevice", "data": [{"deviceName": "", "deviceClass": "/Server/Linux"}], "tid": 1}'

Adding a device to a Collection Zone with cURL
curl -H "z-api-key: <your_api_key>" -X POST -H "Content-Type: application/json" -d '{"action": "DeviceRouter", "method": "addDevice", "data": [{"deviceName": "", "deviceClass": "/Server/Linux"}], "tid": 1}'