Page tree
Skip to end of metadata
Go to start of metadata

 

Overview

Basics

The Unimus API is a JSON based RESTfull API. It utilizes common HTTP methods such as GET, POST, PATCH and DELETE in order to identify
action you want to perform.

When submitting a request that contains a body you must include a header for Content-type that specifies application/json.

API Version 2 is supported by Unimus 1.7.x and newer. API version 1 is no longer supported.

API changes since version 1

  • Backup
    • renamed field createTime to validSince, represents the time the configuration has been retrieved from the device for the first time
    • added field validUntil,  represents the time the configuration has been retrieved from the device for the last time
  • Device
    • removed fields port, connector, credential
    • added field connections, which is an array of discovered connections, each connection entity contains fields type (SSH,TELNET), port, credentials (array of all usable credentials) and enablePassword (if not same as login password).
    • entity graph attribute nodes for fetching device credentials credential,cred,c are no longer supported
    • added entity graph attribute nodes for fetching connections connections, conn, c.
  • Run job - backup device
    • removed field undiscovered, which represented the number of un-discovered devices excluded from backup job
    • added field sentForDiscovery, which represent the number of un-discovered devices sent for discovery (and backup if discovery will succeed)

Security

Every request has to include Authorization header following Bearer scheme as shown below.

Authorization: Bearer <token>

Log into your local Unimus instance and navigate to User management > API tokens section to create new token.

Returned data format

All responses are returned as JSON. If a response can ever contain a single item it will be formatted as follow:

{
   "data":{
      "someKey":"someValue",
      "anotherKey":"anotherValue"
   }
}

 

Multi-item responses are paginated automatically. The maximum amount of items that can be returned in a single query is 50, default is 20. You may specify the number of items to be returned in response by appending a query parameter size.

You may specify the page you wish to view by appending a parameter page, default is 0. Multi-item responses are formatted as follow:

{
   "data":[
      {
         "someKey":"someValue",
         "anotherKey":"anotherValue"
      },
      {
         "someKey":"someValue",
         "anotherKey":"anotherValue"
      }
   ],
   "paginator":{
      "totalCount":12,
      "totalPages":6,
      "page":0,
      "size":2
   }
}

 

All successful response are sent with an HTTP response code 2xx.

Failure response format

If an API response fails, it will be sent with a non-2xx response code and JSON in the following format:

{
   "timestamp":1511904038642,
   "code":400,
   "error":"Bad Request",
   "message":"This is why it fails"
}

 

The HTTP status codes currently returned by the API are 301 if the API version is not supported 400 if request syntax is wrong, 401 if request is unauthorized, 404 if requesting with item ID and item is not found or request path is not supported by the API, 405 if the method is not supported, 415 if media type is not supported, 503 if request can not be served. Any internal application errors will respond with a 500 code and we will be grateful if u report them to us. 


API documentation

 


General

 


Health check

Get Unimus health status.

Method: GET

http://example.unimus/api/v2/health
CURL
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v2/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.

 

 

Success response
HTTP/1.1 200 OK
{
   "data":{
      "status":"OK"
   }
}

 

 


Schedules


Schedules - get schedule

Get an individual schedule.

Method: GET

http://example.unimus/api/v2/schedules/:scheduleId
CURL
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v2/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

 

 

Success 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

 

Schedules - get schedules

Get a list of all schedules in Unimus.

Method: GET

http://example.unimus/api/v2/schedules?page=:pageIndex&size=:pageSize
CURL
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v2/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
Success 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

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

Parameter

NameTypeDescription
deviceIdNumberThe ID of the device
attributesString

Comma separated attribute nodes. (OPTIONAL)

Possible values:

device schedule: schedule, sch, s

device connections: connections, conn, c

 

 

Success 200

NameTypeDescription
id NumberThe ID of the device 
uuidStringThe UUID of the device (used in APIv3)
createTimeNumber Device creation time in seconds
address StringHostname, IPv4 or IPv6
description StringDevice description
managedBooleanManaged state
schedule ObjectDevice schedule
vendor StringVendor
type StringType
model StringModel
lastJobStatusString

