IoT Simulator API Documentation
Introduction
IoT Simulator API helps you to communicate with Bevywise IoT Simulator to Create and Remove Network and Clients, to Create Events and Publish for the added Clients, to Create and Remove Subscription to the added clients, to Create and Remove Response for the added Clients.
This API is implemented using the REST Framework which operates over HTTP. You will be able to integrate the IoT Simulator with your test automation framework using these APIs for a complete regression testing.
Add a New Device
This method will add a new MQTT Device to an already running simulator. The Clean session , will message , will QoS, will retain etc can be specified as part of this method.
Method:
POST
http://localost:9000/api/addclient
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose the Network in which you want to create device |
Device_id | Used to Identify the Device |
description | Details about the Device |
clean_session | To Set Clean Session |
Will_flag | To Enable the Will Flag |
Willtopic | Topic for the will message |
willmessage | Message to be Published |
willqos | QoS level for Will Messaage |
willretain | Enable Retain Flag |
username | Authentication Credentials |
password | Authentication Credentials |
Response:
{ '“Device”:device_id', '“Status”:Device is added to database and connected with broker' }
Remove the Connected Device
This IoT Simulator API method will help you to remove the MQTT Device which was connected to the simulator.
Method
GET
http://localhost:9000/api/get/removeclient
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose the Network in which you want to remove device |
device_ID | Id of the Connected Device |
Response:
{
'“Status”:Client is removed'
}
IoT Simuator API – Start Device
This method will start the Deivce by connecting it to the Broker.
Method
GET
http://localhost:9000/api/get/startdevice
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose the Network in which you want to remove Device |
Device_ID | Id of the Device which you want to remove |
Response:
{ '“network”:network_chosen', '“Device”:Device_ID', '“status”:Device is Started' }
Stop Device
This IoT Simulator API method will stop the Device by disconnecting it from the Broker.
Method
GET
http://localhost:9000/api/get/stopdevice
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose the Network in which you want to remove device |
device_ID | Id of the Connected device |
Response:
{ '“network”:network_chosen', '“Device”:Device_ID', '“status”:Device is Stopped' }
Get Device list
This method will Displays the Device list in a network .
Method
GET
http://localhost:9000/api/get/deviceslist
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose the Network in which you want view the Device list |
Response:
{ '“network_name”:network_chosen', '“device list”: [{"ID":“Device ID,"Name":device_name,"Discription":Description}', '{"ID":device_id,"Name":Device_name,"Description":Description},..]' }
Get Device Details
This method will Displays the details of a particular Device in a network .
Method
GET
http://localhost:9000/api/get/devicedetails
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose the Network in which you want view the particular Device Detail |
Device_ID | ID of the device which we want to view the detail |
Response:
{ '“network_name”:network_chosen', '"device":Device_ID', '"Will_Details":{}', '"Auth_details":[{ 'auth key':username, 'auth_token': password}]', '"Subscription": [ { } ], "Behavior": [ { } ], "Events": [ { } ]' }
Start Network
This method will start a all the Device by connecting it to the Broker
Method
GET
http://localhost:9000/api/get/startalldevices
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose a Network to Start |
Response:
{ '“network_name”:network_chosen', '"Started":number of device started', '"Failed":number of device not started' }
IoT Simulator API – Stop Network
This method will stop a all the device by disconnecting it to the Broker
Method
GET
http://localhost:9000/api/get/stopalldevices
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose a Network to Stop |
Response:
{ '“network_name”:network_chosen', '"Stopped_count":number of device disconnected' }
Get Network List
This method will list all the network created in the Simulator
Method
GET
http://localhost:9000/api/get/networklist
Response:
{
'“network_list”:[ { } ]'
}
Get Network Status
This method will show the status of the given network
Method
GET
http://localhost:9000/api/get/networkstatus
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose a Network to know the status |
Response:
{ '“network_name”:network_chosen', '“Running”:number of device connected', '“Not_Running”:number of device not connected' }
Choose a Network
This IoT Simulator API method will used to Choose a network for API integration.
Method
GET
http://localhost:9000/api/get/setnetwork
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose a Network name |
Response:
{ '“network_name”:network_chosen', '“Status”:Network was Chosen' }
Stop Event
This method will used to stop the publishing events.
Method
GET
http://localhost:9000/api/get/stopevent
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose a Network to stop the Events |
event_ID | ID for the Configured Evnets |
Response:
{ '“network_name”:network_chosen', '“Event_ID”:event_id', '“Status”:Event is stopped' }
Resume Event
This method will used to resume the stopped events
Method
GET
http://localhost:9000/api/get/resumeevent
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose a Network to resume the Events |
event_ID | ID for the Configured Events |
Response:
{ '“network_name”:network_chosen', '“Event_ID”:event_id', '“Status”:Event is resume' }
IoT Simulator API – Publish
This method will used Publish events for a particular device in a network
Method
POST
http://localhost:9000/api/pubishclient
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chosen a Network to view the Publish of particular Device |
device_ID | ID of the Publishing Device |
topic | Topic of the Publishing Events |
message | Message to be published |
QoS | QoS level |
retain | Retain flag for the Publish Device |
Response:
{ '“network_name”:network_chosen', '“Topic”:topic', '“Status”:Published', '“Message”:message', '“Published at”:time_of_publish', }
Publish_with_Error
This method will used to Publish corrupted event for a particular Device in a network
Method
POST
http://localhost:9000/api/publishclient_with_corruption
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chosen a Network to view the Corrupted Publish event |
device_ID | ID of the Publishing Device |
topic | Topic of the Publishing Event |
message | Message to be published |
QoS | QoS level |
retain | Retain flag for the Publish Device |
Response:
{ '“network_name”:network_chosen', '“Topic”:topic', '“Status”:Published', '“Message”:message', '“Published at”:time_of_publish', }
Remove Publish Message
This method will used to remove the event topic from a particular Device in a network
Method
POST
http://localhost:9000/api/removepublish
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose a Network to remove the event topic from a particular Device |
Device_ID | ID of the device for which event topic to beremoved |
topic | Topic of the Events to be removed |
Response:
{ '“Device”:Device_ID', '“Status”:Event Topic is removed from database' }
Add Response for Request
This method will used to Add a new behavior pattern for a particular Device in a network
Method
POST
http://localhost:9000/api/addresponse
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose a Network to add a new behavior pattern for a particular Device |
device_ID | ID of the device for which response created |
event_topic | Created Event topic |
event_data | Published event data |
command_topic | Response topic |
command_data | Reponse data |
QoS | QoS Level |
retain | retain flag |
Response:
{ '“Device”:Device_ID', '“Status”:Request Response Message is added successfully' }
Remove Response for Request
This method will used to Remove a behavior pattern from a particular Device in a network
Method
POST
http://localhost:9000/api/removeresponse
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose a Network to Remove a behavior pattern from a particular Device |
device_ID | ID of the device for which response topic to be removed |
event_topic | Event topic for which you want to remove response |
Response:
{ '“device”:Device_ID', '“Status”:Behavior Pattern is removed from database' }
Stop Behavior Simulation
This method will used to Stop a behavior pattern from a particular Device in a network
Method
POST
http://localhost:9000/api/stopres
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose a network to Stop a behavior pattern from a particular Device |
device_ID | ID of the device for which response to be stopped |
event_topic | Event topic for which you want to stop response |
Response:
{ '“Device”:Device_ID', '“Status”:Behavior Simulation is stopped' }
Subscribe
This method will used to Subscribe a command for a particular device in a network/p>
Method
POST
http://localhost:9000/api/subscribeclient
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chosea Network to Subscribe a command for a particular Device |
device_ID | ID of the device in which the subscribed topic added |
topic | Topic which is to be Subscribed |
QoS | QoS Level |
addtodb | Subscribed Topic added to Database |
Response:
{ '“device”:Device_ID', '“Status”:Topic is subscribed' }
Get Subscription Details
This method will used to Retrieve the subscription details of a particular device in a network/p>
Method
GET
http://localhost:9000/api/get/subscribedetails
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose a Network to Retrieve the subscription details of a particular Device |
device_ID | ID of the Device from which the Subscription details are retrieved |
Response:
{ '“network_name”:network_chosen', '"Device":device_ID', '"Subscription_details":[{ "Subscribe_On": when_to_subscribe, "Command_Topic": topic, "QoS": QoS, "Command_ID": topic_id},{ }]', }
Add New Subscribe
This method will used to Add a new command for a particular Device in a network/p>
Method
POST
http://localhost:9000/api/addsubscribe
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose a Network to Add a new command for a particular Device |
device_ID | ID of the Device in which the subscribed topic added |
topic | Topic which is newly subscribed |
QoS | QoS Level |
Response:
{ '“Device”:device_ID', '“Status”:Command Topic is added to database successfully' }
Remove Subscribe
This method will used to Remove a command from a particular Device in a network.
Method
POST
http://localhost:9000/api/removesubscribe
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose a Network to Remove a command from a particular Device |
device_ID | ID of the device in which the subscription removed |
topic | Removed Subscription Topic |
Response:
{ '“Device”:Device_ID', '“Status”:Command Topic is removed from database' }
Unsubscribe
This method will used to Unsubscribes a command from a particular device in a network
Method
POST
http://localhost:9000/api/unsubscribe
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose a Network to Unsubscribes a command from a particular Device |
Device_ID | ID of the Device which has Unsubscribed Topic |
topic | Unsubscribed Topic |
Response:
{ '“Device”:Device_ID', '“Topic”:topic', '“Status”:Topic is unsubscribed' }
Unsubscribe All
This method will used to Unsubscribes all commands in a network
Method
POST
http://localhost:9000/api/unsubscribeall
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Chose a Network to Unsubscribes all commands |
Response:
{
'“Status”:All topics of connected Device are unsubscribed'
}