Monitis API
Introduction
Monitis API provides most of actions, which are available from Monitis dashboard.
You can implement Monitis API via HTTP POST and GET requsts(find more info
here).
Java developers can use our .jar(download), which gives ability to interact with Monitis API server using Java objects.
Authentication and validation
For Monitis API calls you need apikey and secretkey (only for POST requests). You can get those keys either from Monitis dashboard or from a specific API call by providing userName and password
- 1. Log in to your Monitis account, go to Tools -> API -> API key
- 2. Make 2 requsest to get separately apikey and secretkey
All POST and GET requests to Monitis API should contain parameter named apikey, which value should be your Monitis API key.
All POST Requests should contain one of the following parameters checksum or authToken.
You can specify which one of those parameters to use via parameter named validation.
The default value for this parameter is HMACSHA1, which means that validation will be done via checksum.
Other possible value is token, which means that validation will be done via authToken.
Value for the checksum parameter should be the string constructed as follows:
- sort all request parameters alphabetically by param name
- join param-value pairs in a string: param1value1param2value2....
- get Base64-encoded RFC 2104-compliant HMAC signature of the constructed string using your secrect key
here
is Java example of calculating checksum
Value for the parameter authToken could be taken via GET request. Find more info
here).
Authentication token is valid during 24 hours after generation.
If it is not valid or expired, the POST request will generate error code,
and you have to recall authToken request to get new token.
Response format
Response format for all POST requests is JSON.
For GET requests, it is possible to specify response format by sending parameter named output.
Available options are: XML and JSON. By default JSON is used.
Parameters Encoding
All parameters both in GEt and POST requests should be encoded. Valid encoding is URL encoding with charset UTF8. E.g. in Java language a method used for url encoding is
java.net.URLEncoder.encode(String stringToEncode, String charset). See the doc.
In case the parameter has a certain format specified in the doc and has data delimiters such as ; or : then this kind of parameters should be double encoded to avoid mistakes
where data unit contains simbols equivalent to delimeter. Here is how double encoding is done.
E.g. the parameter results in action addResult has the following format paramName1:paramValue1[;paramName2:paramValue2...] .
Suppose you have function encode(stringToEncode). Double encoding will be done as below:
encode(encode( paramName1)+":"+encode(paramValue1)+";"+encode( paramName2)+":"+encode(paramValue2))
Each part of data (string between data separators - ; and :) is encoded separately then the whole string is encoded.