Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section

API documentation

 


General


Health check

Get Unimus health status.

Method: GET

Panel
borderColorgrey
borderStylesolid

http://example.unimus/api/v1/heatlh

CURL

Panel
borderColorgrey
borderStylesolid

curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v1/health"

Success 200

FieldTypeDescription
statusString

OK - Unimus is ready to handle all requests.

LICENSING_UNREACHABLE - License server is unreachable. All request will proceed except add, remove and update device.

ERROR - Unimus require user interaction to solve the problem. All requests will be refused.

Panel
borderColorgrey
borderStylesolid
titleSuccess response

 HTTP/1.1 200 OK

{

"data": {
"status": "OK"
}

}

 

 


Schedules


Schedules - get schedule

Get an individual schedule.

Method: GET

Panel
borderColorgrey
borderStylesolid

http://example.unimus/api/v1/schedules/:scheduleId

CURL

Panel
borderColorgrey
borderStylesolid

curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v1/schedules/<scheduleId>"

Parameter

FieldTypeDescription
scheduleIdNumberThe ID of the schedule

Success 200

FieldTypeDescription
 idNumber  The ID of the schedule
createTimeNumberSchedule creation time in seconds
periodicityStringSchedule periodicity. Possible values: MONTHLY, WEEKLY, DAILY, HOURLY
domNumberDay of month
dowNumberDay of week
hourNumberHour of day
minNumberMinute of hour
nameStringSchedule pretty name
Panel
borderColorgrey
borderStylesolid
titleSuccess response

HTTP/1.1 200 OK

{

"data": {
"id": 7,
"createTime": 1511863250,
"periodicity": "MONTHLY",
"dom": 1,
"dow": 1,
"hour": 0,
"min": 6,
"name": "Every month, on day 1, at 00:06."
}

}

Error 4xx

NameTypeDescription
timestamp Number Current timestamp
 code Number404
 error String HTTP code message
 messageString  Error message
Panel
borderColorgrey
borderStylesolid
titleError response

HTTP/1.1 404 NOT FOUND

{

"timestamp": 1511862182524,
"code": 404,
"error": "Not Found",
"message": "Schedule with id 11 not found"

}


Schedules - get schedules

Get a list of all schedules in Unimus.

Method: GET

Panel
borderColorgrey
borderStylesolid

http://example.unimus/api/v1/schedules?page=:pageIndex&size=:pageSize

CURL

Panel
borderColorgrey
borderStylesolid

curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v1/schedules?page=0&size=20"

Parameter

NameTypeDescription
pageIndexNumberPage index (OPTIONAL)
pageSizeNumberPage size (OPTIONAL)

Success 200

NameTypeDescription
 idNumber  The ID of the schedule
createTimeNumberSchedule creation time in seconds
periodicityStringSchedule periodicity. Possible values: MONTHLY, WEEKLY, DAILY, HOURLY
domNumberDay of month
dowNumberDay of week
hourNumberHour of day
minNumberMinute of hour
nameStringSchedule pretty name
Panel
borderColorgrey
borderStylesolid
titleSuccess response

HTTP/1.1 200 OK

{

"data":  [
  {
"id": 5,
"createTime": 1511863239,
"periodicity": "MONTHLY",
"dom": 5,
"dow": 1,
"hour": 0,
"min": 0,
"name": "Every month, on day 5, at 00:00."
},
{
"id": 7,
"createTime": 1511863250,
"periodicity": "MONTHLY",
"dom": 1,
"dow": 1,
"hour": 0,
"min": 6,
"name": "Every month, on day 1, at 00:06."
}
],
"paginator": {
"totalCount": 7,
"totalPages": 4,
"page": 1,
"size": 2
}

}


 

 


Devices


Devices - get device by ID

Get an individual device by ID.

Method: GET

Panel
borderColorgrey
borderStylesolid
 http://example.unimus/api/v1/devices/:deviceId?attr=:attributes

