Start Exploring Monitis API with cURL

Monitis is a powerful one-stop monitoring shop for systems and web administrators. It is fully hosted, so setup and usage are far easier than with traditional software solutions. In addition to website and server monitoring, Monitis is a monitoring platform that allows users to build their own monitoring applications, to monitor anything. This is done using the Monitis API. The API lets users extend, automate, and integrate the monitoring and notification platform as they wish, and also create and manage accounts and account privileges. This makes Monitis a very practical solution for MSPs (managed service providers) and IT support companies.

Monitis REST API

Monitis provides a powerful API (Application Programming Interface) for extending basic functionality and integrating with other tools. Developers and sysadmins can use command shell scripts or programming languages to enhance the system.  They can also manage their accounts and privileges, add and remove server monitoring, retrieve monitoring results, and even create custom monitoring process. In this article we provide some external server monitoring use case scenarios using the popular command line tool cURL. The API is built on the HTTP REST protocol, so cURL lets users do all the API calls and build even create sophisticated scripts.

The following parameters are needed for API calls:

  • apikey, secretkey – api keys, which you can get from within your Monitis account (Tools->API->API Key) . apikey is your identification key and cannot be changed,    secretkey is similar to password can be reset if needed.
  • action – action to perform
  • timestamp – current date/time in GMT with yyyy-MM-dd HH:mm:ss format
  • validation – type of validation. In our examples we will use ‘token’ fixed value for authToken validation.
  • authToken – a session authentication token, generated by Monitis. Token is valid until 24 hours after generation.
  • version – API version (2 for current version)

What is cURL?

A command line tool for getting or sending files using URL syntax. cURL uses libcurl, a free, portable, client-side URL transfer library that builds and works identically on several platforms (including Solaris, NetBSD, FreeBSD, OpenBSD, HPUX, IRIX, AIX, Tru64, Linux, UnixWare, Windows, etc.). cURL supports FTP, FTPS, Gopher, HTTP, HTTPS, SCP, TFTP, TELNET, DICT, FILE, LDAP, LDAPS, IMAP, POP3, SMTP, and RSTP protocols. cURL also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading, kerberos, HTTP form based upload, proxies, cookies, user and password identification, file transfer resume, and http proxy tunneling.

To retrieve a web page, just type:   curl

Basic use cases

Session initialization

Before your can use the API you need to get a user key and temporary AuthToken for usage within 24 hours.

Get the AuthToken using the following cURL command:

curl '[Your API key]&secretkey=[D86AOEP8MC7A896L945KHBNYKF]'


curl ' apikey=2KFGBIUO2HCFC24II109P39E3G& secretkey=4HM0CPPCTSJAHQMMFJTGSQRQG9'

Example response:


Now you can use the authToken in the remaining operations, just keep in mind that it is valid for 24 hours and you may need to get another authToken afterwards.

Now let consider some basic tasks you can perform using the cURL command line tool. Click here for a detailed list of Monitis cURL API examples.

User Management

Add Sub Account

You can add new users to the same account and define user access privileges. New user can be added via the add sub account method. Format:

curl '' --data 'apikey=[Your API key]&validation=token&authToken=[Your auth token]&timestamp=[Current timestamp]&action=addSubAccount&firstName=[John]&lastName=[Smith]& email=[]&password=[pass4js]&group=[test_group]'


curl '' --data 'apikey=2KFGBIUO2HCFC24II109P39E3G&validation=token& authToken=1JP2U03EVV5FNEKGFVDD4OVOA9&timestamp=2011-05-23 20:15:14&action=addSubAccount&firstName=John&lastName=Smith&'

Example response:



You can change dashboard layout and add new pages also using API calls.

Add Page to Monitoring Dashboard

Here we add a new page to a monitoring dashboard, so next time you open the dashboard you can see a new tab added. Use the following cURL format:

curl '' --data 'apikey=[Your API key]&validation=token&authToken=[Your auth token]&timestamp=[Current timestamp]&action=addPage&title=[New Page]&columnCount=[2]'


curl '' --data 'apikey=2KFGBIUO2HCFC24II109P39E3G&validation=token& authToken=1JP2U03EVV5FNEKGFVDD4OVOA9&timestamp=2011-05-23 20:15:14&action=addPage&title=New Page&columnCount=2'

Example response:


Notification Contacts

Monitis sends web server failure alert notifications to contacts or groups of contacts. Users may add, edit, delete, activate contacts via the API.

Add Alert Notification Contact