Status of the last job.

Possible values: SUCCESSFUL, FAILED,

UNKNOWN (no job ran yet or unmanaged)

connectionsArrayDevice connections

zoneId

String

The ID of the zone

 

 

 

 

 

 

 

Success response
HTTP/1.1 200 OK
{
   "data":{
      "id":1,
      "createTime":1525101029,
      "address":"198.18.0.0",
      "description":null,
      "managed":true,
      "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",
      "lastJobStatus":"SUCCESSFUL"
      "connections":[
         {
            "type":"SSH",
            "port":22,
            "credentials":[
               {
                  "id":1,
                  "username":"test",
                  "password":"test",
                  "sshKey":null
               }
            ],
            "enablePassword":null
 
         }
      ],
      "zoneId": "1"
   }
}

Error 4xx

NameTypeDescription
timestamp Number Current timestamp
 code Number400
 error String HTTP code message
 messageString  Error message
Error 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

http://example.unimus/api/v2/devices/findByAddress/:address?attr=:attributes&zoneId=:zone_ID
CURL
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v2/devices/findByAddress/<address>?attr=s,c?zoneId=<zone ID>"

Parameter

NameTypeDescription
addressStringDevice address
attributesString

Comma separated attribute nodes. (OPTIONAL)

Possible values:

device schedule: schedule, sch, s

device connections: connections, conn, c

zone_ID
String

Zone ID (as seen in UI) (OPTIONAL)

Default Zone used if not specified

Success 200

NameTypeDescription
id NumberThe ID of the device 
uuidStringThe UUID of the device (used in APIv3)
createTimeNumberDevice creation time in seconds
address StringHostname, IPv4 or IPv6
description StringDevice description
managedBooleanManaged state
schedule ObjectDevice schedule
vendor StringVendor
type StringType
model StringModel
lastJobStatusString

Status of the last job.

Possible values: SUCCESSFUL, FAILED,

UNKNOWN (no job ran yet or unmanaged)

connectionsArrayDevice connections

zoneId

String

The ID of the zone

Success response
HTTP/1.1 200 OK
{
   "data":{
      "id":1,
      "uuid":D-aaaacccc-bbee-4321-b42b-abc1234d101b"
      "createTime":1525101029,
      "address":"198.18.0.0",
      "description":null,
      "managed":true,
      "schedule":null,
      "vendor":"MikroTik",
      "type":"RouterOS",
      "model":"Simulated-RouterOS",
      "lastJobStatus":"SUCCESSFUL"
      "connections":[
 
      ],
      "zoneId": "1"
   }
}

Error 4xx

NameTypeDescription
timestamp Number Current timestamp
 code Number404
 error String HTTP code message
 messageString  Error message
Error 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 by description

Get a list of devices which description contains given term.

Method: GET

http://example.unimus/api/v2/devices/findByDescription/:description?attr=:attributes
CURL
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v2/devices/findByDescription/<description>?attr=s,c"

Parameter

NameTypeDescription
descriptionString

Device description

attributesString

Comma separated attribute nodes. (OPTIONAL)

Possible values:

device schedule: schedule, sch, s

device connections: connections, conn, c

Success 200

NameTypeDescription
id NumberThe ID of the device 
uuidStringThe UUID of the device (used in APIv3)
createTimeNumberDevice creation time in seconds
address StringHostname, IPv4 or IPv6
description StringDevice description
managedBooleanManaged state
schedule ObjectDevice schedule
vendor StringVendor
type StringType
model StringModel
lastJobStatusString

Status of the last job.

Possible values: SUCCESSFUL, FAILED,

UNKNOWN (no job ran yet or unmanaged)

connectionsArrayDevice connections

zoneId

String

The ID of the zone

