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.
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 a part of this method.
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.
Method:
Post
http://localhost:9000/api/addclient
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Choose 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'
}
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 | Choose the Network in which you want to remove device |
device_id | Id of the Connected Device |
Response:
{
'“Status”:Client is removed'
}
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 | Choose the Network in which you want to start the device |
device_id | Id of the device which you want to start |
Response:
{
'“network”:'network_chosen',
'“Device”:'device_id', '“status”:'Device is
Started' }
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 | Choose 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'
}
This method will display the list of devices in a network.
Method
Get
http://localhost:9000/api/get/deviceslist
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Choose the Network in which you want to view the device list |
Response:
{
'“network_name”:network_chosen',
'“device list”:
[{"ID":device_id',"Name":device_name',"Description":Description}',
'{"ID":device_id,"Name":device_name',"Description":Description},..]'
}
Get Device Details
This method will display the details of a particular device in a network .
Method
Get
http://localhost:9000/api/get/devicedetails
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Choose the Network in which you want to view the detail of a particular device |
device_id | ID of the device for 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": [ { } ]'
}
This method will start all the device by connecting it to the Broker
Method
Get
http://localhost:9000/api/get/startalldevices
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Choose a Network to Start |
Response:
{
'“network_name”:network_chosen',
'"Started":number of device started',
'"Failed":number of device not started'
}
This method will stop all the devices by disconnecting it from the Broker.
Method
Get
http://localhost:9000/api/get/stopalldevices
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Choose a Network to Stop |
Response:
{
'“network_name”:network_chosen',
'"Stopped_count":number of device disconnected'
}
This method will list all the networks created in the Simulator
Method
Get
http://localhost:9000/api/get/networklist
Response:
{
'“network_list”:[ { } ]'
}
This method will show the status of the given network
Method
Get
http://localhost:9000/api/get/networkstatus
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Choose a Network to know the status |
Response:
{ '“network_name”:network_chosen',
'“Running”:number of device connected',
'“Not_Running”:number of device not connected'
}
This IoT Simulator API method is used to choose a network for API integration.
Method
Get
http://localhost:9000/api/get/setnetwork
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Choose a Network name |
Response:
{
'“network_name”:network_chosen',
'“Status”:Network was Choosen'
}
This method is used to stop all the publishing events.
Method
Get
http://localhost:9000/api/get/stopevent
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Choose a Network to stop the Events |
event_id | ID of the Configured Evnets |
Response:
{
'“network_name”:network_chosen',
'“Event_ID”:event_id',
'“Status”:Event is stopped'
}
This method is used to resume the stopped events.
Method
Get
http://localhost:9000/api/get/resumeevent
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Choose a Network to resume the Events |
event_id | ID of the Configured Events |
Response:
{
'“network_name”:network_chosen',
'“Event_ID”:event_id',
'“Status”:Event is resume'
}
This method is used to publish events for a particular device in a network.
Method
Post
http://localhost:9000/api/publishclient
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Choosen a Network to view the published events 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',
}
This method is 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 | Choose 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',
}
This method is 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 | Choose a Network to remove the event topic from a particular Device |
device_id | ID of the device for which event topic wants to be removed |
topic | Topic of the Events to be removed |
Response:
{
'“Device”:'device_id',
'“Status”:Event Topic is removed from database'
}
This method is 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 | Choose a Network to add a new behavior pattern for a particular Device |
device_id | ID of the device for which response is created |
event_topic | Created Event topic |
event_data | Published event data |
command_data | Reponse data |
qos | RQoS Level |
retain | retain flag |
Response:
{
'“Device”:'device_id',
'“Status”:Request Response Message is added
successfully'
}
This method is 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 | Choose a Network to Remove a behavior pattern from a particular Device |
device_id | ID of the device for which response topic wants to be removed |
topic | Event topic for which you want to remove response |
Response:
{
'“device”:'device_id',
'“Status”:Behavior Pattern is removed from database'
}
This method is used to stop the behavior pattern / response from a particular Device in a network
Method
Post
http://localhost:9000/api/stopres
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Choose a network to Stop a behavior pattern from a particular Device |
device_id | ID of the device for which response wants to be stopped |
topic | Event topic for which you want to stop response |
Response:
{
'“Device”:'device_id',
'“Status”:Behavior Simulation is stopped'
}
This method is used to subscribe a command for a particular device in a network
Method
Post
http://localhost:9000/api/subscribeclient
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Choose a Network to Subscribe a command for a particular Device |
device_id | ID of the device in which the subscribed topic is added |
topic | Topic which is to be Subscribede |
qos | QoS Level |
addtodb | Subscribed Topic added to Database |
Response:
{
'“device”:'device_id', '“Status”:Topic
is subscribed' }
This method is used to retrieve the subscription details of a particular device in a network
Method
Get
http://localhost:9000/api/get/subscribedetails
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Choose 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',
'topics': ['topic1','topic2'] }
This method is used to add a new subscription topic for a particular device in a network
Method
Post
http://localhost:9000/api/addsubscribe
Response:
{
'“network_name”:network_chosen',
'"Device":'device_id',
'"Subscription_details":[{ "Subscribe_On":
when_to_subscribe, "Command_Topic": topic, "QoS": QoS,
"Command_ID": topic_id},{ }]',
}
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Choose a Network to Add a new command for a particular Device |
device_id | ID of the Device in which the subscribed topic is to be added |
topic | Topic which is newly subscribed |
qos | QoS Level |
Response:
{
'“Device”:'device_id',
'“Status”:Command Topic is added to database
successfully'
}
This method is 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 | Choose a Network to Remove a command from a particular Device |
device_id | ID of the device in which the subscription is to be removed |
topic | Removed Subscription Topic |
Response:
{
'“Device”:'device_id',
'“Status”:Command Topic is removed from database'
}
This method is used to unsubscribe all commands in a network
Method
Post
http://localhost:9000/api/unsubscribeall
Parameter:
PARAMETER | VALUE DETAIL |
---|---|
network_chosen | Choose a Network to unsubscribe all commands |
device_id | ID of the device in which the subscription is to be removed |
topic | Removed Subscription Topic |
Response:
{
'“Status”:All topics of connected Device are
unsubscribed'
}
Explore our FAQ Page