Skip to content

REST API Documentation

Digvijay Singh edited this page Apr 6, 2015 · 9 revisions
  1. All queries are made using sending GET HTTPS requests to the server on ip=192.168.1.40 and port 9119 (i.e. https://192.168.1.40:9119)
  2. Each call has to pass a token, verifying the user. (i.e. has a GET argument : &token=<token>)
  3. To get a token you need to call: /auth?username=<username>&password=<password> the only query made without a token.
  4. The following APIs are supported as of 06/04/14:
    1. Getting UID for a specific mac (url: /uid)
      • GET Parameters to pass: mac
      • Note that mac address has to be colon separated, and any leading 0s in each octet should be omitted.
    2. Getting information for a specific client or specific access point (url: /ap or /client)
      • To make client requests use /client URL and to make ap requests use /ap url.
      • For both data can be accessed using "last" or "standard-from-to" type queries.
      • Last: Make query with uid, and a number n,which will return the last n logs in the database. GET Parameters: uid=<uid>&last=<n>
      • From/To: Make a query with specified date and time. You have to specify a format which will be used to convert the date and time. GET Parameters: uid=&from=2014-01-02-23:10:10&to=2014-01-02-23:10:15&format=yyyy-mm-dd-hh24:mi:ss
    3. Getting count information (url: /count)
      • Between two time periods (arguments that need to be passed: from, to, format)
      • At a specific point in time (arguments that need to be passed: at, format, type)
      • from, to and format are similar to above. type is used to aggregate data according to building,floor, wing and room. In type the first characters (in lowercase) should be passed for building, floor , wing and room. Additionaly, the character "u" can be passed to know the Universal IDs(uids) of the devices connected in that location, aggregated on the basis of the earlier parameters. Example: if you want to aggregate data according to building and floor, then pass type=bf
    4. Sudo API (url: /su/get or su/put)
      • This is a privileged API which allows the user to "get" devices' uids by email or rollno (arguments to pass: rollno ) Note that even though it is named rollno, you may pass an email_id also (email is in beta).
      • Also it allows you to change the access level of a uid. Currently only two acess levels are allowed 0 and 1. 1 allows all information to pass through client APIs. 0 allows none. (arguments that need to be passed: uid, access)
    5. Getting label information (url: /label/get)
      • This API allows one to know the AP uid to location mapping in terms of the building,floor,wing,room. To use this API, no extra arguments need to be passed.

Examples: Here is a standard way to use the api: https://192.168.1.40:9119/auth\?username=test&password=test

https://192.168.1.40:9119/uid?mac= <mac> &token= <token from last query>

https://192.168.1.40:9119/client?uid= <uid from last query> &last=10&token= <token>

OR

https://192.168.1.40:9119/client?uid= <uid from last query> &from=2014-05-01-01:01:01&to=2014-07-01-01:01:01&format=yyyy-mm-dd-hh24:mi:ss&token= <token>

https://192.168.1.40:9119/count?at= <timestamp> &format= <format> &type=[bfwr]&token= <token>

Clone this wiki locally