Success response
HTTP/1.1 200 OK
{
   "data":[
      {
         "id":1,
         "uuid":D-aaaacccc-bbee-4321-b42b-abc1234d101b"
         "createTime":1525101574,
         "address":"198.1.0.1",
         "description":"Main back-bone",
         "managed":true,
         "schedule":null,
         "vendor":"MikroTik",
         "type":"RouterOS",
         "model":"Simulated-RouterOS",
         "lastJobStatus": "SUCCESSFUL"
         "connections":[
  
         ],
         "zoneId": "1"
      }
   ],
   "paginator":{
      "totalCount":1,
      "totalPages":1,
      "page":0,
      "size":20
   }
}

 

Devices - get devices

Get a list of devices.

Method: GET

http://example.unimus/api/v2/devices?page=:pageIndex&size=:pageSize&attr=:attributes
CURL
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v2/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 
uuidStringThe UUID of the device (used in APIv3)
createTimeNumberDevice creation time in seconds
address StringHostname, IPv4 or IPv6
description StringDevice description
managedBooleanManaged state
schedule ObjectDevice schedule
vendor StringVendor
type StringType
model StringModel
lastJobStatusString

Status of the last job.

Possible values: SUCCESSFUL, FAILED,

UNKNOWN (no job ran yet or unmanaged)

connectionsArrayDevice connections

zoneId

String

The ID of the zone

Success response
HTTP/1.1 200 OK
{
   "data":[
      {
         "id":1,
         "uuid":D-aaaacccc-bbee-4321-b42b-abc1234d101b"
         "createTime":1525101029,
         "address":"198.18.0.0",
         "description":null,
         "managed":true,
         "schedule":null,
         "vendor":"MikroTik",
         "type":"RouterOS",
         "model":"Simulated-RouterOS",
         "lastJobStatus":"SUCCESSFUL"
         "connections":[
 
         ],
         "zoneId": "1"
      }
   ],
   "paginator":{
      "totalCount":1,
      "totalPages":1,
      "page":0,
      "size":20
   }
}

 

Devices - create new device

Create a new device.

Method: POST

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

Parameter

NameTypeDescription
addressStringDevice address
descriptionStringDescription of the new device
scheduleIdNumber

Schedule id (OPTIONAL)

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

zoneIdString

Zone ID (as seen in UI) (OPTIONAL)

if omitted then device will be created in the default Zone

Success 201

NameTypeDescription
id NumberThe ID of the device 
uuidStringThe UUID of the device (used in APIv3)
createTimeNumberDevice creation time in seconds
address StringHostname, IPv4 or IPv6
description StringDevice description
managedBooleanManaged state
schedule ObjectDevice schedule
vendor StringVendor
type StringType
model StringModel
lastJobStatusString

Status of the last job.

Possible values: SUCCESSFUL, FAILED,

UNKNOWN (no job ran yet or unmanaged)

connectionsArrayDevice connections

zoneId

String

The ID of the zone

Success response
HTTP/1.1 201 CREATED
{
   "data":{
      "id":1,
      "uuid":D-aaaacccc-bbee-4321-b42b-abc1234d101b"
      "createTime":1525101029,
      "address":"198.18.0.0",
      "description":null,
      "managed": true,
      "schedule":{
         "id":1,
         "createTime":1524564606,
         "periodicity":"DAILY",
         "dom":-1,
         "dow":-1,
         "hour":3,
         "min":0,
         "name":"Every day at 03:00."
      },
      "vendor":null,
      "type":null,
      "model":null,
      "lastJobStatus":"UNKNOWN"
      "connections":[],
      "zoneId": "1"
 
   }
}

Error 4xx

NameTypeDescription
timestamp Number Current timestamp
 code Number422
 error String HTTP code message
 messageString  Error message
Error 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

http://example.unimus/api/v2/devices/:deviceId
CURL
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/v2/devices/<deviceId>"

Parameter

NameTypeDescription
deviceIdNumberThe ID of the device.
addressString

Device address.

If null then no address update occurs

descriptionString

Device description.

