Message-ID: <741937933.4202.1711727294561.JavaMail.confluence@unimus-dev1> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_4201_1353841724.1711727294560" ------=_Part_4201_1353841724.1711727294560 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html Full API v.2 documentation

Full API v.2 documentation

Overview

Basics

The Unimus API is a JSON based RESTfull API. It utilizes common HTTP met= hods 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 ap= plication/json.

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

API changes sinc= e 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,  repre= sents 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 discover= ed 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 cr= edential,cred,c are no longer su= pported
    • added entity graph attribute nodes for fetching connections con= nections, conn, c.
  • Run job - backup device
    • removed field undiscovered, which represented the numb= er of un-discovered devices excluded from backup job
    • added field sentForDiscovery, which represent the numb= er of un-discovered devices sent for discovery (and backup if discovery wil= l succeed)

Security

Every request has to include Authorization he= ader following Bearer scheme as shown below.

=20

Authorization: B= earer <token>

=20

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

Returned data format<= /h2>

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

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

 

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 formatte= d as follow:

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

 

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

Failure response f= ormat

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

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

 

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 unaut= horized, 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 reques= t can not be served. Any internal application errors will respond with a&nb= sp;500 code and we will be grateful if u report them = to us. 


API documentation

 


General

 


Health check

Get Unimus health status.

Method: GET

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

Success 200

Field Type Description
status String

OK - Unimus is= ready to handle all requests.

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

ERROR - Unimus require user in= teraction to solve the problem. All requests will be refused.

 

 

Success response
=20
HTTP/1.=
1 200 OK
{
   "data":{
      "status":"OK"
   }
}
=20

 

 


Schedules


Schedules - get sc= hedule

Get an individual schedule.

Method: GET

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

Parameter

Field Type Description
scheduleId Number The ID of the schedule

Success 200

Field Type Description
 id Number   The ID of the schedule
createTime Number Schedule creation time in seconds
periodicity String Schedule periodicity. Possible val= ues: MONTHLY, WEEKLY, DAILY, HOURLY
dom Number Day of month
dow Number Day of week
hour Number Hour of day
min Number Minute of hour
name String Schedule pretty name

 

 

Success response
=20
 H=
TTP/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."
   }
}
=20

Error 4xx

Name Type Description
timestamp  Number  Current timestamp
 code  Number 404
 error  String  HTTP code message
 message String   Error message

 

Schedules= - get schedules

Get a list of all schedules in Unimus.

Method: GET

=20
http://=
example.unimus/api/v2/schedules?page=3D:pageIndex&size=3D:pageSize=20
CURL
=20
curl -H=
 "Accept: application/json" -H "Authorization: Bearer <token>" "http:=
//<example.unimus>/api/v2/schedules?page=3D0&size=3D20"
=20

Parameter

Name Type Description
pageIndex Number Page index (OPTIONAL)
pageSize Number Page size (OPTIONAL)

 


Success 200

Name Type Description
 id Number   The ID of the schedule
createTime Number Schedule creation time in seconds<= /td>
periodicity String Schedule periodicity. Possible values: M= ONTHLY, WEEKLY, DAILY, H= OURLY
dom Number Day of month
dow Number Day of week
hour Number Hour of day
min Number Minute of hour
name String Schedule pretty name
Success response
=20
 H=
TTP/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
   }
}
=20

 

 


Devices


Devices - get devi= ce by ID

Get an individual device by ID.

Method: GET

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

Parameter

Name Type Description
deviceId Number The ID of the device
attributes String

Comma separated attribute nodes= . (OPTIONAL)

Possible values:

de= vice schedule: schedule, sch, s

device connections: connections, conn,<= /strong> c

 

Success 200

Name Type Description
id  Number The ID of the device 
uuid String The UUID of the device (used in AP= Iv3)
createTime Number  Device creation time in seco= nds
address  String Hostname, IPv4 or IPv6
description  String Device description
managed Boolean Managed state
schedule  Object Device schedule
vendor  String Vendor
type  String Type
model  String Model
lastJobStatus String

Status of the last job.

P= ossible values: SUCCESSFUL, FAILED,

UNKNOWN (no job ran yet or unmana= ged)

connections Array Device connections

 

 

 

 

Success response
=20
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
         }
      ]
   }
}
=20

Error 4xx

Name Type Description
timestamp  Number  Current timestamp
 code  Number 400
 error  String  HTTP code message
 message String   Error message
