Getting Started

Overview

MeazureUp provides a simple set of apis to either work on the configuration or to fetch data. These apis can come handy in a few different situations - 

  • Getting data to create a custom report
  • Automating user management
  • Feed data into the data warehousing system

The apis can be used with different languages (java, c++ etc ), scripts (perl, python, shell etc ) and command line tools (cUrl).

Access to the apis are through a session which is created when the login api is called. 

The language or script used should be able to manage the session. In most cases, the http library should be able to handle the session behind the scenes without us worrying about it. The session ends when we call the logout api.

Examples

cUrl - 
# login
curl -H "Content-Type: application/json" 
	 -X POST
	 -c "cookies.txt" 
	 -d '{"u": "your@email.com", "p": "password"}' 
	 http://dailychex.meazureup.com/webapp/login/

# get all locations
curl -H "Content-Type: application/json" 
	-X GET 
	-b "cookies.txt"
	http://dailychex.meazureup.com/api-v2/locations/

# logout
curl -H "Content-Type: application/json" 
	-X GET 
	-b "cookies.txt"
	http://dailychex.meazureup.com/webapp/logout/
Python - 
import json
import requests

# ...
# login
session = requests.session()
response = session.post(
        "http://dailychex.meazureup.com/webapp/login/", 
	data=json.dumps({"u": "your@email.com", "p": "password"})
    )
json_data = response.json() #contains either success or error
# ... some error checks

# get all locations
response = session.get("http://dailychex.meazureup.com/api-v2/locations/")
locations = response.json() #contains all the locations that are accessible
# ... some error checks

# logout
response = session.get("http://dailychex.meazureup.com/webapp/logout/")

Calling logout at the end frees up the resources and eliminates any chances of session hijacking.

Still need help? Contact Us Contact Us