The REST API presented in this document can be used to communicate with Bevywise IoT Platform for creating a mobile application for your IoT Solution or for integrating Bevywise IoT Platfom with Amazon Alexa or other advanced applications.
Bevywise IoT Platform supports two types of authentication mechanism which users can use our IoT Platform to integrate with Mobile application and with AlexaAmazon or other advanced applications.
Once you set up our IoT Platform in your cloud environment, login to the Admin console and go to below URL to set up authentication based on your application.
https://server IP or domain name/o/applications/
If you want your mobile application to login with username and password directly via our API, fill the details as follows and save it.
Name: < name of the application>
Client id: < it will be created automatically don't change it>
Client secret: < it will be created automatically don't change it>
Client type: Confidential
Authorization grant type: Resource owner password based
Redirect urls: < Leave it empty>
Once you have done the configuration, you will get client ID, client secret, Client type and Authorization grant type. Make a backup of the details for further usage.
This authentication is based on the OAUTH2 Authentication which is used for a application with “OAUTH2 Authentication code grant flow”[ used in Amazon Alexa skill set or Google assistance]. Fill the details as follows and save it.
Name: < name of the application>
Client id: < it will be created automatically don't change it>
Client secret: < it will be created automatically don't change it>
Client type: Confidential
Authorization grant type: Authorization code
Redirect urls: < redirect urls the alexa want>
Once you have done the configuration, you will get client ID, client secret, Client type and Authorization grant type. Make a backup of the details for further usage.
This API will help you to create a new account in Bevywise IoT Platform.
Http Request:
POST https://server IP or domain name/bwiot/api/v1/auth/signup/
Parameters:
PARAMETER | VALUE DETAIL |
---|---|
username | email id of the user |
password | any password string |
client_id | paste the client id which is generated while creating authentication |
client_secret | paste the client secret which is generated while creating authentication |
grant_type | password [use the exact word “password” and don’t give the user password] |
On Success:
{
"bwapi-status": "success",
"userid": "email_id",
"token": "the token",
"expires_in": "36000",
"refresh_token": "the refresh token",
"bwapi-status-reason": "successfullsignup"
}
{
"bwapi-status": "fail"
message': 'Account could not be created with received data
{"username": ["A user with that username already exists."]}'
}
This API helps you to login in-to Bevywise IoT Platform.
Type 1:
To get token for normal or direct login to application using username and password
Http Request:
POST https://server IP or domain name/bwiot/api/v1/auth/login/
Parameters:
PARAMETER | VALUE DETAIL |
---|---|
username | email id of the user |
password | any password string |
client_id | paste the client id which is generated while creating authentication |
client_secret | paste the client secret which is generated while creating authentication |
grant_type | password [use the exact word “password” and don’t give the user password] |
On Success:
{
"bwapi-status": "success",
"token": "the token",
"refresh_token": "refresh token value",
"expires_in": "36000",
"bwapi-status-reason": "successfulllogin"
"userid": "email_id",
}
On Failure:
{
"bwapi-status-reason": "Invalid Credentials",
"bwapi-status": "fail"
}
Use the details generated after setting up Authentication in
Bevywise IoT
platform to integrate Bevywise IoT Platform to your alexa skill set server or other
server that
has oauth2 authorization-code flow.
Provide the details based on the below details for other necessary url’s and example in
oauth2
authorization-code flow
Authorization Grant Type: Auth Code Grant
Authorization URL: https://devicemanager.bevywise.com/o/authorize/
Access Token URL: https://devicemanager.bevywise.com/o/token/
Client ID: copy and paste the client id created from Authentication
Client Secret: copy and paste the Client Secret created from Authentication
type 2
Client Authentication Scheme: Http Basic
Scope: Read Write
Note: Only the login API must vary for normal application and the application with Amazon Alexa. Other than this, all following API’s are same for both applications.
The Token gathered from login or sign up will expire after some time. To refresh the token use the below API instead of re-login.
Http Request:
POST https://server IP or domain name/bwiot/api/v1/auth/refresh/
Parameters:
PARAMETER | VALUE DETAIL |
---|---|
client_id | paste the client id which is generated while creating authentication |
client_secret | paste the client secret which is generated while creating authentication |
grant_type | refresh_token [use the exact word “refresh_token” and don’t give the user password] |
refresh_token | refresh token from login or sign up or previous refresh |
On Success:
{
"bwapi-status": "success",
"token": "the token",
"refresh_token": "refresh token value",
"expires_in": "36000",
"bwapi-status-reason": "successfulllogin"
"userid": "email_id",
}
On Failure:
{
"bwapi-status-reason": "Invalid Credentials",
"bwapi-status": "fail"
}
Authorization header is the method of providing authentication information. All the API’s below are accessing data specific to a user. We need to add the session token to all of them. The Session token should be set as part of the Request Header to provide authentication information. The format of the Authorization header is :
Authorization: Bearer < usertoken>
Error Responses On using Authorization Header:
If Authorization header is not defined
{
“detail”: “Authentication credentials were not provided.”
}
If Token is Invalid
{
“detail”: “Invalid token.”
}
This API helps your application to logout from the Bevywise IoT platform
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/auth/logout/
Parameter :
PARAMETER | VALUE DETAILS |
---|---|
username | paste the client id which is generated while creating authentication |
client_secret | paste the client secret which is generated while creating authentication |
token | user token |
Response:
On Success:
{
"bwapi-status": "success",
"bwapi-status-reason": "user logged out"
}
On Failure:
{
"detail": "Authentication Credentials were not provided"
}
This API will provide Auth key[mqtt username] and Auth token[mqtt password] to connect your sensor or device with authentication.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/devicesecurity/generatekey/
Parameter :
PARAMETER | VALUE DETAILS |
---|---|
device_type | edge/gateway |
protocol | MQTT/HTTP |
permissions | Read Write / Read / Write |
key_desc | description |
device_id | device id |
device_name | device name |
keep_alive | keep alive (in seconds) |
Response:
On Success:
{
"bwapi-status": "success",
"data":
{"device_id": "id of the device",
"auth_key": "mqusername",
"auth_token": "mqpassword",
"description": "desc",
"permissions": "permission"}
"userid": "email_id",
}
On Failure:
{
"bwapi-status-reason": "Reason",
"userid": "email_id",
"bwapi-status": "fail"
}
This API will help to get the generated Auth Keys.
POST https://server IP or domain name/bwiot/api/v1/devicesecurity/get_auth_keys
Response:
When Device Connected:
{
"bwapi-status": "success",
"userid": "email_id",
"data":
[
{"client_id": "id of the client",
"device_type": "Gateway",
"protocol": "MQTT",
"auth_key": "mqusername",
"auth_token": "mqpassword",
"description": "desc",
"permissions": "permission"}
"created_at": "time at which device is created",
"description": "desc",
"connect_status": "active/inactive",
"device_img": "image",
"keep_alive": 60,
"status": 0
}
On Failed
{ "bwapi-status-reason": "Reason", "userid": "email_id", "bwapi-status": "fail" }
This API will help you to push the notification to your mobile application using FCM integration.
POST https://server IP or domain name/bwiot/api/v1/auth/pushfcm/
Parameter :
PARAMETER | VALUE DETAILS |
---|---|
notification_token | fcm token value |
device | ios or android or web |
Note: For device use the exact word for your device type. For example, if your device type is android, then use “android” as device.
This API helps you get the both active and inactive connected device list.
Note : set page_no = -1 to get all devices
POST https://server IP or domain name/bwiot/api/v1/devices/
Parameter :
PARAMETER | VALUE DETAIL |
---|---|
page_no | no of the page |
Response:
When Device Connected:
{
"bwapi-status": "success",
"data":
[
{"device_id": "id of the device",
"device_name": "name of the device",
"last_active": "inactive",
"device_connected_time": "time"},
{"device_id": "id of the device",
"device_name": "name of the device",
"last_active": "inactive",
"device_connected_time": time
}
On Failed
If Auth_keys not generated
{
"bwapi-status-reason": "Device Auth Keys Not Found",
"userid": "email_id",
"bwapi-status": "fail",
}
If No Device Found or No Data Found for the requested page no
{
"bwapi-status": "fail",
"userid": "email_id",
"bwapi-status-reason": "No Device / Invalid Page",
}
If A server error
{
"bwapi-status-reason": "Internal Error",
"userid": "email_id",
"bwapi-status": "fail",
}
This API helps you to get the detail of the device.
Http Request:
Add Authorization Header:
POST https://server IP or domain name/bwiot/api/v1/devices/get_device_detail
Parameter :
PARAMETER | VALUE DETAIL |
---|---|
device_id | id_of_the_device for which you want to know details |
Response:
When Device Connected:
{
'bwapi-status': 'success',
'device_id': 'id of the device',
'device_name':'name of the device'
'will_topic': 'willtopic',
'will_message': 'willmessage',
'device_status': 'status',
'userid': 'email_id',
}
On Failure
{
"bwapi-status": "fail",
"bwapi-status-reason": "Device Not Found",
"userid": "email_id",
}
This API provides the list of events like publish topic, message or payload received from a particular device.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/devices/get_device_recv_detail
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
page_no | wanted page no |
device_id | id of the device |
Response:
{
'bwapi-status':'success',
'recv_data'':
[
{'device_id'':'id of the device'',
'device_name'':'name of the device'',
'topic_name'':'name of the topic the event occured'',
'message'' :'event'',
'timestamp'':'time the event occured''
},
'page_nav_data'':
{ 'next_page':true/false',
'total_pages'':'total pages'',
'page_no'':'current page'},
'userid':'email_id'
}
On Failed
{
"bwapi-status": "fail",
"bwapi-status-reason": "no_data_found",
"userid": "email_id",
}
This API provides the list of subscribed topics and messages of a particular device.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/devices/get_device_sent_detail
Parameters :
PARAMETER | VALUE DETAIL |
---|---|
page_no | wanted page noe |
device_id | id of the device |
Response:
{
'bwapi-status':'success',
'sent_data':
[
{'device_id':'id of the device',
'device_name':'name of the device'
'topic_name':'name of the topic the event occured',
'message' :'event',
'timestamp':'time of the event occured'},
'page_nav_data':
{'next_page':True/False,
'total_pages':'total pages'
'page_no': 'current page',
'userid': 'email_id'
}
On Failed
{
"bwapi-status": "fail",
"bwapi-status-reason": "no_data_found",
"userid": "email_id"
}
This API helps you get details from the Dashboard of Bevywise IoT Platform.
Http Request:
Add Authorization Header:
GET https://server IP or domain name/bwiot/api/v1/dashboard/
Response:
{
'bwapi-status': 'success',
'data':
{'active_client_count': no. of active clients,
'total_client_count': total no. of clients,
'total_received_messages': total no. of received messages,
'sec_message_count': message count,
'total_sent_message': total no.of sent messages,
'recent_connections':
[
{'device_name': "name of the device",
'device_id':'id of the device',
'device_time': 'device time'},
'recent_disconnects':
'recent_messages':
[
{'device_id': 'id of the device',
'topic_name': "name of the topic",
'message_name': 'event',
'recv_time': "time at which the message received"
}
'userid': 'email_id'
}
If no data found
{
"bwapi-status-reason": "no_data_found",
"userid": "email_id",
"bwapi-status": "fail",
}
If A Server Error :
{
"bwapi-status-reason": "Internal Error",
"userid": "email_id",
"bwapi-status": "fail",
}
Provide a list of subscribed topics for a particular active topics.
Http Request
Add Authorization Header
GEThttps://server IP or domain name/bwiot/api/v1/ic/get_active_topics
Parameters :
PARAMETER | VALUE DETAIL |
---|---|
Topic | name of the topic |
Response:
On Success
{
'bwapi-status': 'success',
'active_topics': ['topic1, topic2'],
'userid': 'email_id'
}
ON Failure
{
"bwapi-status": "fail",
"bwapi-status-reason": "no_data_found",
"userid": "email_id",
}
This API helps you to send command to a topic.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/ic/send_command_to_topic
Parameters
PARAMETER | VALUE DETAIL |
---|---|
Topic | name of the topic for which you want to send command. |
command | command or message |
On Success
{
'bwapi-status': 'success',
'bwapi-status-reason': 'command send',
'userid': 'email_id'
}
On Failure
{
'bwapi-status': 'fail',
'bwapi-status-reason': 'Device is not active/not found',
'userid': 'email_id'
}
This API helps you to get the active subscriptions of a device.
POST https://server IP or domain name/bwiot/api/v1/ic/get_active_topics_for_this_device
PARAMETER | VALUE DETAIL |
---|---|
device_id | id of the device |
{
'bwapi-status': 'success',
'topics': ['topic1', 'topic2'],
'userid': 'email_id'
}
{
'bwapi-status': 'fail',
'bwapi-status-reason': 'No Topic Found',
'userid': 'email_id'
}
Using this API, you can manually send a command or message to the device based on its subscribed topic.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/ic/send_command_to_device
Parameters :
PARAMETER | VALUE DETAIL |
---|---|
Topic | name of the device |
command | command |
device_id | id of the device |
Response:
On Success
{
'bwapi-status': 'success',
'bwapi-status-reason':'command send',
'userid': 'email_id'
}
Failed
{
"bwapi-status": "fail",
"bwapi-status-reason": "Device is not active/not found",
"userid": "email_id"
}
This API is used to change or modify only name of the connected device.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/devices/edit_device_name
Parameters :
PARAMETER | VALUE DETAIL |
---|---|
new_device_name | device name to set |
device_id | ID of the device for which you want to change the name |
Response:
On Success
{
'bwapi-status': 'success',
'device_name': 'name of the device',
'userid': 'email_id'
}
Failure
{
"bwapi-status": "fail",
"bwapi-status-reason": "no_matching_device_id_found",
"userid": "email_id"
}
This API used to get a status like message received time stamp, device status, last received message etc for a particular device.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/devices/get_last_status_of_device
Parameters :
PARAMETER | VALUE DETAIL |
---|---|
device_id | id of the device |
Response:
On Success
{
'device_status': 'device status',
'device_id': 'id of the device',
'device_name': 'name of the device',
'last_received_message': 'last message received',
'received_at': ' time at which last message is received',
'device_status': 'active/inactive',
'useri': 'email_id'
}
Failed
{
"bwapi-status": "fail",
"bwapi-status-reason": "Device Not Found",
"userid": "email_id",
}
This API is used to delete a particular device from Bevywise IoT Platform permanently.
POST https://server IP or domain name/bwiot/api/v1/devices/delete_device/
Parameters :
PARAMETER | VALUE DETAIL |
---|---|
device_id | id of the device |
Response:
On Success
{
'bwapi-status': 'success',
'bwapi-status-reason': 'device_deleted',
'userid': 'email_id'
}
Failed
{
"bwapi-status": "fail",
"bwapi-status-reason": "Device Not Found",
"userid": "email_id"
}
This API will show the full details about all active devices.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/devices_custom_data/
Parameters :
PARAMETER | VALUE DETAIL |
---|---|
page_no | -1 |
Example Response:
{
"next_page": false,
"userid": " [email protected]",
"bwapi-status": "success",
"error": "noerror",
"data": [
{
"last_received_message": "-",
"last_received_message_time": "-",
"last_active": "Inactive",
"active_topics": [
[
"soc1/onoff"
]
],
"device_name": "Socket1",
"device_connected_time": "03-08-2018 11:00:54",
"device_id": "demo1/s1",
},
{
"last_received_message_time": "04-08-2018 16:57:47",
"last_active": "Active",
"active_topics": [
[
"mytopic"
]
],
"device_name": 'test_device',
"device_connected_time": "04-08-2018 16:57:46",
"device_id": "publisherclient1",
"last_received_message": "hello I am publisher1"
},
],
"page_no": -1
}
This API will help you group your devices or machines based on departments.
Http Request::
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/admin/createDeviceGroup
Parameters :
PARAMETER | VALUE DETAIL |
---|---|
group_name | group name |
description | description |
This API will help you get details about the particular device group
Http Request::
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/admin/getDeviceGroup
This API helps you remove the created or existing device group.
Http Request::
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/admin/removeDeviceGroup
Parameters :
PARAMETER | VALUE DETAIL |
---|---|
group_name | group name |
This API will help you add new devices to the particular device group.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/admin/addDeviceToDeviceGroup
Parameters :
PARAMETER | VALUE DETAIL |
---|---|
group_name | group name |
deviceList | [“device1”, “device2”, …] |
This API will help you get details about the devices of the particular device group.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/admin/getGroupDevices
Parameters :
PARAMETER | VALUE DETAIL |
---|---|
group_name | group name |
This API can be used to remove certain devices from the Device Group.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/admin/removeGroupDevice
Parameters :
PARAMETER | VALUE DETAIL |
---|---|
group_name | group name |
device_id | device id |
This API will help you create a new user based on their mail id along with assigning permissions as standard / administrative to them.
Http Request:
Add Authorization Header:
POST https://server IP or domain name/bwiot/api/v1/admin/createUser
Parameters :
PARAMETER | VALUE DETAIL |
---|---|
user_permission | standard/administrative |
display_name | name |
mobile_no | mobile no |
username | mail id |
Response:
On Success
{
'bwapi-status': 'success',
'bwapi-status-reason': 'User Created Successfully',
'userid': 'email_id'
}
On Failed
{
'bwapi-status': 'failed',
'bwapi-status-reason': 'Unable to handle your request at this time, Please try after
some
times'
}
If used already registered mail id
{
'bwapi-status': 'failed',
'bwapi-status-reason': 'The Email Already Registered'
}
This API helps you to change the status of user, either as Active or Inactive.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/admin/userStatusChanger
Parameters :
PARAMETER | VALUE DETAIL |
---|---|
username | mail id |
status | active/inactive |
Response:
{
'bwapi-status': 'success',
'bwapi-status-reason': 'User status changed successfully',
'current-status': 'Active'
}
On Failed
{
'bwapi-status': 'failed',
'bwapi-status-reason': 'User not found'
}
This API will help you get details about all the added tenants.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/admin/getUsers
Response:
{
'bwapi-status': 'success',
'data':
[
{'id': id of the user,
'email': 'email_id',
'login': 'date & time of login',
'join': 'date & time of joining',
'status': 'active/inactive',
'name': 'user name',
'contact': 'number',
'role': 'role'
}
On Failed
{
'bwapi-status': 'fail',
'bwapi-status-reason': 'reason',
'userid': 'email_id'
}
This API helps you remove the particular user from the admin console.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/admin/removeUser
Parameters :
PARAMETER | VALUE DETAIL |
---|---|
username | mail id |
Response:
{
'bwapi-status': 'success',
'bwapi-status-reason': 'Removed User'
}
On Failed
{
'bwapi-status': 'failed',
'bwapi-status-reason': 'User not found'
}
You can change the role of a user at any time. This API helps you change the role of the user as an administrative / standard.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/admin/userRoleChange
Parameters :
PARAMETER | VALUE DETAIL |
---|---|
username | mail id | role | administrative / standard |
Response:
On Success when limit is 5:
{
'bwapi-status': 'success',
'permission': 'role'
}
On Failed
{
'bwapi-status': 'failed',
'bwapi-status-reason': 'Invalid data'
}
This API will help you get the details about the device groups of the particular user.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/admin/getUserDeviceGroups
Parameters :
PARAMETER | VALUE DETAIL |
---|---|
username | mail id |
This API will help you add a device group to the user and help in assigning permission to view or manage the newly added device group.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/admin/addDeviceGroupToUser
Parameters :
PARAMETER | VALUE DETAIL |
---|---|
username | mail id |
group_name | group name |
permission | view / manage |
This API will help you remove a particular device group from the user.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/admin/removeDeviceGroup
Parameters :
PARAMETER | VALUE DETAIL |
---|---|
username | mail id |
group_name | group name |
This API will help you change the permission of the user to either view or manage a particular device group.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/admin/groupPermissionChanger
Parameters :
PARAMETER | VALUE DETAIL |
---|---|
username | mail id |
group_name | group name |
permission | view / manage |
This API will help you create the condition based rules to create alert events based on the received topic or messages.
Http Request::
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/rule_engine/create_event_rule/device_alert
Request
{
'mq_client': 'device_id',
'mq_topic': 'event_topic',
'msg_chk_type': 'with_out_key',
'whole_set_condition': 'match_any',
'check_set':[
{
'compare_with': message,
'condition': ,
'value': 20,
}
{
'compare_with': time,
'condition': < ,
'hour': 15,
'Minute': 7,
}
]
'response_message_type': "send_defined",
'forward_mq_message': "message",
'forward_mq_client': "device_id",
'forward_mq_topic': "topic",
}
Response
{
"userid": "userId",
"bwapi-status-reason": "rule_added",
"bwapi-status": "success",
}
This API will help you send the rules or alert messages as a mail to the specified mail id.
POST https://server IP or domain name/bwiot/api/v1/rule_engine/create_event_rule/mail_alert
Request
{
'mq_client': 'device_id',
'mq_topic': 'event_topic',
'msg_chk_type': 'with_out_key',
'whole_set_condition': 'match_any',
'check_set':[
{
'compare_with': message,
'condition': ,
'value': 20,
}
{
'compare_with': time,
'condition': < ,
'hour': 15,
'Minute': 7,
}
]
'response_message_type': "attach_meta",
'forwarding_mail': "mail_id",
'forwarding_subject': "subject"
,
'forwarding_body': "message",
}
Response
{
"userid": "userId",
"bwapi-status-reason": "rule_added",
"bwapi-status": "success",
}
This API will help you create an event rule for device to push the alert message as a notification.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/rule_engine/create_event_rule/ws_alert
Request
{
'mq_client': 'device_id',
'mq_topic': 'event_topic',
'msg_chk_type': 'with_out_key'
,
'whole_set_condition': 'match_any'
,
'check_set':[
{
'compare_with': message,
'condition': ,
'value': 20,
}
{
'compare_with': time,
'condition': < ,
'hour': 15,
'minute': 7,
}
]
'notification_title': "title",
'notification_body': "message",
}
Response
{
"userid": "userId",
"bwapi-status-reason": "rule_added",
"bwapi-status": "success",
}
This API will help you create an event rule for device to push the data as a notification to your android or ios app based on FCM token.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/rule_engine/create_event_rule/fcm_alert
Request:
{
'mq_client': 'device_id',
'mq_topic': 'event_topic',
'msg_chk_type': 'with_out_key',
'whole_set_condition': 'match_any',
'check_set':[
{
'compare_with': message,
'condition': ,
'value': 20,
}
{
'compare_with': time,
'condition': < ,
'hour': 15,
'minute': 7,
}
]
'notification_title': "title",
'notification_body': "message",
}
Response:
{
"userid": "userId",
"bwapi-status-reason": "rule_added",
"bwapi-status": "success",
}
This API will help you create a timer rule to send data to a device for a specific time or in a specific time interval.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/rule_engine/create_timer_rule/device_alert
Request
{
'device_id': 'device_id',
'topic': 'topic',
'message': 'message',
'hour': '0-24',
'minute': '0-59',
'startdaterange': mm/dd/yyyy,
'enddaterange': mm/dd/yyyy ,
}
Response
{
"userid": "userId",
"bwapi-status-reason": "rule_added",
"bwapi-status": "success",
}
This API will help you get the list of all created rules.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/rule_engine/get_rule_list
Request
{ 'page_no': 'number', }
Response
{
'rules':[
{
"forward":{
"reaction_method": "send_via_mqtt",
"mq_client": "device_id",
"response_message_type": "send_defined",
"mq_topic": "topic",
"mq_message": "message",
}
"time": "1558690606980",
"id": "105",
"event":{
"time_check_set":[
[
"",
"<",
15,
7,
]
]
"whole_set_condition": "match_any",
"mq_topic": "event_topic",
"check_set": [],
"msg_chk_type": "with_out_key",
"mq_client": "device_id",
}
}
{
"forward": {,
"reaction_method": "send_via_ws",
"notification_title": "title",
"notification_body": "message",
}
"time": "1558693863847",
"id": "108",
"event":{
"time_check_set":[
[
"",
"<",
15,
7,
]
]
"whole_set_condition": "match_any",
"mq_topic": "event_topic",
"check_set": [
[
"INCOMING_MSG",
">",
20
]
[
"INCOMING_MSG",
"=",
15
]
],
"msg_chk_type": "with_out_key",
"mq_client": "device_id",
}
},
{
"msg_chk_type": {
"reaction_method": "send_via_fcm",
"notification_title": "title",
"notification_body": "message",
}
"time": "1558694345964",
"id": "109",
"event":{
"time_check_set":[
[
"",
"<",
15,
7,
]
]
"whole_set_condition": "match_any",
"mq_topic": "event_topic",
"check_set": [
[
"INCOMING_MSG",
">",
20
]
[
"INCOMING_MSG",
"=",
15
]
],
"msg_chk_type": "with_out_key",
"mq_client": "device_id",
}
},
]
"page_nav_data": {
"next_page": false
"total_pages": 1,
"page_no": 0
}
"user_id": "user_id",
"bwapi-status": "success"
,
This API will help you delete the created rule.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/rule_engine/delete_rule
Request
{ 'rule_id': 'numeric', }
Response
{
"bwapi-status": "success",
"bwapi-status-reason": "Rule Deleted",
"userid": "userid"
}
Show Sub-Devices
This API will help you get the list of sub-devices
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/devicesecurity/show_subdevices
Parameters :
PARAMETER | VALUES |
---|---|
gateway_device_id | gateway device id |
On success
{
‘bwapi-status’: ‘success’,
‘userid’: ’email_id’,
‘data’:
[
{‘subdevice_id’: ‘id of the subdevice’,
‘connect_status’: 0
]
}
Response
{
‘bwapi-status’: ‘fail’,
‘bwapi-status-reason’: ‘no_data_found’,
‘userid’: ’email_id’
}
This API will help you get the details of sub-devices
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/devicesecurity/show_subdevice_details
Parameter :
PARAMETER | VALUES |
---|---|
subdevice_id | subdevice id |
Success
{
‘bwapi-status’: ‘success’,
‘userid’: ’email_id’,
‘data’:
[
{‘sub_device_id’: ‘id of the subdevice’,
‘client_name’: ‘name of the client’,
‘command_topics’: [‘topic1’, ‘topic2’, ‘topic3’],
‘event_topics’: [‘eventtopic1’, ‘eventtopic2’, ‘eventtopic3’}
]
}
}
Response
{
‘bwapi-status’: ‘fail’,
‘bwapi-status-reason’: ‘no_data_found’,
‘userid’: ’email_id’
}
This API will help you to update the sub-devices.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/devicesecurity/update_subdevice
Parameter :
PARAMETER | VALUES |
---|---|
subdevice_id | subdevice id |
subdevice_name | subdevice name |
command_topic | subscription topic |
events_topic | publish topic |
On Success
{
‘bwapi-status’: ‘success’,
‘userid’: ’email_id’
}
Response
{
‘bwapi-status’: ‘fail’,
‘bwapi-status-reason’ : ‘reason’,
‘userid’: ’email_id’
}
This API will help you to add sub-devices
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/devicesecurity/add_subdevices
Parameter :
PARAMETER | VALUES |
---|---|
subdevice_id | subdevice id |
subdevice_name | subdevice name |
command_topic | subscription topic |
events_topic | publish topic |
success
{
‘bwapi-status’: ‘success’,
‘userid’: ’email_id’
}
Response
{
‘bwapi-status’: ‘fail’,
‘bwapi-status-reason’ : ‘internal error’,
‘userid’: ’email_id’
}
This API will help you to delete sub-devices
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/devicesecurity/delete_subdevices
Parameter :
PARAMETER | VALUES |
---|---|
subdevice_id | subdevice id |
On Success
{
‘bwapi-status’: ‘success’,
‘userid’: ’email_id’
}
Response
{
‘bwapi-status’: ‘fail’,
‘bwapi-status-reason’ : ‘internal error’,
‘userid’: ’email_id’
}
This API will help you to check the uniqueness of the client ID.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/devicesecurity/check_uniqueness_of_clientid
Parameter :
PARAMETER | VALUES |
---|---|
device_id_chk | client id |
On Success
{
‘bwapi-status’: ‘success’,
‘bwapi-status-reason’: ‘Client Id is Available’,
‘userid’: ’email_id’
}
Response
{
‘bwapi-status’: ‘fail’,
‘bwapi-status-reason’: ‘Client id is already exist’,,
‘userid’: ’email_id’,
}
This API will help you to change the status of the access key.
Http Request:
Add Authorization Header
POST https://server IP or domain name/bwiot/api/v1/devicesecurity/change_access_key_status
Parameter :
PARAMETER | VALUES |
---|---|
accesskey | auth key |
device_id | device id |
string_status | active/inactive |
On Success
{
‘bwapi-status’: ‘success’,
‘userid’: ’email_id’,
‘new_status’: ‘active’
}
On Failed
{
‘bwapi-status’: ‘fail’,
‘bwapi-status-reason’: ‘Internal Error’,
‘userid’: ’email_id’
}