You are on page 1of 11

API Documentation

API:
Please create an account first a rumytechnologies.com/rams
Contact manufacturer to get the secret auth_code for the account. This code is required during
any API request.

All API calls must be made using POST method to


https://rumytechnologies.com/rams/json_api. Please see the sample code section for more
detail.

Following https://rumytechnologies.com/rams/json_api operations are supported:

add_user
remove_user_from_device
delete_user_permanently
fetch_user_list
fetch_user_in_device_list
fetch_device_detail
fetch_unsent_log
fetch_log
set_user_registration_mode

Parameter Details:

operation Type of operation

username Unique username of the user to add/delete (for add_user &


remove_user_from_device)

signature Unique signature of the user which is to be added/removed/updated (for


add_user)

device_id ID of the device which the user is added to or removed from (for add_user
& remove_user_from_device)

device_name Not Used


auth_user Username of your client account
API Documentation
auth_code Contact the device manufacturer to get yours
start_date Date since which user logs to be obtained, format: YYYY-mm-dd (fetch_log)
end_date Date until which user logs to be obtained, format: YYYY-mm-dd (fetch_log)
access_id Unique access log ID till that user logs already obtained, format:
777333(fetch_log)
API Documentation
:example

1. {
"operation":"add_user",
"auth_user":"John_Smith",
"signature_type":"card",
"auth_code":"xxxxxxxxxxxxxxxx",
"username":"asasde",
"signature":"23c334",
"device_id":["EM111111","EM101010"]
}

2. {
"operation":"remove_user_from_device",
"auth_user":"John_Smith",
"auth_code":"xxxxxxxxxxxxxxxx",
"username": "asasde",
"device_id": "EM1474150"
}

3. {
"operation":"delete_permanently",
"auth_user":"John_Smith",
"auth_code":"xxxxxxxxxxxxxxxx",
"username": "asasde",
}

4. {
"operation":"fetch_user_list",
"auth_user":"John_Smith",
"auth_code":"xxxxxxxxxxxxxxxx",
}

5. {
"operation":"fetch_user_in_device_list",
"auth_user":"John_Smith",
"auth_code":"xxxxxxxxxxxxxxxx",
}

6. {
API Documentation
"operation":"fetch_device_detail",
"auth_user":"John_Smith",
"auth_code":"xxxxxxxxxxxxxxxx",
}

7. {
"operation":"fetch_unsent_log",
"auth_code":"xxxxxxxxxxxxxxxx"
}

8. {
"operation":"fetch_log",
"auth_user":"John_Smith",
"auth_code":"xxxxxxxxxxxxxxxx",
"start_date":"2018-01-13",
"end_date":"2018-01-29",
"start_time":"5:49:09",
"end_time":"5:49:09",
"access_id":"11301000"
}

9. {
"operation":"set_user_registration_mode",
"auth_user":"John_Smith",
"auth_code":"xxxxxxxxxxxxxxxx",
"device_id”: “FPxxxxxx”
}

Return