Description is always updated - should be provided if it should not be changed. If null, then description is removed

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 
uuidStringThe UUID of the device (used in APIv3)
createTimeNumberDevice creation time in seconds
address StringHostname, IPv4 or IPv6
description StringDevice description
managedBooleanManaged state
schedule ObjectDevice schedule
vendor StringVendor
type StringType
model StringModel
lastJobStatusString

Status of the last job.

Possible values: SUCCESSFUL, FAILED,

UNKNOWN (no job ran yet or unmanaged)

connectionsArrayDevice connections

zoneId

String

The ID of the zone

Success response
HTTP/1.1 200 OK
{
   "data":{
      "id":1,
      "uuid":D-aaaacccc-bbee-4321-b42b-abc1234d101b"
      "createTime":1525101029,
      "address":"198.18.0.0",
      "description":null,
      "managed": true,
      "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",
      "lastJobStatus":"SUCCESSFUL"
      "connections":[
 
      ],
      "zoneId": "1"
   }
}

Error 4xx

NameTypeDescription
timestamp Number Current timestamp
 code Number404
 error String HTTP code message
 messageString  Error message
Error 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

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

Parameter

NameTypeDescription
deviceIdNumberThe ID of the device to delete

Success 200

NameTypeDescription
successStringA message stating that the deletion was successful
Success 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
Error response
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

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

Parameter

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

Success 200

NameTypeDescription
idNumberThe ID of the backup
validSinceNumberFirst time this configuration retrieved from the device
validUntilNumberLast time this configuration retrieved from the device.
Will be null if the configuration was retrieved only once
(only validSince will be set)
typeStringBackup type. Could be TEXT or BINARY
bytesArrayBackup as byte array
Success response
HTTP/1.1 200 OK
{
   "data":[
      {
         "id":1,
         "validSince":1525117527,
         "validUntil":null,
         "type":"TEXT",
         "bytes":"IyBTaW11bGF0ZWQgTWlrcm9UaWsgUm91dGVyT1Mgc3lzdGVtCiMgc29mdHdhcmUgaWQgPS"
      }
   ],
   "paginator":{
      "totalCount":1,
      "totalPages":1,
      "page":0,
      "size":20
   }
}

Error 4xx

NameTypeDescription
timestamp Number Current timestamp
 code Number404
 error String HTTP code message
 messageString  Error message
Error 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

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

Parameter

NameTypeDescription
deviceIdNumberThe ID of the device

Success 200

NameTypeDescription
idNumberThe ID of the backup
validSinceNumberFirst time this configuration retrieved from the device
validUntilNumber

Last time this configuration retrieved from the device.
Will be null if the configuration was retrieved only once
(only validSince will be set)

typeStringBackup type. Could be TEXT or BINARY
bytesArrayBackup as byte array
Success response
HTTP/1.1 200 OK
{
   "data":{
      "id":1,
      "validSince":1525117527,
      "validUntil":null,
      "type":"TEXT",
      "bytes":"IyBTaW11bGF0ZWQgTWlrcm9UaWsgUm91dGVyT1Mgc3lzdGVtCiMgc29mdHdhcmUgaWQgPSBub25"
   }
}

Error 4xx

NameTypeDescription
timestamp Number Current timestamp
 code Number404
 error String HTTP code message
 messageString  Error message
Error 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

http://example.unimus/api/v2/devices/backups/latest?page=:pageIndex&size=:pageSize&id=:deviceIds
CURL
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v2/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
Success response
HTTP/1.1 200 OK
{
   "data":[
      {
         "deviceId":1,
         "address":"198.18.0.0",
         "backup":{
            "id":1,
            "validSince":1525117527,
            "validUntil":null,
            "type":"TEXT",
            "bytes":"IyBTaW11bGF0ZWQgTWlrcm9UaWsgUm91dGVyT1Mgc3lzdGVtCiMgc29mdHdhcmUgaWQgPSBub25l"
         }
      }
   ],
   "paginator":{
      "totalCount":1,
      "totalPages":1,
      "page":0,
      "size":20
   }
}

 

Backups - create new backup

Create a new backup.

Method: POST

