Bevywise IoT Simulator API Documentation

Introduction:


 The API method presented in this document can be used 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. 

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:

ParameterValue Detail
network_chosenChose the Network in which you want to create device
Device_idUsed to Identify the Device
descriptionDetails about the Device
clean_sessionTo Set Clean Session
Will_flagTo Enable the Will Flag
WilltopicTopic for the will message
willmessageMessage to be Published
willqosQoS level for Will Messaage
willretainEnable Retain Flag
usernameAuthentication Credentials
passwordAuthentication Credentials

Response:

    {  
										
      '“Device”:device_id',
      '“Status”:Device is added to database and connected with broker'

    }

Remove the Connected Device

This method will help you to remove the MQTT Device which was connectd to the simulator.

Method

GET


http://localhost:9000/api/get/removeclient

Parameter:

ParameterValue Detail
network_chosenChose the Network in which you want to remove device
device_IDId of the Connected Device

Response:

    { 

         '“Status”:Client is removed'

    }

Start Device

This method will start the Deivce by connecting it to the Broker.

Method

GET


http://localhost:9000/api/get/startdevice

Parameter:

ParameterValue Detail
network_chosenChose the Network in which you want to remove Device
Device_IDId of the Device which you want to remove

Response:

    { 

      '“network”:network_chosen',
      '“Device”:Device_ID',
      '“status”:Device is Started'

    }

Stop Device

This method will stop the Device by disconnecting it from the Broker.

Method

GET


http://localhost:9000/api/get/stopdevice

Parameter:

ParameterValue Detail
network_chosenChose the Network in which you want to remove device
device_IDId 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:

ParameterValue Detail
network_chosenChose 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:

ParameterValue Detail
network_chosenChose the Network in which you want view the particular Device Detail
Device_IDID 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:

ParameterValue Detail
network_chosenChose a Network to Start

Response:

    { 
      '“network_name”:network_chosen',
      '"Started":number of device started',
      '"Failed":number of device not started'
    } 

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:

ParameterValue Detail
network_chosenChose 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:

ParameterValue Detail
network_chosenChose 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 method will used to Choose a network for api integration

Method

GET


http://localhost:9000/api/get/setnetwork

Parameter:

ParameterValue Detail
network_chosenChose 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:

ParameterValue Detail
network_chosenChose a Network to stop the Events
event_IDID 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:

ParameterValue Detail
network_chosenChose a Network to resume the Events
event_IDID for the Configured Events

Response:

    { 
      '“network_name”:network_chosen',
      '“Event_ID”:event_id',
      '“Status”:Event is resume'
    }

Publish

This method will used Publish events for a particular device in a network

Method

POST


http://localhost:9000/api/pubishclient

Parameter:

ParameterValue Detail
network_chosenChosen a Network to view the Publish of particular Device
device_IDID of the Publishing Device
topicTopic of the Publishing Events
messageMessage to be published
QoSQoS level
retainRetain 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:

ParameterValue Detail
network_chosenChosen a Network to view the Corrupted Publish event
device_IDID of the Publishing Device
topicTopic of the Publishing Event
messageMessage to be published
QoSQoS level
retainRetain 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:

ParameterValue Detail
network_chosenChose a Network to remove the event topic from a particular Device
Device_IDID of the device for which event topic to beremoved
topicTopic 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:

ParameterValue Detail
network_chosenChose a Network to add a new behavior pattern for a particular Device
device_IDID of the device for which response created
event_topicCreated Event topic
event_dataPublished event data
command_topicResponse topic
command_dataReponse data
QoSQoS Level
retainretain 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:

ParameterValue Detail
network_chosenChose a Network to Remove a behavior pattern from a particular Device
device_IDID of the device for which response topic to be removed
event_topicEvent 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:

ParameterValue Detail
network_chosenChose a network to Stop a behavior pattern from a particular Device
device_IDID of the device for which response to be stopped
event_topicEvent 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:

ParameterValue Detail
network_chosenChosea Network to Subscribe a command for a particular Device
device_IDID of the device in which the subscribed topic added
topicTopic which is to be Subscribed
QoSQoS Level
addtodbSubscribed 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:

ParameterValue Detail
network_chosenChose a Network to Retrieve the subscription details of a particular Device
device_IDID 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:

ParameterValue Detail
network_chosenChose a Network to Add a new command for a particular Device
device_IDID of the Device in which the subscribed topic added
topicTopic which is newly subscribed
QoSQoS 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/p>

Method

POST


http://localhost:9000/api/removesubscribe

Parameter:

ParameterValue Detail
network_chosenChose a Network to Remove a command from a particular Device
device_IDID of the device in which the subscription removed
topicRemoved 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:

ParameterValue Detail
network_chosenChose a Network to Unsubscribes a command from a particular Device
Device_IDID of the Device which has Unsubscribed Topic
topicUnsubscribed 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:

ParameterValue Detail
network_chosenChose a Network to Unsubscribes all commands

Response:

    { 
      '“Status”:All topics of connected Device are unsubscribed'
    }

//