HTTP calls can be simply used as described in the above flow:
1.Gateways
Managing multiple gateways
1.1.addGateway
enURL
https://api.mindolife.com/API/Session/addGateway
Input Parameters
String licenseKey;
String gatewayName;
String sessionKey /*(null if this is the first gateway)*/
Output
{"key" : "xxx"}
1.2.updateGateway
URL
https://api.mindolife.com/API/Session/updateGateway
Input Parameters
String sessionKey;
int gatewayId;
String gatewayName;
Output
{"status":true}
Error Output/s
{"error": {"id": 3006,"data": "xxxx" }}
1.3.deleteGateway
URL
https://api.mindolife.com/API/Session/deleteGateway
Input Parameters
int gatewayId;
String sessionKey;
Output
{"status":true}
1.4.getGateways
URL
https://api.mindolife.com/API/Session/getGateways
Input Parameters
String sessionKey;
Output
{"gateways":{"count":"3","gateway":[{"gatewayName":"55","gatewayId":"3409","timeOnGateway":"0","demoSessionExpiration":"120","isDemo":"true"},{"gatewayName":"qa","gatewayId":"3387","timeOnGateway":"0","demoSessionExpiration":"120","isDemo":"true"},{"gatewayName":"qa","gatewayId":"3388","timeOnGateway":"0","demoSessionExpiration":"120","isDemo":"true"}]}}
1.5.bindGateway
URL
https://api.mindolife.com/API/Session/bindGateway
Input Parameters
int gatewayId;
String sessionKey;
Output
{"status":true}
1.6.unbindGateway
URL
https://api.mindolife.com/API/Session/unbindGateway
Input Parameters
String sessionKey;
Output
{"status":true}
2.Login
Login/Logout to user’s gateways
2.1.login
URL
https://api.mindolife.com/API/Gateway/login
Input Parameters
String username;
String password;
boolean keepMeLoggedIn;
String sessionKey;
Output
{"status":true}
Error Output/s
{"error": {"id": 5003,"data": "xxxx" }}
{"error": {"id": 5002,"data": "xxxx" }}
{"error": {"id": 5001,"data": "xxxx" }}
{"error": {"id": 1000,"data": "xxxx" }}
2.2.logout
URL
https://api.mindolife.com/API/Gateway/logout
Input Parameters
String sessionKey;
Output
{"status":true}
Error Output/s
{"error": {"id": 5001,"data": "xxxx" }}
{"error": {"id": 1000,"data": "xxxx" }}
2.3.isLoggedIn
URL
https://api.mindolife.com/API/Gateway/isLoggedIn
Input Parameters
String sessionKey;
Output
{"isLoggedIn":true,"loggedInUser":{"username":"admin","lastLogin":0,"userId":41,"role":"Administrator","displayName":"admin"}}
Error Output/s
{"error": {"id": 5001,"data": "xxxx" }}
{"error": {"id": 1000,"data": "xxxx" }}
3.Devices
Managing and controlling devices
3.1.addDevice
URL
https://api.mindolife.com/API/Gateway/addDevice
Input Parameters
String licenseKey;
String name;
String sessionKey;
Output
{"DevicesContainerUnits":{"DevicesContainerUnit":[{"Sensor":[{"id":461,"signalStrength":196,"connectivityRate":"ok","protocol":"RF","lastLifeSign":0,"tag":[],"name":"My Sensor","state":0,"action":[]}]}]}}
Error Output/s
{"error": {"id": 1,"data": "xxxx" }}
3.2.updateControl
URL
https://api.mindolife.com/API/Gateway/updateControl
Input Parameters
String id /* device id*/;
String name /*device new name*/,String sessionKey;
Output
{"status":true}
Error Output/s
{"error": {"id": 1,"data": "xxxx" }}
3.3.removeControl
URL
https://api.mindolife.com/API/Gateway/removeControl
Input Parameters
String removeControlPassword;
String ids /*can contain one or more devices ids*/;
String sessionKey;
Output
{"status":true}
Error Output/s
{"error": {"id": 1,"data": "xxxx" }}
3.4.getDevices
URL
https://api.mindolife.com/API/Gateway/getDevices
Input Parameters
String sessionKey;
Output
Error Output/s
3.5.changeControlState
URL
https://api.mindolife.com/API/Gateway/changeControlState
Input Parameters
int id /* (device id)*/;
int state;
String data;
String sessionKey;
String reqID;
Output
{"status":true}
Error Output/s
{"error": {"id": 3,"data": "xxxx" }}
3.6.doCalibration
URL
https://api.mindolife.com/API/Gateway/doCalibration
Input Parameters
int id;
String action /*values [start/end]*/;
String sessionKey;
String reqID;
Output
{"status":true}
Error Output/s
{"error": {"id": 3,"data": "xxxx" }}
3.7.changeControlConfig
URL
https://api.mindolife.com/API/Gateway/changeControlConfig
Input Parameters
int id /*(device id)*/;
String config /*config message to be sent to the device*/;
String sessionKey;
Output
{"status":true}
Error Output/s
{"error": {"id": 3,"data": "xxxx" }}
4.Policy
Managing rules policies for system automation
4.1.addPolicy
Days of week : 1,2,3,4,5,6,7
Year : yyyy if need to set a specific year, * for any or don’t write this property
month : mm is needed to set a specific month, * for any or don’t write this property
day : dd is needed to set a specific day of month (1-31), * for any or don’t write this property
hour: hh is needed to set a specific hour of day, * for any or don’t write this property
minute: is needed to set a specific minute in hour, this is mandatory for any pattern
URL
https://api.mindolife.com/API/Gateway/addPolicy
Input Parameters
String name;
int groupID;
boolean isExecuted;
boolean isOneTime;
boolean status;
String extendedDetails extended explaination/*Valida XML*/;
Enum type;
String sessionKey;
Output
{"policies":{"policy":[{"id":698,"groupID":"","isOneTime":false,"details":{"when":[{"condition":{"minute":"39","conditionType":"time","month":"","year":"","day":"","hour":"1","daysOfWeek":""}}],"do":[{"action":{"after":"-1","changeTo":"{"command":"sendMsg","msg":"new","id":[]}","changeBackTo":"","actionType":"command","deviceId":"457"}}]},"status":true,"isExecuted":false,"name":"New Name","type":"Regular"}]}}
Error Output/s
{"error": {"id": 5,"data": "xxxx" }}
4.2.updatePolicy
URL
https://api.mindolife.com/API/Gateway/updatePolicy
Input Parameters
int id;
String name;
boolean status;
int groupID;
boolean isExecuted;
boolean isOneTime;
String extendedDetails extended explaination/*Valida XML*/;
Enum type;
String sessionKey;
Output
{"status":true}
Error Output/s
{"error": {"id": 7,"data": "xxxx" }}
4.3.removePolicy
URL
https://api.mindolife.com/API/Gateway/removePolicy
Input Parameters
int id;
String sessionKey;
Output
{"status":true}
Error Output/s
{"error": {"id": 5,"data": "xxxx" }}
4.4.getPolicies
URL
https://api.mindolife.com/API/Gateway/getPolicies
Input Parameters
String sessionKey;
Output
{"policies":{"policy":[{"id":695,"groupID":"","isOneTime":false,"details":{"when":[{"condition":{"minute":"11","conditionType":"time","month":"","year":"","day":"","hour":"11","daysOfWeek":""}}],"do":[]},"status":true,"isExecuted":false,"name":"New Name","type":"Regular"}]}}
Error Output/s
{"error": {"id": 8,"data": "xxxx" }}
4.5.doPolicy
URL
https://api.mindolife.com/API/Gateway/doPolicy
Input Parameters
int id;
String sessionKey;
String reqID;
Output
{"status":true}
Error Output/s
{"error": {"id": 5,"data": "xxxx" }}
5.Groups
Grouping Objects to groups
5.1.addGroup
URL
https://api.mindolife.com/API/Gateway/addGroup
Input Parameters
String name;
Enum type /*values [Regular, Room, Administrative]*/;
JsonArray devices extended explaination/*json array [{``id11 : 1, ``description`` : ``...``}, ...]*/;
String description;
String sessionKey;
Output
{"response":"{"id":1,"description":"","name":"New Group","devices":[{"id":"449","description":""}],"type":0,"isEnabled":true}"}
Error Output/s
{"error": {"id": 9002,"data": "xxxx" }}
5.2.updateGroup
URL
https://api.mindolife.com/API/Gateway/updateGroup
Input Parameters
int id;
String name;
Enum type;
String description;
String sessionKey;
Output
{"status":true}
Error Output/s
{"error": {"id": 9002,"data": "xxxx" }}
5.3.removeGroup
URL
https://api.mindolife.com/API/Gateway/removeGroup
Input Parameters
String id;
String sessionKey;
Output
{"status":true}
Error Output/s
{"error": {"id": 9002,"data": "xxxx" }}
5.4.getGroups
URL
https://api.mindolife.com/API/Gateway/getGroups
Input Parameters
String sessionKey;
Output
{"groups":[{"id":1,"description":"","name":"New Group","type":0,"devices":[{"id":"449","description":""},{"id":"450","description":""}],"isEnabled":true}]}
Error Output/s
{"error": {"id": 9001,"data": "xxxx" }}
5.5.addGroupDevice
URL
https://api.mindolife.com/API/Gateway/addGroupDevice
Input Parameters
String groupId;
int deviceId;
String description;
String sessionKey;
Output
{"status":true}
Error Output/s
{"error": {"id": 9002,"data": "xxxx" }}
5.6.removeGroupDevice
URL
https://api.mindolife.com/API/Gateway/removeGroupDevice
Input Parameters
int groupId;
int deviceId;
int sessionKey;
Output
{"status":true}
Error Output/s
{"error": {"id": 9002,"data": "xxxx" }}
6.Users
Managing Users, Roles and permissions
6.1.addUser
once,
a lower case letter must occur at least once,
an upper case letter must occur at least once,
a special character must occur at least once,
no whitespace allowed,
at least 8 characters
URL
https://api.mindolife.com/API/Gateway/addUser
Input Parameters
String displayName;
String username;
String password;
Enum role/* Administrator, Regular, Visitor, Child, Installer */;
String sessionKey;
Output
{"users":{"user":[{"username":"rawhi","lastLogin":0,"userId":46,"role":"Administrator","displayName":"rawhi"}]}}
Error Output/s
{"error": {"id": 6004,"data": "xxxx" }}
{"error": {"id": 6003,"data": "xxxx" }}
{"error": {"id": 6005,"data": "xxxx" }}
{"error": {"id": 0,"data": "xxxx" }}
6.2.changeDisplayName
URL
https://api.mindolife.com/API/Gateway/changeDisplayName
Input Parameters
int userId;
String newDisplayName;
String sessionKey;
Output
{"status":true}
Error Output/s
{"error": {"id": 6004,"data": "xxxx" }}
{"error": {"id": 6001,"data": "xxxx" }}
{"error": {"id": 0,"data": "xxxx" }}
6.3.changePassword
URL
https://api.mindolife.com/API/Gateway/changePassword
Input Parameters
int userId;
String oldPassword;
String newPassword;
String sessionKey;
Output
{"status":true}
Error Output/s
{"error": {"id": 6001,"data": "xxxx" }}
{"error": {"id": 6004,"data": "xxxx" }}
{"error": {"id": 6002,"data": "xxxx" }}
{"error": {"id": 2003,"data": "xxxx" }}
{"error": {"id": 0,"data": "xxxx" }}
6.4.changeRole
URL
https://api.mindolife.com/API/Gateway/changeRole
Input Parameters
int userId;
Enum role;
String sessionKey;
Output
{"status":true}
Error Output/s
{"error": {"id": 6004,"data": "xxxx" }}
{"error": {"id": 6001,"data": "xxxx" }}
{"error": {"id": 0,"data": "xxxx" }}
6.5.removeUser
URL
https://api.mindolife.com/API/Gateway/removeUser
Input Parameters
int userId;
String sessionKey;
Output
{"status":true}
Error Output/s
{"error": {"id": 6004,"data": "xxxx" }}
{"error": {"id": 6001,"data": "xxxx" }}
{"error": {"id": 0,"data": "xxxx" }}
6.6.getUsers
URL
https://api.mindolife.com/API/Gateway/getUsers
Input Parameters
String sessionKey;
Output
{"users":{"user":[{"username":"admin","lastLogin":0,"userId":41,"role":"Administrator","displayName":"admin"}]}}
Error Output/s
{"error": {"id": 0,"data": "xxxx" }}
7.Settings
Managing system settings
7.1.getDate
URL
https://api.mindolife.com/API/Gateway/getDate
Input Parameters
String sessionKey;
Output
{"status":true}
Error Output/s
{"error": {"id": 11002,"data": "xxxx" }}
7.2.setDate
URL
https://api.mindolife.com/API/Gateway/setDate
Input Parameters
String date /*date format 2017-07-11*/,String sessionKey
Output
{"status":true}
Error Output/s
{"error": {"id": 11001,"data": "xxxx" }}
7.3.getTime
URL
https://api.mindolife.com/API/Gateway/getTime
Input Parameters
String sessionKey;
Output
{"status":true}
Error Output/s
{"error": {"id": 11004,"data": "xxxx" }}
7.4.setTime
URL
https://api.mindolife.com/API/Gateway/setTime
Input Parameters
time, sessionKey
Output
{"status":true}
Error Output/s
{"error": {"id": 11003,"data": "xxxx" }}
7.5.getAvailableTimezones
URL
https://api.mindolife.com/API/Gateway/getAvailableTimezones
Input Parameters
String sessionKey;
Output
{"timezones":{"Atlantic":[["-4:00","Atlantic/Bermuda","Bermuda"],["-3:00","Atlantic/Stanley","Stanley"],["-2:00","Atlantic/South_Georgia","South Georgia"],["-1:00","Atlantic/Azores","Azores"]]}}
Error Output/s
{"error": {"id": 11007,"data": "xxxx" }}
7.6.getTimezone
URL
https://api.mindolife.com/API/Gateway/getTimezone
Input Parameters
String sessionKey;
Output
{"status":true}
Error Output/s
{"error": {"id": 11006,"data": "xxxx" }}
7.7.setTimeZone
URL
https://api.mindolife.com/API/Gateway/setTimeZone
Input Parameters
String timezoneId;
boolean shouldUpdate;
String sessionKey;
int reqID;
Output
{"status":true}
Error Output/s
{"error": {"id": 0,"data": "xxxx" }}
8.Misc
8.1.getSessionClientInfo
URL
https://api.mindolife.com/API/Gateway/getSessionClientInfo
Input Parameters
String sessionKey;
Output
{"clientName":"Google Android SDK built for x86","name":"","clientSource":""}
Error Output/s
{"error": {"id": 7201,"data": "xxxx" }}
8.2.setSessionClientInfo
URL
https://api.mindolife.com/API/Gateway/setSessionClientInfo
Input Parameters
String nickname;
String clientName;
String clientSource;
String sessionKey;
Output
{"status":true}
Error Output/s
{"error": {"id": 7202,"data": "xxxx" }}
8.3.getNotificationTopic
URL
https://api.mindolife.com/API/Gateway/getNotificationTopic
Input Parameters
String regID /*regestrationId from google API*/;
Output
{"topic":"96B5E49CE9AXXXXXXXCDC39746E4B3A4C3A36D752CB238873A2499A6D2E52E9846"}
9.Socket.IO Based API
Connection URL
https://client.mindolife.com:9259
Connection input parameters
String sessionKey
10.Devices
Important events notifications generated by devices
10.1.changeControlState
Event Name
changeControlState
Input ParametersOutput
10.2.doCalibration
Event Name
doCalibration
Input ParametersOutput
11.Policy
Important events for Policies
11.1.doPolicy
doPolicy
Event Name
doPolicy
Input ParametersOutput
12.Settings
Important Settings notidfications
12.1.setTimeZone
Event Name
setTimeZone
Input ParametersOutput
{"timezone":"Asia/Jerusalem"}
Device State description
Device type | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 |
Control (Dimmer) | 0-31 (5 bits) Light level | 0 – toggle off 1 – toggle on | 0 – Diming off 1- Dimming in | 0 –Un Locked 1 – Locked | ||||
On/Off switch | Unused | 0 – toggle off 1 – toggle on | 0 – Light off 1- Light On | 0 –Un Locked 1 – Locked | ||||
Boiler | Unused | 0 – toggle off 1 – toggle on | 0 – Off 1- On | 0 –Un Locked 1 – Locked | ||||
Plug | Unused | 0 – Off 1- On | 0 –Un Locked 1 – Locked | |||||
Shutter | Unused | 00 – Stop | 0 –Un Locked 1 – Locked | |||||
01 – Up | ||||||||
10 – Down | ||||||||
11 – Error | ||||||||
Motion sensor | 0-63 (6 bits) Detection sensitivity level | 0 – No motion 1 – Motion detected | 0 –Un Locked 1 – Locked | |||||
Temperature sensor | 0-128 (7bits) room temperature in Celsius degrees (+40 -> 0 = -40c) | 0 –Un Locked 1 – Locked | ||||||
General UART connector | 0-254 (8 bits) public states defined by the user |