Equetronic API
Introduction
equetronic-api is a repo that handles the API of equetronic and the communication between the EHM device,
pusher, live priview, faundDB and syncing to the MySql database. It handles the required Authorization,
Endpoints and Request-Response JSON formats for the API.
Authorization
API Token is required to access the api.
In your API ajax request, pass Bearer token in header:
Authorization: 'Bearer [API_TOKEN]'API token is specific to each user and is found in the backend > users section.
Enpoints
/
Returns api version and alive status
None/db
Performs given operation on given collection
{
operation_type: 'create'|'insert'|'read'|'delete'|'insertOrCreate'
collection_name: String
}/initialize
This api is created to get initial data which is required to hit /api/hrc/send. It should be called only once.
{
horse_rfid: String, // required
latitude: String, // required
longitude: String, // required
}/send
Sends data to pusher and inserts to in the database in eq_ehm_data table.
{
"eq_training_record_id": "7",
"ehm_id": "234234",
"horse_rfid": "234234",
"horse_id": "2",
"horse_name": "test 2",
"race_course_id": "1",
"race_course_name": "Race Course, Dehradun",
"heart_rate": "2",
"step_counter": "23",
"speed": "23",
"latitude": "18.984738",
"longitude": "72.820001",
"battery_voltage": "0.01",
}/read
Reads and fetch a collection from Fauna DB
{
collection_name: "stage-data-r-234",
size: 100
}/delete-document
Deletes the given Fauna DB document from a given collection document_id refers to the id of ref object in the Fauna db document
{
"collection_name": "data-r-148",
document_id: "340146785131430473";
}/delete-collection
Deletes the given Fauna DB collection
{
"collection_name": "data-r-148",
}