http://example.unimus/api/v2/devices/:deviceId/backups
CURL
curl -H "Accept: application/json" -H "Content-type: application/json" -H "Authorization: Bearer <token>" 
-d '{"backup":"<backup>","type":"<TEXT>"}' "http://example.unimus/api/v2/devices/<deviceId>/backups"

Parameter

NameTypeDescription
backupString

Backup content

(Base64 encoded)

typeString

Possible values:

BINARY - for binary content

TEXT - for text content

Success 200

NameTypeDescription
successString

A message stating that the creation was successful

Success response
HTTP/1.1 200 OK
{
   "data":{
      "success":"true"
   }
}

Error 4xx

NameTypeDescription
timestampNumber Current timestamp
codeNumber404
errorStringHTTP code message
messageStringError message
Error response
HTTP/1.1 404 NOT FOUND
{
   "timestamp":1514894056726,
   "code":404,
   "error":"Not Found",
   "message":"Device with id 102 not found"
}

 

 


Diff


Diff - get devices with different backups

Get a list of devices that has different backups in specified time range. If no backups has been changed for any device then empty array is returned with HTTP code 200.

NOTE: In the following example since is 100 and until is 200 for easier understand how this endpoint works.

Method: GET

http://example.unimus/api/v2/devices/findByChangedBackup?page=:pageIndex&size=:pageSize&since=:since&until=:until
CURL
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v2/devices/findByChangedBackup?page=0&size=20&since=100&until=200"

Parameter

NameTypeDescription
pageIndexNumberPage index (OPTIONAL)
pageSizeNumberPage size (OPTIONAL)
sinceNumberStart of time range in seconds (OPTIONAL) (DEFAULT = 0)
untilNumberEnd of time range in seconds (OPTIONAL) (DEFAULT = time of the request)

 

Success 200

NameTypeDescription
idNumberThe ID of the device
createTimeNumberDevice creation time in seconds
addressStringHostname, IPv4 or IPv6
descriptionStringDevice description
vendorStringVendor
typeStringType
modelStringModel
lastJobStatusString

Status of the last job.

Possible values: SUCCESSFUL, FAILED,

UNKNOWN (no job ran yet)
backupsArrayList of different device backups

zoneId

String

The ID of the zone

Success response
{
   "data":[
      {
         "id":1,
         "uuid":D-aaaacccc-bbee-4321-b42b-abc1234d101b"
         "createTime":1525101029,
         "address":"198.18.0.0",
         "description":null,
         "managed": true,
         "vendor":"MikroTik",
         "type":"RouterOS",
         "model":"model",
         "lastJobStatus":"SUCCESSFUL"
         "backups":[
            {
               "id":1,
               "validSince":80,
               "validUntil":101
            },
            {
               "id":2,
               "validSince":120,
               "validUntil":145
            },
            {
               "id":3,
               "validSince":150,
               "validUntil":180
            },
            {
               "id":4,
               "validSince":181,
               "validUntil":260
            }
         ],
         "zoneId": "1"
      }
   ],
   "paginator":{
      "totalCount":1,
      "totalPages":1,
      "page":0,
      "size":20
   }
}

 

Diff - get diff

Get a difference between original and revised backup. Endpoint support making difference between backups from different devices.

Method: GET

http://example.unimus/api/v2/backups/diff?origId=:origId&revId=:revId
CURL
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v2/backups/diff?origId=1&revId=2"

Parameter

NameTypeDescription
origIdNumberID of the backup that will be considered as original
revIdNumberID of the backup that will be considered as revised

Success 200

NameTypeDescription
origDeviceInfoObjectContains information about device with original backup
revDeviceInfoObjectContains information about device with revised backup
lineGroupsArray

Contains array of group of lines.

Every group has one of the following types: COMMON, CHANGED, INSERTED, DELETED