Error response
=20
HTTP/1.=
1 400 BAD REQUEST
{
   "timestamp":1511869830038,
   "code":400,
   "error":"Bad Request",
   "message":"Argument deviceId type mismatch"
}
=20


Devices - get= device by address

Get an individual device by address.

Method: GET

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

Parameter

Name Type Description
address String Device address
attributes String

Comma separated attribute nodes= . (OPTIONAL)

Possible values:

de= vice schedule: schedule, sch, s

device connections: connections, conn,<= /strong> c

zone_ID
String

Zone ID (as seen in UI) (= OPTIONAL)

Default Zone used if not specified

<= /td>

Success 200

Name Type Description
id  Number The ID of the device 
uuid String The UUID of the device (used in APIv3)
createTime Number Device creation time in seconds
address  String Hostname, IPv4 or IPv6
description  String Device description
managed Boolean Managed state
schedule  Object Device schedule
vendor  String Vendor
type  String Type
model  String Model
lastJobStatus String

Status of the last job.

P= ossible values: SUCCESSFUL, FAILED,

UNKNOWN (no job ran yet or unmana= ged)

connections Array Device connections
Success response
=20
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":[

      ]
   }
}
=20

Error 4xx

Name Type Description
timestamp  Number  Current timestamp
 code  Number 404
 error  String  HTTP code message
 message String   Error message
Error response
=20
HTTP/1.=
1 404 BAD REQUEST
{
   "timestamp":1511862182524,
   "code":404,
   "error":"Not Found",
   "message":"Device with address some_address not found"
}
=20

 

Devices = - get devices by description

Get a list of devices which description contains given term.

Method: GET

=20
http://=
example.unimus/api/v2/devices/findByDescription/:description?attr=3D:attrib=
utes
=20
CURL
=20
curl -H=
 "Accept: application/json" -H "Authorization: Bearer <token>" "http:=
//<example.unimus>/api/v2/devices/findByDescription/<description&g=
t;?attr=3Ds,c"
=20

Parameter

Name Type Description
description String

Device description

attributes String

Comma separated attribute nodes= . (OPTIONAL)

Possible values:

de= vice schedule: schedule, sch, s=

device connections: conn= ections, conn, c

Success 200

Name Type Description
id  Number The ID of the device 
uuid String The UUID of the device (used in APIv3)
createTime Number Device creation time in seconds
address  String Hostname, IPv4 or IPv6
description  String Device description
managed Boolean Managed state
schedule  Object Device schedule
vendor  String Vendor
type  String Type
model  String Model
lastJobStatus String

Status of the last job.

P= ossible values: SUCCESSFUL, FAILED,

UNKNOWN (no job ran yet or unmana= ged)

connections Array Device connections
Success response
=20
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":[
=20
         ]
      }
   ],
   "paginator":{
      "totalCount":1,
      "totalPages":1,
      "page":0,
      "size":20
   }
}
=20

 

Devices - get devices=

Get a list of devices.

Method: GET

=20
http://=
example.unimus/api/v2/devices?page=3D:pageIndex&size=3D:pageSize&at=
tr=3D:attributes
=20
CURL
=20
curl -H=
 "Accept: application/json" -H "Authorization: Bearer <token>" "http:=
//<example.unimus>/api/v2/devices?page=3D0&size=3D20&attr=3Ds=
,c"
=20

Parameter

Name Type Description
pageIndex Number Page index (OPTIONAL)
pageSize Number Page size (OPTIONAL)
attributes String

Comma separated graph attribute nodes.(OPTION= AL)

Possible values for device schedule: schedule, sch, s

for device cred= ential: credential, cred, c

Success 200

Name Type Description
id  Number The ID of the device 
uuid String The UUID of the device (used in APIv3)
createTime Number Device creation time in seconds
address  String Hostname, IPv4 or IPv6
description  String Device description
managed Boolean Managed state
schedule  Object Device schedule
vendor  String Vendor
type  String Type
model  String Model
lastJobStatus String

Status of the last job.

P= ossible values: SUCCESSFUL, FAILED,

UNKNOWN (no job ran yet or unmana= ged)

connections Array Device connections
Success response
=20
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":[

         ]
      }
   ],
   "paginator":{
      "totalCount":1,
      "totalPages":1,
      "page":0,
      "size":20
   }
}
=20

 

Devices - create= new device

Create a new device.

Method: POST

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

Parameter

Name Type Description
address String Device address
description String Description of the new device
scheduleId Number

Schedule id (OPTIONAL)

If omitted then device will be backed up according to system def= ault schedule