curl '' --data 'apikey=[Your API key]&validation=token&authToken=[Your auth token]&timestamp=[Current timestamp]&action=addContact&group=[customers]&firstName=[John]&l astName=[Smith]&account=[8006577949]&contactType=[2]& timezone=[-300]&sendDailyReport=[true]&sendWeeklyReport=[true]& sendMonthlyReport=[true]&portable=[true]&country=[US]&textType=[true]'


curl '' --data 'apikey=2KFGBIUO2HCFC24II109P39E3G&validation=token& authToken=1JP2U03EVV5FNEKGFVDD4OVOA9&timestamp=2011-05-23 20:15:14&action=addContact&group=customers&firstName=John&l astName=Smith&account=8006577949&contactType=2& timezone=-300&sendDailyReport=true&sendWeeklyReport=true& sendMonthlyReport=true&portable=true&country=US&textType=true'

Example response:


Get Recent Failure Alerts


curl '[Your API key]&action=recentAlerts&timezone=[180]&startDate=[startDate]& endDate=[endDate]&limit=[20]'


curl ' action=recentAlerts&timezone=180&startDate=2011-01-01&endDate=2012-01-01&limit=20'

Example response:

"dataType":"External Monitor",
"recDate":"8 May 2011 07:09:59 GMT",
"failDate":"8 May 2011 07:04:58 GMT",

External Server Monitors

We will consider here an example of external website uptime and responce time monitoring, although similar scenario can be done for server health, network and other types of monitoring. Sysadmins can add/remove/edit server uptime monitors and also get get website performance results using the Monitis API. Let’s consider examples of adding and getting server response and page load time from global checkpoints.

Add External Server Uptime Monitor


curl '' --data 'apikey=[Your API key]&validation=token&authToken=[Your auth token]&timestamp=[Current timestamp]&version=2&action=addExternalMonitor&type=[http]& name=[monitis.com_http]&tag=[]&url=[]&l ocationIds=[1,4]&interval=[5]&timeout=[100000]&overSSL=[false]& detailedTestType=[1]&contentMatchFlag=[1]&contentMatchString=[Easy-to-use Monitoring as a Service]>'


curl '' --data 'apikey=2KFGBIUO2HCFC24II109P39E3G&validation=token& authToken=1JP2U03EVV5FNEKGFVDD4OVOA9&timestamp=2011-05-23 20:15:14&action=addExternalMonitor&type=http&name=monitis.com_http& timeout=100000&overSSL=false&detailedTestType=1& contentMatchFlag=1&contentMatchString=Easy-to-use Monitoring as a Service>'

Example response:

{"status":"ok","data":{"startDate":"2011-05-23 20:53","testId":54935,"isTestNew":"1"}}

Suspend Uptime Monitoring


curl '' --data 'apikey=[Your API key]&validation=token&authToken=[Your auth token]&timestamp=[Current timestamp]&action=suspendExternalMonitor&tag=[tag]'


curl '' --data 'apikey=2KFGBIUO2HCFC24II109P39E3G&validation=token& authToken=1JP2U03EVV5FNEKGFVDD4OVOA9&timestamp=2011-05-23 20:15:14&action=suspendExternalMonitor&'

Example response:


Get Uptime Monitoring Info

Users can get settings for a server monitor using the following command:

curl '[Your API key]&action=testinfo&testId=[4596]'


curl  ' action=testinfo&testId=54935'

Example response:

"startDate":"2011-05-23 17:53",
"locations":[{"id":1,"name":"US-MID", "checkInterval":5,"fullName":"US-MID"}],
"matchText":"Easy-to-use Monitoring as a Service>",

It will return the current URL test settings for the selected monitor. E.g. here it shows we are monitoring url from US-MID monitoring location, using GET methods, at 5 min interval and also checking a for certain text on the page.

Get Server Performance Data


curl '[Your API key]&action=testresult&testId=[4896]& day=[12]&month=[10]&year=[2010]&locationIds=[1,4]&timezone=[360]'


curl ' action=testresult&testId=[4896]&day=[12]&month=[10]&year=[2010]&locationIds=[1,4]&timezone=[360]'

Example response:

       ["2010-03-16 00:00",115.0,"OK"],
       ["2010-03-16 00:01",117.0,"OK"],
       . . .
       ["2010-03-16 23:58",0.0,"NOK"],
       ["2010-03-16 23:59",146.0,"OK"]
       ["Connection lasted more than 10 seconds.",1]

The result JSON object shows monitoring location, min and max performance values, number of OK results, number of failures (NOK). In the data section it should show measurements for each data-time stamp.

You might also like