Success response - complete JSON
{
   "data":{
      "origDeviceInfo":{
         "id":1,
         "createTime":123456789,
         "address":"10.0.0.1",
         "description":"some dscr",
         "vendor":"MikroTik",
         "type":"RouterOS",
         "model":"mkt-model",
         "lastJobStatus":"SUCCESSFUL"
         "zoneId": "1"
      },
      "revDeviceInfo":{
         "id":2,
         "createTime":123456789,
         "address":"10.1.1.1",
         "description":"another dscr",
         "vendor":"Cisco",
         "type":"IOS switch",
         "model":"cisco-model",
         "lastJobStatus":"FAILED"
         "zoneId": "1"
      },
      "lineGroups":[
         {
            "type":"COMMON",
            "originalLines":[
               {
                  "number":1,
                  "text":"common line 1"
               },
               {
                  "number":2,
                  "text":"common line 2"
               }
            ],
            "revisedLines":[
               {
                  "number":1,
                  "text":"common line 1"
               },
               {
                  "number":2,
                  "text":"common line 2"
               }
            ]
         },
         {
            "type":"CHANGED",
            "originalLines":[
               {
                  "number":3,
                  "text":"changed line - asd"
               },
               {
                  "number":4,
                  "text":"changed line - asd"
               },
               {
                  "number":5,
                  "text":"changed line - asd"
               }
            ],
            "revisedLines":[
               {
                  "number":3,
                  "text":"changed line - xyz"
               },
               {
                  "number":4,
                  "text":"changed line - xyz"
               },
               {
                  "number":-1,
                  "text":null
               }
            ]
         },
         {
            "type":"COMMON",
            "originalLines":[
               {
                  "number":6,
                  "text":"common line"
               }
            ],
            "revisedLines":[
               {
                  "number":5,
                  "text":"common line"
               }
            ]
         },
         {
            "type":"INSERTED",
            "originalLines":[
 
            ],
            "revisedLines":[
               {
                  "number":6,
                  "text":"inserted line"
               }
            ]
         },
         {
            "type":"COMMON",
            "originalLines":[
               {
                  "number":7,
                  "text":"common line"
               }
            ],
            "revisedLines":[
               {
                  "number":7,
                  "text":"common line"
               }
            ]
         },
         {
            "type":"DELETED",
            "originalLines":[
               {
                  "number":8,
                  "text":"deleted line"
               }
            ],
            "revisedLines":[
 
            ]
         }
      ]
   }
}

 

 


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

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

Parameter

NameTypeDescription
deviceIdsStringComma separated device ids to run discovery on

Success 202

NameTypeDescription
acceptedNumberNumber of started discoveries
refusedNumber

Number of refused discoveries. Discovery or backup currently running

unManagedNumberNumber of un-managed devices
Success response
HTTP/1.1 202 ACCEPTED
{
   "data":{
      "accepted":12,
      "refused":0,
      "unManaged":0
   }
}

Error 4xx

NameTypeDescription
timestamp Number Current timestamp
 code Number404
 error String HTTP code message
 messageString  Error message
Error 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 for all undiscovered devices.

Method: PATCH

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

Success 202

NameTypeDescription
acceptedNumberNumber of started discoveries
refusedNumberNumber of refused discoveries. Discovery or backup currently running
unManagedNumberNumber of un-managed devices
Success response
HTTP/1.1 202 ACCEPTED
{
   "data":{
      "accepted":12,
      "refused":0,
      "unManaged":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

http://example.unimus/api/v2/jobs/backup?id=:deviceIds
CURL
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" -X PATCH "http://<example.unimus>/api/v2/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
sentForDiscoveryNumberUn-discovered devices sent for discovery
unManagedNumberNumber of un-managed devices
Success response
HTTP/1.1 202 ACCEPTED
{
   "data":{
      "accepted":0,
      "refused":2,
      "sentForDiscovery":0,
      "unManaged":0
   }
}

Error 4xx

NameTypeDescription
timestamp Number Current timestamp
 code Number404
 error String HTTP code message
 messageString  Error message
Error response
HTTP/1.1 403 NOT FOUND
{
   "timestamp":1511899365179,
   "code":404,
   "error":"Not Found",
   "message":"Devices not found [16, 23, 15]"
}

 

 

  • No labels