CURL

Panel
borderColorgrey
borderStylesolid

curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v1/devices/<deviceId>?attr=s,c"

Parameter

NameTypeDescription
deviceIdNumberThe ID of the device
attributesString

Comma separated graph attribute nodes. (OPTIONAL)

Possible values for device schedule: schedule, sch, s

for device credential: credential, cred, c

Success 200

NameTypeDescription
id NumberThe ID of the device 
createTime Number Device creation time in seconds
address StringHostname, IPv4 or IPv6
description StringDevice description
port NumberDevice port
connector StringConnector type, possible values: SSH, TELNET
vendor StringVendor
type StringType
model StringModel
schedule ObjectDevice schedule
credential ObjectCredential used to login to the device
Panel
borderColorgrey
borderStylesolid
titleSuccess response

HTTP/1.1 200 OK

{

"data": {
"id": 1,
"createTime": 1511339013,
"address": "198.18.0.29",
"description": "Back bone device",
"port": 22,
"connector": "SSH",
"vendor": "MikroTik",
"type": "RouterOS",
"model": "Simulated-RouterOS",
"schedule": null,
"credential": {
"id": 1,
"username": "test",
"password": "test",
"sshKey": null
}
}

}

Error 4xx

NameTypeDescription
timestamp Number Current timestamp
 code Number400
 error String HTTP code message
 messageString  Error message
Panel
borderColorgrey
borderStylesolid
titleError response

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

Panel
borderColorgrey
borderStylesolid

http://example.unimus/api/v1/devices/findByAddress/:address?attr=:attributes

CURL

Panel
borderColorgrey
borderStylesolid

curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v1/devices/findByAddress/<address>?page=0&size=20&attr=s,c"

Parameter

NameTypeDescription
addressStringThe IPv4, IPv6 or hostname of the device
attributesString

Comma separated graph attribute nodes. (OPTIONAL)

Possible values for device schedule: schedule, sch, s

for device credential: credential, cred, c

Success 200

NameTypeDescription
id NumberThe ID of the device 
createTime Number Device creation time in seconds
address StringHostname, IPv4 or IPv6
description StringDevice description
port NumberDevice port
connector StringConnector type, possible values: SSH, TELNET
vendor StringVendor
type StringType
model StringModel
schedule ObjectDevice schedule
credential ObjectCredential used to login to the device
Panel
borderColorgrey
borderStylesolid
titleSuccess response

HTTP/1.1 200 OK

{

"data": {
"id": 1,
"createTime": 1511339473,
"address": "198.18.0.39",
"description": "Main switch",
"port": 22,
"connector": "SSH",
"vendor": "MikroTik",
"type": "RouterOS",
"model": "Simulated-RouterOS",
"schedule": null,
"credential": {
"id": 4,
"username": "secret user",
"password": "top secret",
"sshKey": null
}
}

}

Error 4xx

NameTypeDescription
timestamp Number Current timestamp
 code Number404
 error String HTTP code message
 messageString  Error message
Panel
borderColorgrey
borderStylesolid
titleError response

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

Panel
borderColorgrey
borderStylesolid

http://example.unimus/api/v1/devices?page=:pageIndex&size=:pageSize&attr=:attributes

CURL

Panel
borderColorgrey
borderStylesolid

curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v1/devices?page=0&size=20&attr=s,c"

Parameter

NameTypeDescription
pageIndexNumberPage index (OPTIONAL)
pageSizeNumberPage size (OPTIONAL)
attributesString

Comma separated graph attribute nodes.(OPTIONAL)

Possible values for device schedule: schedule, sch, s

for device credential: credential, cred, c

Success 200

NameTypeDescription
id NumberThe ID of the device 
createTime Number Device creation time in seconds
address StringHostname, IPv4 or IPv6
description StringDevice description
port NumberDevice port
connector StringConnector type, possible values: SSH, TELNET
vendor StringVendor
type StringType
model StringModel
schedule ObjectDevice schedule
credential ObjectCredential used to login to the device
Panel
borderColorgrey
borderStylesolid
titleSuccess response

