Home About us Support Partners SIGN UP NOW

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 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'
}

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 Choose 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 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' }

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 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'
}

Get Device list

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": [ { } ]'
}

Start Network

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'
}

IoT Simulator API – Stop Network

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'
}

Get Network List

This method will list all the networks 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 Choose 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 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'
}

Stop Event

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'
}

Resume Event

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'
}

IoT Simulator API – Publish

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',
}

Publish_with_Error

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',
}

Remove Publish Message

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'
}

Add Response for Request

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'
}

Remove Response for Request

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' }

Stop Behavior Simulation

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'
}

Subscribe

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' }

Get Subscription Details

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'] }

Add New Subscribe

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'
}

Remove Subscribe

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'
}

Unsubscribe All

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'
}

Having queries on Bevywise
IoT Simulator?

Explore our FAQ Page