zoneId String

Zone ID (as seen in UI) (= OPTIONAL)

if omitted then device will be created in the defaul= t Zone

Success 201

Name Type Description
id  Number The ID of the device 
uuid String The UUID of the device (used in APIv3)
createTime Number Device creation time in seconds
address  String Hostname, IPv4 or IPv6
description  String Device description
managed Boolean Managed state
schedule  Object Device schedule
vendor  String Vendor
type  String Type
model  String Model
lastJobStatus String

Status of the last job.

P= ossible values: SUCCESSFUL, FAILED,

UNKNOWN (no job ran yet or unmana= ged)

connections Array Device connections
Success response
=20
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,
=09  "lastJobStatus":"UNKNOWN"=20
      "connections":[]
   }
}
=20

Error 4xx

Name Type Description
timestamp  Number  Current timestamp
 code  Number 422
 error  String  HTTP code message
 message String   Error message
Error response
=20
HTTP/1.=
1 422 UNPROCESSABLE ENTITY
{
   "timestamp":1511876680885,
   "code":422,
   "error":"Unprocessable Entity",
   "message":"Device already exist"
}
=20

 

Devices - update de= vice

Update device address, description or schedule time.

Method: PATCH

=20
http://=
example.unimus/api/v2/devices/:deviceId
=20
CURL
=20
curl -H=
 "Accept: application/json" -H "Content-type: application/json" -H "Authori=
zation: Bearer <token>" -X PATCH=20
-d '{"address":"<address>","description":"<description>","sched=
uleId":"<scheduleId>"}' "http://<example.unimus>/api/v2/devices=
/<deviceId>"
=20

Parameter

Name Type Description
deviceId Number The ID of the device.
address String

Device address.

If null then no address update occurs

description String

Device description.

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

scheduleId Number

Schedule id.

If null t= hen 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 
uuid String The UUID of the device (used in APIv3)
createTime Number Device creation time in seconds
address  String Hostname, IPv4 or IPv6
description  String Device description
managed Boolean Managed state
schedule  Object Device schedule
vendor  String Vendor
type  String Type
model  String Model
lastJobStatus String

Status of the last job.

P= ossible values: SUCCESSFUL, FAILED,

UNKNOWN (no job ran yet or unmana= ged)

connections Array Device connections
Success response
=20
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",
=09  "lastJobStatus":"SUCCESSFUL"
      "connections":[

      ]
   }
}
=20

Error 4xx

Name Type Description
timestamp  Number  Current timestamp
 code  Number 404
 error  String  HTTP code message
 message String   Error message
Error response
=20
HTTP/1.=
1 404 NOT FOUND
{
   "timestamp":1511880124270,
   "code":404,
   "error":"Not Found",
   "message":"Device not found"
}
=20


Devices - delete de= vice

Delete a single device from Unimus.

Method: DELETE

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

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
Success response
=20
HTTP/1.=
1 200 OK
{
   "data":{
      "success":"true"
   }
}
=20

Error 4xx

Name Type Description
timestamp  Number  Current timestamp
 code  Number 404
 error  String  HTTP code message
 message String   Error message
Error response
=20
HTTP/1.=
1 404 NOT FOUND
{
   "timestamp":1511884051726,
   "code":404,
   "error":"Not Found",
   "message":"Device with id 102 not found"
}
=20

 

 


Backups


Backups - get d= evice backups

Get a list of all device backups. Backups are ordered descending by crea= te time so the latest backup will always be at index 0 in the list. The lis= t can be empty if the device has no backup yet.

Method: GET

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

Parameter

Name Type Description
deviceId Number The ID of the device
pageIndex Number Page index (OPTIONAL)
pageSize Number Page size (OPTIONAL)

Success 200

Name Type Description
id Number The ID of the backup
validSince Number First time this configuratio= n retrieved from the device
validUntil Number Last time this configuration= retrieved from the device.
Will be null if the config= uration was retrieved only once
(only validSince will be se= t)
type String Backup type. Could be TEXT= or BINARY
bytes Array Backup as byte array
Success response
=20
HTTP/1.=
1 200 OK
{
   "data":[
      {
         "id":1,
         "validSince":1525117527,
         "validUntil":null,
         "type":"TEXT",
         "bytes":"IyBTaW11bGF0ZWQgTWlrcm9UaWsgUm91dGVyT1Mgc3lzdGVtCiMgc29md=
HdhcmUgaWQgPS"
      }
   ],
   "paginator":{
      "totalCount":1,
      "totalPages":1,
      "page":0,
      "size":20
   }
}
=20

