REST API examples (v1)
DOM includes a rest API allowing you to set up integrations with other systems in your infrastructure.
Prerequisites
To start using the API, you need to:
- Enable the API feature in System Settings.
- Ensure that the API clients are allowed by the optional IP ACL rules in DOM.
- Create API keys for your user.
API key types and permissions
There are two different kind of API keys:
- Read/Write
- Read Only
The API keys have the same access level as the user they are associated with, and changes made trough the API will be logged to the change log in the same way changes are logged when using the web dashboard.
OpenAPI Schema
An OpenAPI JSON schema is available on the /api/v1
endpoint on your server
installation (i.e. on https://dom.example/api/v1
). This schema can be used by clients and libraries supporting the OpenAPI standard.
Examples
To access the API you can also use any HTTP client. In these examples, we’re using the curl.
In the examples:
- Replace
dom.example
with the host name or IP address of your DOM server installation. - Replace
$RW_KEY
or$RO_KEY
with the corresponding API key
Getting a list of routers:
Endpoint: GET /v1/api/router/
You can retrieve JSON document with a list of the current status of your devices by sending a GET request to the /v1/api/router
endpoint.
$ curl -H 'Authorization: Bearer $RO_KEY' https://dom.example/api/v1/router
Getting information about a specific router:
By router id
$ curl -H 'Authorization: Bearer $RO_KEY' https://dom.example/api/v1/router/1234
By serial number via the slno=
parameter
$ curl -H 'Authorization: Bearer $RO_KEY' https://dom.example/api/v1/router?slno=IX20000126192174
Updating device meta data
You can update data associated with routers by sending a POST to the
/v1/router/<router_id>
endpoint containing a JSON object with the changes.
$ curl -H 'Authorization: Bearer $DOM_RW_TOKEN' -XPOST --data '{ "display_name" : "New Name for Test Router" }' -H "Content-Type: application/json" https://api.nettec.no/v1/router/10001