HTTP/1.1 200 OK

{

"data":  [
  {
"id": 2,
"createTime": 1511339013,
"address": "198.18.0.2777",
"description": null,
"port": 22,
"connector": null,
"credential": 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
}

}



Devices - create new device

Create a new device.

Method: POST

Panel
borderColorgrey
borderStylesolid

http://example.unimus/api/v1/devices

CURL

Panel
borderColorgrey
borderStylesolid

curl -H "Accept: application/json" -H "Content-type: application/json" -H "Authorization: Bearer <token>" -d '{"address":"<address>","description":"<description>"}' "http://<example.unimus>/api/v1/devices"

Parameter

NameTypeDescription
addressStringDevice address
descriptionStringDescription of the new device
scheduleIdNumber

Schedule id

If null then device will be backed up according to system default schedule

Success 201

NameTypeDescription
id NumberThe ID of the device 
createTime Number Device creation time in seconds
address StringHostname, IPv4 or IPv6
description StringDevice description
schedule ObjectDevice schedule
port Numbernull
connector Stringnull
vendor Stringnull
type Stringnull
model Stringnull
credential Objectnull
Panel
borderColorgrey
borderStylesolid
titleSuccess response

HTTP/1.1 201 CREATED

{

"id": 94,
"createTime": 1511876477,
"address": "10.10.10.10",
"description": null,
"port": null,
"connector": null,
"credential": null,
"vendor": null,
"type": null,
"model": null,
"schedule": {
"id": 1,
"createTime": 1511339012,
"periodicity": "DAILY",
"dom": 1,
"dow": 1,
"hour": 3,
"min": 0,
"name": "Every day at 03:00."
}

}

Error 4xx

NameTypeDescription
timestamp Number Current timestamp
 code Number422
 error String HTTP code message
 messageString  Error message
Panel
borderColorgrey
borderStylesolid
titleError response

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

Panel
borderColorgrey
borderStylesolid

http://example.unimus/api/v1/devices/:deviceId

CURL

Panel
borderColorgrey
borderStylesolid

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/devices/<deviceId>"

Parameter

NameTypeDescription
deviceIdNumberThe ID of the device
addressStringDevice address
descriptionStringDevice description
scheduleIdNumber

Schedule id.

If null then no schedule update occurs

If -1 then device will be backed up according to system default schedule

Success 200

NameTypeDescription
id NumberThe ID of the device 
createTime Number Device creation time in seconds
address StringHostname, IPv4 or IPv6
description StringDevice description
port NumberDevice port
connector StringConnector type, possible values: SSH, TELNET
vendor StringVendor
type StringType
model StringModel
schedule ObjectDevice schedule
credential ObjectCredential used to login to the device
Panel
borderColorgrey
borderStylesolid
titleSuccess response

HTTP/1.1 200 OK

{

"id": 96,
"createTime": 1511879360,
"address": "198.18.0.18",
"description": "aaaa",
"port": 22,
"connector": "SSH",
"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."
},
"credential": {
"id": 1,
"username": "test",
"password": "test",
"sshKey": null
}

}

Error 4xx

NameTypeDescription
timestamp Number Current timestamp
 code Number404
 error String HTTP code message
 messageString  Error message
Panel
borderColorgrey
borderStylesolid
titleError response

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

Panel
borderColorgrey
borderStylesolid

http://example.unimus/api/v1/devices/:deviceId

CURL

Panel
borderColorgrey
borderStylesolid

curl -H "Accept: application/json" -H "Authorization: Bearer <token>" -X DELETE "http://<example.unimus>/api/v1/devices/<deviceId>"

Parameter

NameTypeDescription
deviceIdNumberThe ID of the device to delete

Success 200

