You must have Python installed before you begin. If not, you can download the latest Python version from https://www.python.org/downloads/
If you are unsure about how to install Python or Python modules, please get an IT professional to assist as help with a Python installation is beyond the scope of this document.
The Monitor+ Python module requires Python version 3.5 (or later) to work at its best. Earlier Python versions will require two additional modules to be installed (they were included in later Python versions). We suggest that you check your installed Python version and upgrade as necessary using the link in the introduction section above.
We recommend that you add the Python module “Colorama” as it adds coloured text to the Python console. It can be downloaded from https://pypi.org/project/colorama/
If you need to use an earlier version of Python (prior to version 3.5), you may need to install two additional modules from the Python repository “pypi”.
These two modules are built into later versions of Python.
The modules are:
Module | Python Version | Description | Link |
---|---|---|---|
Requests | 3.5 | Easy http for Python | https://pypi.org/project/requests/ |
Typing | 3.62 | New standard library typing module | https://pypi.org/project/typing/ |
Click on the each link in the table above and follow the instructions on each web page to install the module.
You can access your API key using the top right menu on this page. When you logon, you will see your user name on the top right menu (see the red box in the image below). Click on this menu and select the 'My Account' menu. Then select the 'My API Key' menu on the left.
You can click on the symbol in the edit box above to display the API key. Click on the “Copy” link to copy the API key to the clipboard.
If you cannot login, please check your email as the login credentials should have been sent to you from an email account at 'sarus.com'. If you still have problems, please click the 'Support' option from the 'Contact us' menu at the top of this page.
When contacting us don't forget to send your contact details and, if you have a support question, please also send your User Reference Number, API key, Python version number, any relevant screenshots and a description of the issue.
The Python module can be downloaded by registered users by clicking on the Download button below. You will need your API key to authenticate the download. If you do not have your API key available, see the 'Locating your API key' section above for help.
Save the package in a location that is easily accessible to Python (see the 'Python Paths' section below).
Python needs to import these modules and so needs to be able to find them. It does this by checking a predefined search path. You can see the Python search path that using the command:
>>> import sys
>>> sys.path
Once the packages mentioned above have been installed you are ready to begin testing.
To begin you need to import and initilise the “idmmonitor” module, store your API key and get a session token from the remote API server. You will need to type five commands (in black text) below in the Python console to get a session token. In the example below, commands are in black text, comments in green and results from the server in blue.
# from class_source.idata_client import IData
>>> from idmmonitor import IData
# Initialise the class
>>> idata = IData()
# Turn on extra console information
>>>idata.setverbose(True)
# Store your API key in the module (replace XXXXX-XXXXX-XXXXX-XXXXX with your own API key)
>>> idata.set_api_key("XXXXX-XXXXX-XXXXX-XXXXX")
Stored the new API key XXXXX-XXXXX-XXXXX-XXXXX.
# Get a session token
>>> idata.get_session_token()
[INFO] Retrieving session token using: XXXXX-XXXXX-XXXXX-XXXXX
[INFO] API call to: http://api.sarus.com/GetSessionToken?APIKey= XXXXX-XXXXX-XXXXX-XXXXX
[INFO] Session token retrieved: 12ba9c13a8c9f270e71bb2526f0532ad
If you get an error after the line 'from idmmonitor import IData', it is likely that the module idmmonitor.py cannot be found by Python. See the 'Python Paths' section above.
If you get an error after the line “>>> idata.get_session_token()” then it is likely that your API key is invalid, or inactive. The server response in the blue text will help identify the issue. See the “Locating your API key” section above
If you still have a problem please look at the section 'Testing the connection in a browser' below.
If contacting us regarding either of these errors, please read the 'Contact Us' section above for details of the information that we need from you.
Once you have successfully entered the commands above you can use the commands below to further test access the server
# Check the session token remaining life
>idata.query_session_token()
[1] 1792000
# Get the server address the API is using
> idata.get_api_address()
The API server is set to https://api.sarus.com/
You can quickly check that the connection to the Monitor+ API server is working. Open your browser and enter the url https://api.sarus.com/ and press enter. Your browser should show a simple web page with one line of text similar to 'Monitor+ Web API Version: X.X'.
If you do not see this (or you see an error page), you may have a proxy or firewall issue that is blocking the connection. Please contact your IT colleagues and ask them to replicate the test above and so enable access to the Monitor+ API server for you.
You should also try to connect to the web site where the API help files are stored. Open your browser and enter the url https://www.sarus.com/api-docs/ and press enter. If you do not see the IDM web site, please contact your IT colleagues and ask them to replicate the test above. They should be able to quickly resolve the issue.
For any other problems or questions, please see the 'Contact Us' section above.