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

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

 

Overview

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. Also every request has to include Authorization header following Bearer scheme as shown below.

Authorization: Bearer <token>

Authorization: Bearer <token>

 

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

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

{

"data": {
"some key": "some value",
"another key": "another value"
}

}

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":  [
  {
"some key": "some value",
"another key": "another value"
},
{
"some key": "some value",
"another key": "another value"
}
 ],
"paginator": {
"totalCount": 12,
"totalPages": 6,
"page": 0,
"size": 2
}

}

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

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 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. 

 

  • No labels