...
Using the format option is useful when using a web browser but you wish to see the result in JSON format. Adding format=json achieves this. If you only want the actual data in JSON, format=json_data will do the trick. Normally a web browser will set its accept header to HTML, so in that case, we return the rendered page. Using an API to retrieve JSON you should set the accept header to "json/application". You can override this by providing the format option in the URL.
We tend to use the Google Chrome extension called Postman for testing actual restful queries. You might like to install and test with that. http://www.getpostman.com.
Action
NOTE - Removed from 5.0.0.
When using the API the default action is determined according to the format and URL. You can override this by providing the 'action' option in the URL. An example of this is when creating a new item. You would normally use POST to /item but in the case of a web user, you need a web form to be able to fill out the item details. In that case, there is no facility for this in a typical JSON Restful API. We work around this by providing action=create in a GET request for the URL. IE - http://{server}/omk/open-audit/networks?action=create. The default action if nothing matches below is to return a collection of items.
...
End Points
All endpoints URLs for prior to v5 are of the format http://{server}/omk/open-audit/{endpoint}
NOTE - From 5.0.0 all endpoint URLs are of the form - http://{server}/open-audit/index.php/{endpoint}
Devices
NOTE - From 5.0.0 the sub_resource item has been replaced by the components endpoint.
Type | Endpoint v4 | v5 | |||
---|---|---|---|---|---|
GET | /system | /devices | Return a collection of devices with the default set of columns from the system table (system.system_id, system.icon, system.man_type, system.hostname, system.domain, system.man_ip_address, system.man_description, system.man_os_family, system.man_status) | ||
GET | /system/{id} | /devices/{id} | Return an individual devices details. | ||
GET | /devicessystem?sub_resource={sub_resource name} | /components?components.type={sub_resource name} | To return all items in a sub_resource for a collection of devices. If you wanted all software you would use http://{server}/open-audit/index.php/devices?sub_resource=software | ||
GET | / | devicessystem/{id}?sub_resource={sub_resource name} | /components?components.type={sub_resource name}&components.device_id={id} | To return all items in a sub_resource for a specific device. | |
GET | / | devicessystem/{id}?sub_resource={sub_resource name}&sub_resource_id={sub_resource id} | /components/{sub_resource id}?components.type={sub_resource name} | To return a specific sub_resource item. |
Device sub_resource
...
names / component types
NAME | NAME | NAME |
---|---|---|
audit_log | netstat | service |
...