NameTypeDescription
successStringA message stating that the deletion was successful
Panel
borderColorgrey
borderStylesolid
titleSuccess response

HTTP/1.1 200 OK

{

"data": {
"success": "true"
}

}

Error 4xx

NameTypeDescription
timestamp Number Current timestamp
 code Number404
 error String HTTP code message
 messageString  Error message
Panel
borderColorgrey
borderStylesolid

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

Panel
borderColorgrey
borderStylesolid

http://example.unimus/api/v1/devices/:deviceId/backups?page=:pageIndex&size=:pageSize

CURL

Panel
borderColorgrey
borderStylesolid

curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v1/devices/1/backups?page=0&size=20"

Parameter

NameTypeDescription
deviceIdNumberThe ID of the device
pageIndexNumberPage index (OPTIONAL)
pageSizeNumberPage size (OPTIONAL)

Succees 200

NameTypeDescription
idNumberThe ID of the backup
createTimeNumberBackup creation time
typeStringBackup type. Could be TEXT or BINARY
bytesArrayBackup as byte array
Panel
borderColorgrey
borderStylesolid
titleSuccess response

HTTP/1.1 200 OK

{

"data":  [
  {
"id": 29,
"createTime": 1511886237,
"type": "TEXT",
"bytes": "IyBTaW11bGF0ZWQgTWlrcm9UaWsgUm91dGVyT1Mgc3lzdGVtCiMgc29mdHdhcmUgaWQgPSBub25lCiMKL3NlY3Rpb24gYQpjb21tYW5kIGEKL3NlY3Rpb24gYmIKY29tbWFuZCBiYgovc2VjdGlvbiBjY2MKY29tbWFuZCBjY2MK"
}
],
"paginator": {
"totalCount": 5,
"totalPages": 5,
"page": 0,
"size": 1
}

}

Error 4xx

NameTypeDescription
timestamp Number Current timestamp
 code Number404
 error String HTTP code message
 messageString  Error message
Panel
borderColorgrey
borderStylesolid
titleError response

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

Panel
borderColorgrey
borderStylesolid

http://example.unimus/api/v1/devices/:deviceId/backups/latest

CURL

Panel
borderColorgrey
borderStylesolid

curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v1/devices/<deviceId>/backups/latest"

Parameter

NameTypeDescription
deviceIdNumberThe ID of the device

Success 200

NameTypeDescription
idNumberThe ID of the backup
createTimeNumberBackup creation time
typeStringBackup type. Could be TEXT or BINARY
bytesArrayBackup as byte array
Panel
borderColorgrey
borderStylesolid
titleSuccess response

HTTP/1.1 200 OK

{

"data": {
"id": 29,
"createTime": 1511886237,
"type": "TEXT",
"bytes": "IyBTaW11bGF0ZWQgTWlrcm9UaWsgUm91dGVyT1Mgc3lzdGVtCiMgc29mdHdhcmUgaWQgPSBub25lCiMKL3NlY3Rpb24gYQpjb21tYW5kIGEKL3NlY3Rpb24gYmIKY29tbWFuZCBiYgovc2VjdGlvbiBjY2MKY29tbWFuZCBjY2MK"
}

}

Error 4xx

NameTypeDescription
timestamp Number Current timestamp
 code Number404
 error String HTTP code message
 messageString  Error message
Panel
borderColorgrey
borderStylesolid
titleError response

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

Panel
borderColorgrey
borderStylesolid

http://example.unimus/api/v1/devices/backups/latest?page=:pageIndex&size=:pageSize&id=:deviceIds

CURL

Panel
borderColorgrey
borderStylesolid

curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v1/devices/backups/latest?page=0&size=20&id=<deviceIds>"

Parameter

NameTypeDescription
pageIndexNumberPage index (OPTIONAL)
pageSizeNumberPage size (OPTIONAL)
deviceIdsString