Error 4xx

Name Type Description
timestamp  Number  Current timestamp
 code  Number 404
 error  String  HTTP code message
 message String   Error message
Error response
=20
HTTP/1.=
1 404 NOT FOUND
{
   "timestamp":1511886913012,
   "code":404,
   "error":"Not Found",
   "message":"Device with id 964 not found"
}
=20

 

Backups - = get device latest backup

Get device latest backup. Backup can be null if the device has no backup= s yet.

Method: GET

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

Parameter

Name Type Description
deviceId Number The ID of the device

Success 200

Name Type Description
id Number The ID of the backup
validSince Number First time this configuration retrieved from the= device
validUntil Number

Last time this configuration re= trieved from the device.
Will be null if the configuration was retr= ieved only once
(only validSince will be set)

type String Backup type. Could be TEXT or <= strong>BINARY
bytes Array Backup as byte array
Success response
=20
HTTP/1.=
1 200 OK
{
   "data":{
      "id":1,
      "validSince":1525117527,
      "validUntil":null,
      "type":"TEXT",
      "bytes":"IyBTaW11bGF0ZWQgTWlrcm9UaWsgUm91dGVyT1Mgc3lzdGVtCiMgc29mdHdh=
cmUgaWQgPSBub25"
   }
}
=20

Error 4xx

Name Type Description
timestamp  Number  Current timestamp
 code  Number 404
 error  String  HTTP code message
 message String   Error message
Error response
=20
HTTP/1.=
1 404 NOT FOUND
{
   "timestamp":1511889424942,
   "code":404,
   "error":"Not Found",
   "message":"Device with id 12 not found"
}
=20

 

Backups - get l= atest backups

Get a list of latest backup of devices with no particular order. Each ba= ckup is wrapped with device id and address.

Method: GET

=20
http://=
example.unimus/api/v2/devices/backups/latest?page=3D:pageIndex&size=3D:=
pageSize&id=3D:deviceIds
=20
CURL
=20
curl -H=
 "Accept: application/json" -H "Authorization: Bearer <token>" "http:=
//<example.unimus>/api/v2/devices/backups/latest?page=3D0&size=3D=
20&id=3D<deviceIds>"
=20

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 returne= d 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
Success response
=20
HTTP/1.=
1 200 OK
{
   "data":[
      {
         "deviceId":1,
         "address":"198.18.0.0",
         "backup":{
            "id":1,
            "validSince":1525117527,
            "validUntil":null,
            "type":"TEXT",
            "bytes":"IyBTaW11bGF0ZWQgTWlrcm9UaWsgUm91dGVyT1Mgc3lzdGVtCiMgc2=
9mdHdhcmUgaWQgPSBub25l"
         }
      }
   ],
   "paginator":{
      "totalCount":1,
      "totalPages":1,
      "page":0,
      "size":20
   }
}
=20

 

Backups - create= new backup

Create a new backup.

Method: POST

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

Parameter

Name Type Description
backup String

Backup content

(Base64 encoded)

type String

Possible values:

BINARY - for binary content

TEXT - for text content

Success 200

Name Type Description
success String

A messa= ge stating that the creation was successful

Success response
=20
HTTP/1.=
1 200 OK
{
   "data":{
      "success":"true"
   }
}
=20

Error 4xx

Name Type Description
timestamp Number  Current timestamp
code Number 404
error String HTTP code message
message String Error message
Error response
=20
HTTP/1.=
1 404 NOT FOUND
{
   "timestamp":1514894056726,
   "code":404,
   "error":"Not Found",
   "message":"Device with id 102 not found"
}
=20

 

 


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 returne= d with HTTP code 200.

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

Method: GET

=20
http://=
example.unimus/api/v2/devices/findByChangedBackup?page=3D:pageIndex&siz=
e=3D:pageSize&since=3D:since&until=3D:until
=20
CURL
=20
curl -H=
 "Accept: application/json" -H "Authorization: Bearer <token>" "http:=
//<example.unimus>/api/v2/devices/findByChangedBackup?page=3D0&si=
ze=3D20&since=3D100&until=3D200"
=20

Parameter

Name Type Description
pageIndex Number Page index (OPTIONAL)
pageSize Number Page size (OPTIONAL)
since Number Start of time range in seconds&nbs= p;(OPTIONAL) (DEFAULT =3D 0)
until Number End of time range in seconds = (OPTIONAL) (DEFAULT =3D time of the request)

 

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
vendor String Vendor
type String Type
model String Model
lastJobStatus String