1. add_user
○ User Successfully Registered > User has been added and sent to device.
○ Please select your device > Device is not registered or device id not found.
○ Card No already exists > Card no exists
○ User Successfully Updated > User signature has been updated to the new one.
API Documentation
○ Device Type mismatch with signature or invalid signature > Error in user
signature or the signature doesn’t match the device type. Please check the
signature length.
○ Registration No already exists > User name already exists.
2. remove_user_from_device
○ Successfully removed from device > The user has been removed successfully
from the device.
○ Error finding user in device > Please check username and/or device id.
3. delete_permanently
○ User Successfully Deleted > User has been deleted.
○ Failed to delete > Please check username and/or device id.
4. fetch_user_list
○ Roll No, RFID Card no, Mifare card no, fingerprint (type - list).
○ (
(4049, None, u'xxxxxxxx', None),
(4051, u’xxxxxx’, None, None)
)
○ Example show how the signature of two users are returned.
5. fetch_user_in_device_list
○ Username, Device id
○ (
(4377, u'EMxxxxxxx’),
(4378, u'Emxxxxxxx’)
)
○ Example shows how the device id of all the users are returned (type - list).
6. fetch_device_detail
○ Returns a list of all registered devices with device id,device name, last connected
date & time
○ (
(u'EMxxxxxxx’,u’Device Name’,u’2018-01-01 11:00:00’),
(u'EMxxxxxxx’,u’Device Name’,u’2018-01-01 11:00:00’)
)
○ Example shows how the devices registered to the user are returned (type - list).
API Documentation

7. fetch_unsent_log/fetch_log
○ Device Name, Username, Access time, Access date, Name, Signature,Access id
○ {
"log": [
{
"unit_name": "RFID DEVICE 2",
○ "unit_id": "DS330002",
"registration_id": "xxxxxxx",
"access_time": "6:01:41",
"access_date": "2017-11-01",
"user_name": "John Doe",
"card": "None",
○ "access_id":"6639915"
},
{
"unit_name": "RFID DEVICE 2",
"unit_id": "DS330002",
"registration_id": "xxxxxxxx",
"access_time": "6:17:29",
"access_date": "2017-11-01",
"user_name": " Jane Doe",
"card": "None",
"access_id":"6639916"
}]}
○ Example shows how the logs are returned (type - dictionary)
8. set_user_registration_mode
○ Success > Device successfully sent to user registration mode.
○ Failed > Error in format
API Documentation

Sample Codes:

Python:
import requests
url = "https://rumytechnologies.com/rams/json_api"
data = {
"operation":"fetch_log",
"auth_user":"Account_Name",
"auth_code":"xxxxxxxxxxxxxxxxxxxxxxxxxx",
"start_date":"2018-01-13",
"end_date":"2018-01-29",
"start_time":"5:49:09",
"end_time":"5:49:09"
}

post = requests.post(url, json=data)


API Documentation
PHP:
<?php
$data = array("operation" => "fetch_log","auth_user" => "xyz","auth_code"
=> "xxxxxxxxxxxxxxxxxx","start_date" => "2018-10-21","end_date" =>
"2018-10-22","start_time" => "08:49:09",
"end_time" => "15:49:09");

$datapayload = json_encode($data);
$api_request = curl_init('https://rumytechnologies.com/rams/json_api');
curl_setopt($api_request, CURLOPT_RETURNTRANSFER, true);
curl_setopt($api_request, CURLINFO_HEADER_OUT, true);
curl_setopt($api_request, CURLOPT_POST, true);
curl_setopt($api_request, CURLOPT_POSTFIELDS, $datapayload);
curl_setopt($api_request, CURLOPT_HTTPHEADER, array('Content-Type:
application/json','Content-Length: ' . strlen($datapayload)));
$result = curl_exec($api_request);
$replace_syntax = str_replace('{"log":',"",$result);
print_r($replace_syntax);
?>
<html>
<body>
<?php echo $replace_syntax; ?>
</body>
</html>

Live access log:

One can use the following instruction to create a front page that will display a user’s information,
as soon as the user scans his finger or card. Please note that the devices are set to send data
when idle for a minute by default. If live data is needed, “Live Data” option must be turned on
from device detail page. You can go to device detail page by clicking on the desired device ID
from the home page.
API Documentation
1. Download and unzip the file (https://rumytechnologies.com/rams/static/stellar.zip).
Alternatively use the following links.
○ https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
○ https://rumytechnologies.com/rams/static/js/paho-mqtt-min.js
○ https://rumytechnologies.com/rams/static/js/stellar.min.js
2. Make sure that jquery is already included in your page.
3. Include the mqttws31.min.js right below the jquery. E.g.
<script src="js/paho-mqtt-min.js"/>
4. Include the stellar.js below the mqttws31.min.js.
<script src="js/stellar.min.js"/>
5. With everything included, your page should look similar to the following:
<script src="js/jquery.min.js"/>
<script src="js/paho-mqtt-min.js"/>
<script src="js/stellar.min.js"/>
6. Finally add the following code segment to start receiving accesslog (remember to
replace #html_element_id with the id or class of the html element where you want to
show the access log. Also replace example_client_id with your client login id.
<script>
var operation = “accessLog”;
var html_id = "#html_element_id";
var client_id = "example_client_id";
stellar_mqtt(operation, html_id, client_id);
</script>

Demo HTML page for live access log:


<!doctype html>
<html>
<head>

</head>
<body>
API Documentation
<!-- When new message arrives, it will be inserted into the
HTML element with
id "user_signature". Example use case, HTML form field
with id "user_signature" -->
<div id="user_signature"></div>

<!-- StartInclude - If jQuery is not already available in you


page.
If jQuery is already available, please delete this
segment -->
<script src="js/jquery.min.js"></script>
<!-- EndInclude -->

<!-- The following scripts establishes the connection, don't


remove it -->
<script src="js/paho-mqtt-min.js"/>
<script src="js/stellar.min.js"/>

<!-- Configuration -->


<script>
var operation = “accessLog”;
var html_id = "#user_signature";
var client _id = "reza";
stellar_mqtt(operation, html_id, client_id);
</script>
</body>
</html>
API Documentation
Signature from user_registration_mode:
1. Follow steps 1-5 from above. On the 6th step, replace the var operation = “accessLog”;
with var operation = “template”;.

<script>
var operation = “template”;
var html_id = "#html_element_id";
var client_id = "example_client_id";
stellar_mqtt(operation, html_id, client_id);
</script>

You might also like