Comma separated device ids. If this parameter is not specified then backups of all devices will be returned according to pagination.

Success 200

NameTypeDescription
deviceIdNumberThe ID of the device
addressStringHostname, IPv4 or IPv6
backupObjectBackup object
Panel
borderColorgrey
borderStylesolid
titleSuccess response

HTTP/1.1 200 OK

{

"data":  [
  {
"deviceId": 108,
"address": "198.18.0.18",
"backup": {
"id": 43,
"createTime": 1511892002,
"type": "TEXT",
"bytes": "IyBTaW11bGF0ZWQgTWlrcm9UaWsgUm91dGVyT1Mgc3lzdGVtCiMgc29mdHdhcmUgaWQgPSBub25lCiMKL3NlY3Rpb24gYQpjb21tYW5kIGEKL3NlY3Rpb24gYmIKY29tbWFuZCBiYgovc2VjdGlvbiBjY2MKY29tbWFuZCBjY2MK"
}
}
],
"paginator": {
"totalCount": 12,
"totalPages": 12,
"page": 0,
"size": 1
}

}


 

 


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

Panel
borderColorgrey
borderStylesolid

http://example.unimus/api/v1/jobs/discovery?id=:deviceIds

CURL

Panel
borderColorgrey
borderStylesolid

curl -H "Accept: application/json" -H "Authorization: Bearer <token>" -X PATCH "http://<example.unimus>/api/v1/jobs/discovery?id=<deviceIds>"

Parameter

NameTypeDescription
deviceIdsStringComma separated device ids to run discovery on

Success 202

NameTypeDescription
acceptedNumberNumber of started discoveries
refusedNumberNumber of refused discoveries. Discovery or backup currently running
Panel
borderColorgrey
borderStylesolid
titleSuccess response

HTTP/1.1 202 ACCEPTED

{

"data": {
"accepted": 12,
"refused": 0
}

}

Error 4xx

NameTypeDescription
timestamp Number Current timestamp
 code Number404
 error String HTTP code message
 messageString  Error message
Panel
borderColorgrey
borderStylesolid
titleError response

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 all undiscovered devices.

Method: PATCH

Panel
borderColorgrey
borderStylesolid

http://example.unimus/api/v1/jobs/discovery/undiscovered

CURL

Panel
borderColorgrey
borderStylesolid

curl -H "Accept: application/json" -H "Authorization: Bearer <token>" -X PATCH "http://<example.unimus>/api/v1/jobs/discovery/undiscovered"

Success 202

NameTypeDescription
acceptedNumberNumber of started discoveries
refusedNumberNumber of refused discoveries. Discovery or backup currently running
Panel
borderColorgrey
borderStylesolid
titleSuccess response

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

Panel
borderColorgrey
borderStylesolid

http://example.unimus/api/v1/jobs/backup?id=:deviceIds

CURL

Panel
borderColorgrey
borderStylesolid

curl -H "Accept: application/json" -H "Authorization: Bearer <token>" -X PATCH "http://<example.unimus>/api/v1/jobs/backup?id=<deviceIds>"

Parameter

NameTypeDescription
deviceIdsStringComma separated device ids to run backup on

Success 202

NameTypeDescription
acceptedNumberNumber of started backups
refusedNumberNumber of refused backups
undiscoveredNumberUnable to backup un-discovered devices
Panel
borderColorgrey
borderStylesolid
titleSuccess response

HTTP/1.1 202 ACCEPTED

{

"data": {
"accepted": 0,
"refused": 2,
"undiscovered": 0
}
}

Error 4xx

NameTypeDescription
timestamp Number Current timestamp
 code Number404
 error String HTTP code message
 messageString  Error message
Panel
borderColorgrey
borderStylesolid
titleError response

HTTP/1.1 403 NOT FOUND

{

"timestamp": 1511899365179,
"code": 404,
"error": "Not Found",
"message": "Devices not found [16, 23, 15]"

}