Status of the last job.

P= ossible values: SUCCESSFUL, FAILED,

UNKNOWN (no job ran yet)
backups Array List of different device backups
Success response
=20
{
   "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",
=09=09 "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
            }
         ]
      }
   ],
   "paginator":{
      "totalCount":1,
      "totalPages":1,
      "page":0,
      "size":20
   }
}
=20

 

Diff - get diff

Get a difference between original and revised backup. Endpoint support m= aking difference between backups from different devices.

Method: GET

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

Parameter

Name Type Description
origId Number ID of the backup that will be cons= idered as original
revId Number ID of the backup that will be cons= idered as revised

Success 200

Name Type Description
origDeviceInfo Object Contains information about device = with original backup
revDeviceInfo Object Contains information about device = with revised backup
lineGroups Array

Contains array of group of line= s.

Every group has one of the following types: COMMON, CHANGED, INSER= TED, DELETED

 

Success response - complete JSON
=20
{
   "data":{
      "origDeviceInfo":{
         "id":1,
         "createTime":123456789,
         "address":"10.0.0.1",
         "description":"some dscr",
         "vendor":"MikroTik",
         "type":"RouterOS",
         "model":"mkt-model",
=09=09 "lastJobStatus":"SUCCESSFUL"
      },
      "revDeviceInfo":{
         "id":2,
         "createTime":123456789,
         "address":"10.1.1.1",
         "description":"another dscr",
         "vendor":"Cisco",
         "type":"IOS switch",
         "model":"cisco-model",
         "lastJobStatus":"FAILED"
      },
      "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":[

            ]
         }
      ]
   }
}
=20

 

 


Running tasks


Run job - discover= device

Trigger discovery job with all devices in the system. If u want to narro= w down devices included in job then specify their IDs in request parameter.=

Method: PATCH

=20
http://=
example.unimus/api/v2/jobs/discovery?id=3D:deviceIds
=20
CURL
=20
curl -H=
 "Accept: application/json" -H "Authorization: Bearer <token>" -X PAT=
CH "http://<example.unimus>/api/v2/jobs/discovery?id=3D<deviceIds&=
gt;"
=20

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

unManaged Number Number of un-managed devices
Success response
=20
HTTP/1.=
1 202 ACCEPTED
{
   "data":{
      "accepted":12,
      "refused":0,
      "unManaged":0
   }
}
=20

Error 4xx

Name Type Description
timestamp  Number  Current timestamp
 code  Number 404
 error  String  HTTP code message
 message String   Error message
Error response
=20
HTTP/1.=
1 403 NOT FOUND
{
   "timestamp":1511897481896,
   "code":404,
   "error":"Not Found",
   "message":"Devices not found [3]"
}
=20

 

Run = job - discover un-discovered devices

Trigger discovery job for all undiscovered devices.

Method: PATCH

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

Success 202

Name Type Description
accepted Number Number of started discoveries
refused Number Number of refused discoveries. Discovery or back= up currently running
unManaged Number Number of un-managed devices
Success response
=20
HTTP/1.=
1 202 ACCEPTED
{
   "data":{
      "accepted":12,
      "refused":0,
      "unManaged":0
   }
}
=20

 

Run job - backup dev= ice

Trigger backup job with all devices in the system. If u want to narrow d= own devices included in job then specify their IDs in request parameter.

Method: PATCH

=20
http://=
example.unimus/api/v2/jobs/backup?id=3D:deviceIds
=20
CURL
=20
curl -H=
 "Accept: application/json" -H "Authorization: Bearer <token>" -X PAT=
CH "http://<example.unimus>/api/v2/jobs/backup?id=3D<deviceIds>=
"
=20

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
sentForDiscovery Number Un-discovered devices sent for dis= covery
unManaged Number Number of un-managed devices=
Success response
=20
HTTP/1.=
1 202 ACCEPTED
{
   "data":{
      "accepted":0,
      "refused":2,
      "sentForDiscovery":0,
      "unManaged":0
   }
}
=20

Error 4xx

Name Type Description
timestamp  Number  Current timestamp
 code  Number 404
 error  String  HTTP code message
 message String   Error message
Error response
=20
HTTP/1.=
1 403 NOT FOUND
{
   "timestamp":1511899365179,
   "code":404,
   "error":"Not Found",
   "message":"Devices not found [16, 23, 15]"
}
=20

 

 

------=_Part_4201_1353841724.1711727294560--