Section | ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Section | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
API documentation
GeneralHealth checkGet Unimus health status. Method: GET panel
Success 200
borderColor grey
SchedulesSchedules - get schedule Get an individual schedule. Method: GET
Parameter
Success 200
Error 4xx
borderColor
Schedules - get schedulesGet a list of all schedules in Unimus. Method: GET
Parameter
Success 200
DevicesDevices - get device by IDGet an individual device by ID. Method: GET
Success 200 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
borderColor | grey | borderStyle | solid
Name | Type | Description |
---|---|---|
id | Number | The ID of the device |
createTime | Number | Device creation time in seconds |
address | String | Hostname, IPv4 or IPv6 |
description | String | Device description |
port | Number | Device port |
connector | String | Connector type, possible values: SSH, TELNET |
vendor | String | Vendor |
type | String | Type |
model | String | Model |
schedule | Object | Device schedule |
credential connections | Object | Credential used to login to the device |
Array | Device connections |
Code Block | ||||
---|---|---|---|---|
| ||||
HTTP/1.1 200 OK { { "data":{ "id": 1, "createTime":1511339013, 1525101029, "address":"198.18.0.29 0", "description":"Back bone device", "port": 22, "connector": "SSH", "null, "schedule":{ "id":1, "createTime":1524564606, "periodicity":"DAILY", "dom":-1, "dow":-1, "hour":3, "min":0, "name":"Every day at 03:00." }, "vendor":"MikroTik", "type":"RouterOS", "model":"Simulated-RouterOS", "schedule": null, "credential": { "id": 1, "connections":[ { "type":"SSH", "port":22, "credentials":[ { "id":1, "username":"test", "password":"test", "sshKey":null}} } null
}
],
"enablePassword":null
}
]
}
} |
Error 4xx
Name | Type | Description |
---|---|---|
timestamp | Number | Current timestamp |
code | Number | 400 |
error | String | HTTP code message |
message | String | Error message |
Panelcode | ||||||
---|---|---|---|---|---|---|
| ||||||
HTTP/1.1 400 BAD REQUEST { { "timestamp": 1511869830038, "code": 400, "error":"Bad Request", "message":"Argument deviceId type mismatch" } |
Devices - get device by address
Get an individual device by address.
Method: GET
Panelcode | ||||
---|---|---|---|---|
| ||||
http://example.unimus/api/ v1v2/devices/findByAddress/:address?attr=:attributes |
Code Blockpanel | |||||
---|---|---|---|---|---|
| |||||
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v1 v2/devices/findByAddress/<address>?page=0&size=20&attr=s,c" |
Parameter
Name | Type | Description |
---|---|---|
address | String | The IPv4, IPv6 or hostname of the device |
attributes | String | Comma separated graph attribute nodes. (OPTIONAL) Possible values for : device schedule: schedule, sch, s fordevice credentialconnections: credentialconnections, credconn, c |
Success 200
Name | Type | Description |
---|---|---|
id | Number | The ID of the device |
createTime | Number | Device creation time in seconds |
address | String | Hostname, IPv4 or IPv6 |
description | String | Device description |
port | Number | Device port |
connector | String | Connector type, possible values: SSH, TELNET |
vendor | String | Vendor |
type | String | Type |
model | String | Model |
schedule | Object | Device schedule |
credential connections | Object | Credential used to login to the device |
Array | Device connections |
Code Block | ||||
---|---|---|---|---|
| ||||
HTTP/1.1 200 OK { { "data":{ "id": 1, "createTime":1511339473, 1525101029, "address":"198.18.0.39 0", "description":"Main switch", "port": 22, "connector": "SSH", "null, "schedule":null, "vendor":"MikroTik", "type":"RouterOS", "model":"Simulated-RouterOS", "schedule": null, "credential": { "id": 4, "username": "secret user", "password": "top secret", "sshKey": null }
"connections":[
]
}
} |
Error 4xx
Name | Type | Description |
---|---|---|
timestamp | Number | Current timestamp |
code | Number | 404 |
error | String | HTTP code message |
message | String | Error message |
Panelcode | ||||||
---|---|---|---|---|---|---|
| ||||||
HTTP/1.1 404 BAD REQUEST { { "timestamp": 1511862182524, "code": 404, "error":"Not Found", "message":"Device with address some_address not found" } |
Devices - get devices
Get a list of devices.
Method: GET
Panelcode | ||||
---|---|---|---|---|
| ||||
http://example.unimus/api/ v1v2/devices?page=:pageIndex&size=:pageSize&attr=:attributes |
Code Blockpanel | |||||
---|---|---|---|---|---|
| |||||
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v1 v2/devices?page=0&size=20&attr=s,c" |
Parameter
Name | Type | Description |
---|---|---|
pageIndex | Number | Page index (OPTIONAL) |
pageSize | Number | Page size (OPTIONAL) |
attributes | String | Comma separated graph attribute nodes.(OPTIONAL) Possible values for device schedule: schedule, sch, s for device credential: credential, cred, c |
Success 200
Name | Type | Description |
---|---|---|
id | Number | The ID of the device |
createTime | Number | Device creation time in seconds |
address | String | Hostname, IPv4 or IPv6 |
description | String | Device description |
port | Number | Device port |
connector | String | Connector type, possible values: SSH, TELNET |
vendor | String | Vendor |
type | String | Type |
model | String | Model |
schedule | Object | Device schedule |
credential connections | Object | Credential used to login to the device |
Array | Device connections |
Code Block | ||||
---|---|---|---|---|
| ||||
HTTP/1.1 200 OK { { "data":[ { [ { "id":2, 1, "createTime":1511339013, 1525101029, "address":"198.18.0.2777 0", "description": null, "port": 22, "connector": null, "credential": null, ""schedule":null, "vendor":"MikroTik", "type":"RouterOS", "model":"Simulated-RouterOS", "schedule": { "id": 1, "createTime": 1511339012, "periodicity": "DAILY", "dom": 1, "dow": 1, "hour": 3, "min": 0, "name": "Every day at 03:00." }} ], "paginator": { "totalCount": 29, "totalPages": 29, "page": 1, "size": 1 }}
"connections":[
]
}
],
"paginator":{
"totalCount":1,
"totalPages":1,
"page":0,
"size":20
}
} |
Devices - create new device
Create a new device.
Method: POST
Panelcode | ||||
---|---|---|---|---|
| ||||
http://example.unimus/api/ v1v2/devices |
Code Blockpanel | |||||
---|---|---|---|---|---|
| |||||
curl -H "Accept: application/json" -H "Content-type: application/json" -H "Authorization: Bearer <token>" -d '{"address":"<address>","description":"<description>"}' "http://<example.unimus>/api/v1 v2/devices" |
Parameter
Name | Type | Description |
---|---|---|
address | String | Device address |
description | String | Description of the new device |
scheduleId | Number | Schedule id If null then device will be backed up according to system default schedule |
Success 201
Name | Type | Description |
---|---|---|
id | Number | The ID of the device |
createTime | Number | Device creation time in seconds |
address | String | Hostname, IPv4 or IPv6 |
description | String | Device description |
vendor | String | null |
type | String | null |
model | String | null |
schedule | Object |
Device schedule |
connections |
Array |
Device connections |
Code Block | ||||
---|---|---|---|---|
| ||||
HTTP/1.1 201 CREATED { "{ "data":{ "id":94, 1, "createTime":1511876477, 1525101029, "address":"10 198.10 18.10 0.10 0", "description": null, "port": null, "connector": null, "credential": null, ""vendor": null, "type": null, "model": null, "schedule":{ "id": 1, "createTime":1511339012, 1524564606, "periodicity":"DAILY", "dom": -1, "dow": -1, "hour": 3, "min": 0, "name":"Every day at 03:00."} }
},
"connections":[
]
}
} |
Error 4xx
Name | Type | Description |
---|---|---|
timestamp | Number | Current timestamp |
code | Number | 422 |
error | String | HTTP code message |
message | String | Error message |
Panelcode | ||||||
---|---|---|---|---|---|---|
| ||||||
HTTP/1.1 422 UNPROCESSABLE ENTITY { { "timestamp": 1511876680885, "code": 422, "error":"Unprocessable Entity", "message":"Device already exist" } |
Devices - update device
Update device address, description or schedule time.
Method: PATCH
Panelcode | ||||
---|---|---|---|---|
| ||||
http://example.unimus/api/ v1v2/devices/:deviceId |
Code Blockpanel | |||||
---|---|---|---|---|---|
| |||||
curl -H "Accept: application/json" -H "Content-type: application/json" -H "Authorization: Bearer <token>" -X PATCH -d '{"address":"<address>","description":"<description>","scheduleId":"<scheduleId>"}' "http://<example.unimus>/api/v1 v2/devices/<deviceId>" |
Parameter
Name | Type | Description |
---|---|---|
deviceId | Number | The ID of the device |
address | String | Device address |
description | String | Device description |
scheduleId | Number | Schedule id. If null then no schedule update occurs If -1 then device will be backed up according to system default schedule |
Success 200
Name | Type | Description |
---|---|---|
id | Number | The ID of the device |
createTime | Number | Device creation time in seconds |
address | String | Hostname, IPv4 or IPv6 |
description | String | Device description |
port | Number | Device port |
connector | String | Connector type, possible values: SSH, TELNET |
vendor | String | Vendor |
type | String | Type |
model | String | Model |
schedule | Object | Device schedule |
credential connections | Object | Credential used to login to the device |
Array | Device connections |
Code Block | ||||
---|---|---|---|---|
| ||||
HTTP/1.1 200 OK { "{ "data":{ "id":96, 1, "createTime":1511879360, 1525101029, "address":"198.18.0.18 0", "description":"aaaa", "port": 22, "connector": "SSH", "vendor": "MikroTik", "type": "RouterOS", "model": "Simulated-RouterOS", "schedule": {null, "schedule":{ "id": 1, "createTime":1511339012, 1524564606, "periodicity":"DAILY", "dom": -1, "dow": -1, "hour": 3, "min": 0, "name":"Every day at 03:00." },"credential "vendor":{ " idMikroTik": 1,"username , "type":"test RouterOS","password "model":"test Simulated-RouterOS", "sshKey": null }}
"connections":[
]
}
} |
Error 4xx
Name | Type | Description |
---|---|---|
timestamp | Number | Current timestamp |
code | Number | 404 |
error | String | HTTP code message |
message | String | Error message |
Panelcode | ||||||
---|---|---|---|---|---|---|
| ||||||
HTTP/1.1 404 NOT FOUND { { "timestamp": 1511880124270, "code": 404, "error":"Not Found", "message":"Device not found" } |
Devices - delete device
Delete a single device from Unimus.
Method: DELETE
Panelcode | ||||
---|---|---|---|---|
| ||||
http://example.unimus/api/ v1v2/devices/:deviceId |
Code Blockpanel | |||||
---|---|---|---|---|---|
| |||||
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" -X DELETE "http://<example.unimus>/api/v1 v2/devices/<deviceId>" |
Parameter
Name | Type | Description |
---|---|---|
deviceId | Number | The ID of the device to delete |
Success 200
Name | Type | Description |
---|---|---|
success | String | A message stating that the deletion was successful |
Panelcode | ||||||
---|---|---|---|---|---|---|
| ||||||
HTTP/1.1 200 OK { { "data":{ "success":"true"} } } |
Error 4xx
Name | Type | Description |
---|---|---|
timestamp | Number | Current timestamp |
code | Number | 404 |
error | String | HTTP code message |
message | String | Error message |
Panelcode | ||||
---|---|---|---|---|
| ||||
HTTP/1.1 404 NOT FOUND { { "timestamp": 1511884051726, "code": 404, "error":"Not Found", "message":"Device with id 102 not found" } |
Backups
Backups - get device backups
Get a list of all device backups. Backups are ordered descending by create time so the latest backup will always be at index 0 in the list. The list can be empty if the device has no backup yet.
Method: GET
Panelcode | ||||
---|---|---|---|---|
| ||||
http://example.unimus/api/ v1v2/devices/:deviceId/backups?page=:pageIndex&size=:pageSize |
Code Blockpanel | |||||
---|---|---|---|---|---|
| |||||
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v1 v2/devices/1/backups?page=0&size=20" |
Parameter
Name | Type | Description |
---|---|---|
deviceId | Number | The ID of the device |
pageIndex | Number | Page index (OPTIONAL) |
pageSize | Number | Page size (OPTIONAL) |
Succees 200
Name | Type | Description | |
---|---|---|---|
id | Number | The ID of the backup | |
createTimevalidSince | Number | Backup creation time | First time this configuration retrieved from the device |
validUntil | Number | Last time this configuration retrieved from the device. Will be null if the configuration was retrieved only once (only validSince will be set) | |
type | String | Backup type. Could be TEXT or BINARY | |
bytes | Array | Backup as byte array |
Panelcode | ||||||
---|---|---|---|---|---|---|
| ||||||
HTTP/1.1 200 OK { { "data":[ { [ { "id":29, "createTime": 1511886237, "1, "validSince":1525117527, "validUntil":null, "type":"TEXT", "bytes":"IyBTaW11bGF0ZWQgTWlrcm9UaWsgUm91dGVyT1Mgc3lzdGVtCiMgc29mdHdhcmUgaWQgPSBub25lCiMKL3NlY3Rpb24gYQpjb21tYW5kIGEKL3NlY3Rpb24gYmIKY29tbWFuZCBiYgovc2VjdGlvbiBjY2MKY29tbWFuZCBjY2MK" } ], } ], "paginator":{ "totalCount":5, 1, "totalPages":5, 1, "page": 0, "size":1} 20 } } |
Error 4xx
Name | Type | Description |
---|---|---|
timestamp | Number | Current timestamp |
code | Number | 404 |
error | String | HTTP code message |
message | String | Error message |
Panelcode | ||||||
---|---|---|---|---|---|---|
| ||||||
HTTP/1.1 404 NOT FOUND { { "timestamp": 1511886913012, "code": 404, "error":"Not Found", "message":"Device with id 964 not found" } |
Backups - get device latest backup
Get device latest backup. Backup can be null if the device has no backups yet.
Method: GET
Panelcode | ||||
---|---|---|---|---|
| ||||
http://example.unimus/api/ v1v2/devices/:deviceId/backups/latest |
Code Blockpanel | |||||
---|---|---|---|---|---|
| |||||
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v1 v2/devices/<deviceId>/backups/latest" |
Parameter
Name | Type | Description |
---|---|---|
deviceId | Number | The ID of the device |
Success 200
Name | Type | Description | |
---|---|---|---|
id | Number | The ID of the backup | |
createTimevalidSince | Number | Backup creation time | First time this configuration retrieved from the device |
validUntil | Number | Last time this configuration retrieved from the device. | |
type | String | Backup type. Could be TEXT or BINARY | |
bytes | Array | Backup as byte array |
Panelcode | ||||||
---|---|---|---|---|---|---|
| ||||||
HTTP/1.1 200 OK { { "data":{ "id":29, "createTime": 1511886237, "1, "validSince":1525117527, "validUntil":null, "type":"TEXT", "bytes":"IyBTaW11bGF0ZWQgTWlrcm9UaWsgUm91dGVyT1Mgc3lzdGVtCiMgc29mdHdhcmUgaWQgPSBub25lCiMKL3NlY3Rpb24gYQpjb21tYW5kIGEKL3NlY3Rpb24gYmIKY29tbWFuZCBiYgovc2VjdGlvbiBjY2MKY29tbWFuZCBjY2MK"} } } |
Error 4xx
Name | Type | Description |
---|---|---|
timestamp | Number | Current timestamp |
code | Number | 404 |
error | String | HTTP code message |
message | String | Error message |
Panelcode | ||||||
---|---|---|---|---|---|---|
| ||||||
HTTP/1.1 404 NOT FOUND { { "timestamp": 1511889424942, "code": 404, "error":"Not Found", "message":"Device with id 12 not found" } |
Backups - get latest backups
Get a list of latest backup of devices with no particular order. Each backup is wrapped with device id and address.
Method: GET
Panelcode | ||||
---|---|---|---|---|
| ||||
http://example.unimus/api/ v1v2/devices/backups/latest?page=:pageIndex&size=:pageSize&id=:deviceIds |
Code Blockpanel | |||||
---|---|---|---|---|---|
| |||||
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v1 v2/devices/backups/latest?page=0&size=20&id=<deviceIds>" |
Parameter
Name | Type | Description |
---|---|---|
pageIndex | Number | Page index (OPTIONAL) |
pageSize | Number | Page size (OPTIONAL) |
deviceIds | String | Comma separated device ids. If this parameter is not specified then backups of all devices will be returned according to pagination. |
Success 200
Name | Type | Description |
---|---|---|
deviceId | Number | The ID of the device |
address | String | Hostname, IPv4 or IPv6 |
backup | Object | Backup object |
Panelcode | ||||||
---|---|---|---|---|---|---|
| ||||||
HTTP/1.1 200 OK { { "data":[ { [ { "deviceId":108, 1, "address":"198.18.0.18 0", "backup":{ "id":43, "createTime": 1511892002, "1, "validSince":1525117527, "validUntil":null, "type":"TEXT", "bytes":"IyBTaW11bGF0ZWQgTWlrcm9UaWsgUm91dGVyT1Mgc3lzdGVtCiMgc29mdHdhcmUgaWQgPSBub25lCiMKL3NlY3Rpb24gYQpjb21tYW5kIGEKL3NlY3Rpb24gYmIKY29tbWFuZCBiYgovc2VjdGlvbiBjY2MKY29tbWFuZCBjY2MK"} } ], IyBTaW11bGF0ZWQgTWlrcm9UaWsgUm91dGVyT1Mgc3lzdGVtCiMgc29mdHdhcmUgaWQgPSBub25lCiMKL3NlY3Rpb24gYQpjb21tYW5kIGEKL3NlY3Rpb24gYmIKY29tbWFuZCBiYgovc2VjdGlvbiBjY2MKY29tbWFuZCBjY2MK" } } ], "paginator":{ "totalCount":12, 1, "totalPages":12, 1, "page": 0, "size":1} 20 } } |
Running tasks
Run job - discover device
Trigger discovery job with all devices in the system. If u want to narrow down devices included in job then specify their IDs in request parameter.
Method: PATCH
Panelcode | ||||
---|---|---|---|---|
| ||||
http://example.unimus/api/ v1v2/jobs/discovery?id=:deviceIds |
Code Blockpanel | |||||
---|---|---|---|---|---|
| |||||
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" -X PATCH "http://<example.unimus>/api/v1 v2/jobs/discovery?id=<deviceIds>" |
Parameter
Name | Type | Description |
---|---|---|
deviceIds | String | Comma separated device ids to run discovery on |
Success 202
Name | Type | Description |
---|---|---|
accepted | Number | Number of started discoveries |
refused | Number | Number of refused discoveries. Discovery or backup currently running |
Panelcode | ||||||
---|---|---|---|---|---|---|
| ||||||
HTTP/1.1 202 ACCEPTED { { "data":{ "accepted": 12, "refused": 0 }} } |
Error 4xx
Name | Type | Description |
---|---|---|
timestamp | Number | Current timestamp |
code | Number | 404 |
error | String | HTTP code message |
message | String | Error message |
Panelcode | ||||||
---|---|---|---|---|---|---|
| ||||||
HTTP/1.1 403 NOT FOUND { { "timestamp": 1511897481896, "code": 404, "error":"Not Found", "message":"Devices not found [3]" } |
Run job - discover un-discovered devices
Trigger discovery job on for all undiscovered devices.
Method: PATCH
panel
Code Block | |||
---|---|---|---|
| |||
http://example.unimus/api/ v1v2/jobs/discovery/undiscovered |
Code Blockpanel | |||||
---|---|---|---|---|---|
| |||||
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" -X PATCH "http://<example.unimus>/api/v1 v2/jobs/discovery/undiscovered" |
Success 202
Name | Type | Description |
---|---|---|
accepted | Number | Number of started discoveries |
refused | Number | Number of refused discoveries. Discovery or backup currently running |
Panelcode | ||||||
---|---|---|---|---|---|---|
| ||||||
HTTP/1.1 202 ACCEPTED { { "data":{ "accepted": 12, "refused": 0 }} } |
Run job - backup device
Trigger backup job with all devices in the system. If u want to narrow down devices included in job then specify their IDs in request parameter.
Method: PATCH
Panelcode | ||||
---|---|---|---|---|
| ||||
http://example.unimus/api/ v1v2/jobs/backup?id=:deviceIds |
Code Blockpanel | |||||
---|---|---|---|---|---|
| |||||
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" -X PATCH "http://<example.unimus>/api/v1 v2/jobs/backup?id=<deviceIds>" |
Parameter
Name | Type | Description |
---|---|---|
deviceIds | String | Comma separated device ids to run backup on |
Success 202
Name | Type | Description |
---|---|---|
accepted | Number | Number of started backups |
refused | Number | Number of refused backups |
undiscoveredsentForDiscovery | Number | Unable to backup unUn-discovered devices sent for discovery |
Panelcode | ||||||
---|---|---|---|---|---|---|
| ||||||
HTTP/1.1 202 ACCEPTED { { "data":{ "accepted": 0, "refused": 2, "undiscovered"sentForDiscovery": 0 } } } |
Error 4xx
Name | Type | Description |
---|---|---|
timestamp | Number | Current timestamp |
code | Number | 404 |
error | String | HTTP code message |
message | String | Error message |
Panelcode | ||||||
---|---|---|---|---|---|---|
| ||||||
HTTP/1.1 403 NOT FOUND { { "timestamp": 1511899365179, "code": 404, "error":"Not Found", "message":"Devices not found [16, 23, 15]" } |