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.
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:
{
}
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:
{
}
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:
{
}
The HTTP status codes currently returned by the API are 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
CURL
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v1/health"
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, remove and update device. ERROR - Unimus require user interaction to solve the problem. All requests will be refused. |
HTTP/1.1 200 OK
{
}
Schedules
Schedules - get schedule
Get an individual schedule.
Method: GET
http://example.unimus/api/v1/schedules/:scheduleId
CURL
curl -H "Accept: application/json" -H "Authorization: Bearer <token>" "http://<example.unimus>/api/v1/schedules/<scheduleId>"
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 values: 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 |
HTTP/1.1 200 OK
{
}
Error 4xx
Name | Type | Description |
---|---|---|
timestamp | Number | Current timestamp |
code | Number | 404 |
error | String | HTTP code message |
message | String | Error message |
HTTP/1.1 404 NOT FOUND
{
}