Access Keys:
Skip to content (Access Key - 0)
 

Beehive 3.0 REST XML API documentation(support JDBC)

The following document describes the Beehive 3.0 REST/XML API(support JDBC) which supports XML.

By default the response format is XML, you can also specify the Accept header too.

For verifying authentication by crowd, so modified the HTTP basic header Authorization, from "Basic base64(username:md5(password,username))" to "Basic base64(username:password)"

New feature:

  • user save/query/delete
  • device save/query/delete
  • device command save/query/delete
  • sensor save/query/delete
  • switch save/query/delete
  • slider save/query/delete
  • device macro save/query/delete
  • controller config save/query/delete

Index:

(1) Export a LIRC configuration as a text file, concatenate different RemoteSection.

  • Request URL:
    /lirc.conf
  • Request Method: GET
  • Parameters: ids (RemoteSection ids, separate by comma)
  • Output:Combined Configuration files content as String.
  • Sample Response:
    #
    # This config file has been automatically converted from a device file
    # found in the 06/26/00 release of the Windows Slink-e software
    # package.
    #
    # Many thanks to Colby Boles of Nirvis Systems Inc. for allowing us to
    # use these files.
    #
    # The original filename was: "3m mp8640 3m lcd projector.cde"
    #
    # The original description for this device was:
    #
    # 3m mp8640 3m lcd projector
    #
    
    
    
    begin remote
      name                    MP8640
      bits                    32
      flags                   SPACE_ENC
      eps                     20
      aeps                    200
    
      header                  8800 4400
      one                     550 1650
      zero                    550 550
      ptrail                  550
      repeat                  8800 2200
      gap                     38500
      toggle_bit              0
    
      frequency               38000
    
          begin codes
              STANDBY/ON              0x000000000AF5E817
              VOLUME'/\'              0x000000000AF548B7
              ...
    
          end codes
    
    end remote
    
    
    
    #
    # this config file was automatically generated
    # using lirc-0.6.6(serial) on Sat May 24 18:35:13 2003
    #
    # contributed by
    #
    # brand:                       Abit
    # model no. of remote control: ?
    # devices being controlled by this remote: AU10 audio card / windvd
    #
    
    
    begin remote
    
      name                    ABIT_WINDVD
      bits                    16
      flags                   SPACE_ENC|CONST_LENGTH
      eps                     30
      aeps                    100
    
      header                  9149 4422
      one                     666 1569
      zero                    666 474
      ptrail                  666
      pre_data_bits           16
      pre_data                0x807F
      gap                     108554
      toggle_bit              0
    
          begin codes
              OnOff                   0x000000000000E01F
              Mute                    0x00000000000010EF
              Title                   0x000000000000906F
              Screen                  0x00000000000050AF
              eject                   0x000000000000D02F
              ...
          end codes
    
    
    end remote
    
    

(2) List all hardware vendors in the database

  • Request URL:
    /lirc
  • Request Method: GET
  • Output:xml of a vendors list.
  • Sample Response:
    • content-type:application/xml
      <vendors>
          <vendor>
              <id>1</id>
              <name>3m</name>
          </vendor>
          <vendor>
              <id>2</id>
              <name>abit</name>
         </vendor>
         ...
      </vendors>
      
  • Errors:
    • Error Code:204, No Content. See HTTP/1.1 documentation.If system has no Vendor at all.

(3) List all models of a vendor in the database

  • Request URL:
    /lirc/{vendor_name}
  • Request Method: GET
  • Sample Response:
    • content-type:application/xml:
      <models>
        <model>
          <id>1</id>
          <name>MP8640</name>
        </model>
      </models>
      
  • Errors:
    • Error Code:404, Not Found. See HTTP/1.1 documentation. If system can't find such a Vendor .
    • Error Code:204, No Content. See HTTP/1.1 documentation. If this Vendor has no Model at all .

(4) List all RemoteSections of a model in the database

  • Request URL:
    /lirc/{vendor_name}/{model_name}
  • Request Method: GET
  • Sample Response:
    • content-type:application/xml:
      <sections>
         <section>
             <id>1</id>
             <comment>
      	    #
                  # This config file has been automatically converted from a device file.
      	    #...
      	</comment>
      	<name>MP8640</name>
      	<raw>false</raw>
          </section>
      </sections>
      
  • Errors:
    • Error Code:404, Not Found. See HTTP/1.1 documentation. If system can't find such a RemoteSection .

(5) List all RemoteOptions of a RemoteSection in the database

  • Request URL:
     /lirc/{vendor_name}/{model_name}/{section_id}/options
  • Request Method: GET
  • Sample Response:
    • content-type:application/xml:
      <options>
        <option>
           <id>1</id>
           <comment></comment>
           <name>name</name>
           <value>MP8640</value>
         </option>
        ...
      <options>
      
  • Errors:
    • Error Code:204, No Content. See HTTP/1.1 documentation. If this RemoteSection has no RemoteOption at all .

(6) List all Codes of a Section in the database

  • Request URL:
     /lirc/{vendor_name}/{model_name}/{section_id}/codes
  • Request Method: GET
  • Sample Response:
    • content-type:application/xml:
      <codes>
        <code>
          <id>1</id>
          <comment></comment>
          <name>STANDBY/ON</name>
          <remoteName>MP8640</remoteName>
          <value>0x000000000AF5E817</value>
        </code>
        ...
      </codes>
      
  • Errors:
    • Error Code:204, No Content. See HTTP/1.1 documentation. If this RemoteSection has no Code at all .

(7) List all icons identified by button command name (Included in M2)

  • Request URL:
     /icons/{icon_name}
  • Request Method: GET
  • Sample Response:
    • content-type:application/xml:
      <icons>
        <icon>
           <id>21</id>
           <fileName>http://localhost:8080/beehive/icons/menu.png</fileName>
           <name>menu</name>
        </icon>
        ...
      </icons>
      
  • Errors:
    • Error Code:404, Not Found. See HTTP/1.1 documentation. If system can't find any icons.
    • Error Code:204, No Content. See HTTP/1.1 documentation. If this button has no icons at all .

(8) List all icons (Included in M2)

  • Request URL:
     /icons
  • Request Method: GET
  • Sample Response:
    • content-type:application/xml:
      <icons>
        <icon>
           <id>1</id>
           <fileName>http://localhost:8080/beehive/icons/power.png</fileName>
           <name>power</name>
        </icon>
        <icon>
           <id>2</id>
           <fileName>http://localhost:8080/beehive/icons/home.png</fileName>
           <name>home</name>
        </icon>
        ...
      </icons>
      
  • Errors:
    • Error Code:404, Not Found. See HTTP/1.1 documentation. If system can't find any icons.
    • Error Code:204, No Content. See HTTP/1.1 documentation. If this button has no icons at all .

(9) Get all templates from account (Included in M7)

  • Request URL:
     /account/{account_id}/templates/{share_scope}
  • Sample Response:
    • content-type:application/xml:
      <templates>
      	<template>
      		<id>3</id>
      		<content>content...</content>
      		<keywords>sony,tv</keywords>
      		<name>t3</name>
      	</template>
              ...
      </templates>
      
  • Errors:
    • Error Code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:404, Not Found. See HTTP/1.1 documentation. If can't find any template.

(10) Save a template into account (Included in M7)

  • Request URL:
     /account/{account_id}/template
  • Sample Response:
    • content-type:application/xml:
      	<template>
      		<id>3</id>
      		<content>content...</content>
      		<keywords>sony,tv</keywords>
      		<name>t3</name>
      	</template>
      
  • Errors:
    • Error Code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(11) Update a template into account (Included in M7)

  • Request URL:
     /account/{account_id}/template/{template_id}
  • Request Method: PUT
  • Parameters: account_id(account id), template_id (template id)
  • HTTP basic header Authorization : "Basic base64(username:password,username)"
  • Sample Request Url:http://localhost:8080/beehive/rest/account/1/template/1
  • Output:xml of the updated template in account.
  • Sample Response:
    • content-type:application/xml:
      	<template>
      		<id>3</id>
      		<content>content...</content>
      		<keywords>sony,tv</keywords>
      		<name>t3</name>
      	</template>
      
  • Errors:
    • Error Code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(12) Delete a template from account (Included in M7)

  • Request URL:
     /account/{account_id}/template/{template_id}
  • Sample Response:
    • if success :
      	true
      
    • if fail :
              false
      
  • Errors:
    • Error Code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(13) Upload template resource(images etc) into account (Included in M7)

  • Request URL:
     /account/{account_id}/template/{template_id}/resource
  • Sample Response:
    • if success :
      	true
      
    • if fail :
              false
      
  • Errors:
    • Error Code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(14) Download template resource(images etc) from account (Included in M7)

  • Request URL:
     /account/{account_id}/template/{template_id}/resource
  • Errors:
    • Error Code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:404, openremote.zip not found. See HTTP/1.1 documentation.

(15) Upload account resource(openremote.zip for controller) into account (Included in M7)

  • Request URL:
     /account/{account_id}/openremote.zip
  • Sample Response:
    • if success :
      	true
      
    • if fail :
              false
      
  • Errors:
    • Error Code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(16) Download account resource(openremote.zip for controller) from account (Included in M7)

  • Request URL:
     /user/{username}/openremote.zip
  • Errors:
    • Error Code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:404, openremote.zip not found. See HTTP/1.1 documentation.

(17) Search public templates by keywords from others (Included in M7)

  • Request URL:
     /templates/keywords/{keywords}/page/{page}
  • Sample Response:
    • content-type:application/xml:
      <templates>
      	<template>
      		<id>3</id>
      		<content>content...</content>
      		<keywords>sony,tv</keywords>
      		<name>t3</name>
      	</template>
              ...
      </templates>
      
  • Errors:
    • Error Code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:404, Not Found. See HTTP/1.1 documentation. If can't find any template.

(18) WYSIWYG testing, show available panel list (Included in M7)

  • Request URL:
     /user/{username}/rest/panels
  • Sample Response:
    <openremote>
    	<panel id="xxx" name="iphone 1" />
            ...
    </openremote>
    
  • Errors:
    • Error Code:426, panel.xml not found.
    • Error Code:427, Invalid panel.xml.

(19) WYSIWYG testing, show panel UI content by panel name (Included in M7)

  • Request URL:
     /user/{username}/rest/panel/{panel_name}
  • Sample Response:
    <openremote xmlns="http://www.openremote.org" xmlns:xsi="htt//www.w3.org/2001/XMLSchema-instance" xmlns:schemaLocation="htt//www.openremote.org panel.xsd">
      <screens>
        <screen id="3" name="Starting Screen" inverseScreenId="5">
          <background fillScreen="true">
            <image src="background1270803578135.png" />
          </background>
          <absolute left="17" top="63" width="150" height="50">
            <label id="44" fontSize="14" color="#000000" text="Donna's home" />
          </absolute>
          <grid left="5" top="103" width="200" height="200" rows="4" cols="4">
            <cell x="2" y="0" rowspan="1" colspan="2">
              <button id="19" name="Login">
                <navigate to="login" />
              </button>
            </cell>
            <cell x="2" y="1" rowspan="1" colspan="2">
              <switch id="29" />
            </cell>
          </grid>
        </screen>
        <screen id="5" name="Starting Screen" landscape="true" inverseScreenId="3">
          <background relative="CENTER">
            <image src="Picture11270819622002.png" />
          </background>
        </screen>
        <screen id="30" name="s2">
          <background fillScreen="true">
            <image src="1270799825satellite1270809371836.png" />
          </background>
          <absolute left="82" top="336" width="224" height="52">
            <button id="37" name="Button" />
          </absolute>
          <grid left="4" top="112" width="300" height="200" rows="4" cols="4">
            <cell x="2" y="0" rowspan="1" colspan="2">
              <button id="33" name="Button" />
            </cell>
            <cell x="1" y="1" rowspan="2" colspan="1">
              <switch id="35" />
            </cell>
            <cell x="0" y="3" rowspan="1" colspan="3">
              <slider id="39" passive="true" vertical="false" />
            </cell>
          </grid>
        </screen>
        <screen id="41" name="s1">
          <absolute left="67" top="183" width="150" height="50">
            <label id="46" fontSize="14" color="#FFFFFF" text="group2 screen1" />
          </absolute>
        </screen>
      </screens>
      <groups>
        <group id="2" name="Default Group">
          <tabbar>
            <item name="to g2">
              <navigate toGroup="40" />
            </item>
            <item name="setting">
              <navigate to="setting" />
              <image src="19gear1270809419929.png" />
            </item>
            <item name="p">
              <navigate to="previousScreen" />
            </item>
            <item name="n">
              <navigate to="nextScreen" />
            </item>
            <item name="back" />
          </tabbar>
          <include type="screen" ref="3" />
          <include type="screen" ref="5" />
          <include type="screen" ref="30" />
        </group>
        <group id="40" name="g2">
          <tabbar>
            <item name="to g1">
              <navigate toGroup="2" />
            </item>
            <item name="back">
              <navigate to="back" />
            </item>
          </tabbar>
          <include type="screen" ref="41" />
        </group>
      </groups>
    </openremote>
    
  • Errors:
    • Error Code:426, panel.xml not found.
    • Error Code:427, Invalid panel.xml.
    • Error Code:428, panel name not found.

(20) Create a new user with the Admin role, it will create a new account also(support JDBC)

  • Request URL:
     /manageuser/create
  • Output:xml of the new user.
  • Sample Response:
    • content-type:application/xml:
           
      <user>
          <id>2</id>
          <account>
               <id>2</id>
          </account>
          <username>macuser5</username>
      </user>
      
  • Errors:
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(21) Show user by user id(support JDBC)

  • Request URL:
     /manageuser/get/{user_id}
  • Sample Response:
    • content-type:application/xml:
      <user>
          <id>1</id>
          <account>
          <id>1</id>
          </account>
          <username>dan</username>
      </user>
      
  • Errors:
    • Error Code:404, No user found.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(22) Show user by user name(support JDBC)

  • Request URL:
     /manageuser/getbyname/{username}
  • Sample Response:
    • content-type:application/xml:
      <user>
          <id>1</id>
          <account>
          	<id>1</id>
          </account>
          <username>dan</username>
      </user>
      
  • Errors:
    • Error Code:404, No user found.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(23) Update User token and pendingRoleName by posted UserDTO(support JDBC)

  • Request URL:
     /manageuser/update
  • Request Method: POST
  • Parameters: userDTO(the received UserDTO Object, in post content)
  • Sample Request Url:http://localhost:8080/beehive/rest/manageuser/update
    • content-type:application/xml :
      <user>
          <id>2</id>
          <account>
          	<id>2</id>
          </account>
          <username>tomsky</username>
          <pendigRoleName>Admin</pendingRoleName>
      </user>
      
  • Output:true.
  • Errors:
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(24) Delete a user by user id(support JDBC)

  • Request URL:
     /manageuser/delete/{user_id}
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(25) Create an invitee by posted UserDTO under the specified Account(support JDBC)

  • Request URL:
     /manageuser/createinvitee/{account_id}
  • Request Method: POST
  • Parameters: userDTO(the received UserDTO Object, in post content), account_id(account id)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/manageuser/createinvitee/1
    • content-type:application/json :
      {"id":0,"pendingRoleName":"Admin","token":null,"username":"tomsky.wang@finalist.hk"}
  • Output:xml of the new invitee.
  • Sample Response:
    • content-type:application/xml:
           
      <user>
          <id>2</id>
          <account>
             <id>1</id>
          </account>
          <pendingRoleName>Admin</pendingRoleName>
          <username>tomsky.wang@finalist.hk</username>
      </user>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(26) Show all users under an Account.(support JDBC)

  • Request URL:
     /manageuser/loadall/{account_id}
  • Sample Response:
    • content-type:application/xml:
           
      <users>
           <user>
               <id>1</id>
               <account>
                  <id>1</id>
               </account>
               <username>dan</username>
           </user>
           <user>
               <id>2</id>
               <account>
                  <id>1</id>
               </account>
               <pendingRoleName>Admin</pendingRoleName>
               <username>tomsky.wang@finalist.hk</username>
           </user>
      </users>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error code:404, Not Found. See HTTP/1.1 documentation. If can't find any users.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(27) Create an new simple device under an account, it just includes name,vendor and model(support JDBC)

  • Request URL:
     /device/save/{account_id}
  • Request Method: POST
  • Parameters: deviceDTO(the received DeviceDTO Object, in post content), account_id(account id)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/device/save/1
    • content-type:application/xml :
      <device>
        <id>0</id>
        <name>device1</name>
        <model>dev</model>
        <vendor>dev</vendor>
      </device>
      
  • Output:xml of the new device.
  • Sample Response:
    • content-type:application/json :
      <device>
        <id>1</id>
        <name>device1</name>
        <model>dev</model>
        <vendor>dev</vendor>
      </device>  
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(28) Create an new device with contents, the contents includes commands, sensors, switchs and sliders(support JDBC)

  • Request URL:
     /device/savewithcontent/{account_id}
  • Request Method: POST
  • Parameters: deviceDTO(the received DeviceDTO Object, in post content), account_id(account id)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/device/savewithcontent/1
    • content-type:application/xml :
      <device>
        <id>1</id>
        <name>DeviceWithContent</name>
        <model>devc</model>
        <vendor>devc</vendor>
        <account>
            <id>1</id>
        </account>
      
        <deviceCommands>
         <deviceCommand>
             <id>0</id>
             <name>cmd1</name>
             <protocol>
                 <id>0</id>
                 <attributes><attribute><id>0</id><name>url</name><value>http://cmd1.com</value></attribute></attributes>
                 <type>HTTP</type>
              </protocol>
          </deviceCommand>
          ......
        </deviceCommands>
      
        <sensors>
           <sensor>
             <id>0</id>
             <name>switchsensor</name>
             <sensorCommandRef>
               <id>0</id>
               <deviceCommand>
                 <id>0</id>
                 <name>cmd3</name>
                 <protocol>
                   <id>0</id>
                   <attributes><attribute><id>0</id><name>url</name><value>http://cmd3.com</value></attribute></attributes>
                   <type>HTTP</type>
                 </protocol>
               </deviceCommand>
             </sensorCommandRef>
             <type>SWITCH</type>
            </sensor>
            ......
         </sensors>
      
         <sliders>
            <slider>
              <id>0</id>
              <name>slider1</name>
              <setValueCmd>
                <id>0</id>
                <deviceCommand>
                  <id>0</id>
                  <name>cmd6</name>
                  <protocol><id>0</id><attributes><attribute><id>0</id><name>url</name><value>http://cmd6.com</value></attribute></attributes><type>HTTP</type></protocol>
                </deviceCommand>
              </setValueCmd>
              <sliderSensorRef>
                 <id>0</id>
                 <sensor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="rangeSensorDTO">
                     <id>0</id>
                     <name>slidersensor</name>
                     <sensorCommandRef>
                         <id>0</id>
                         <deviceCommand>
                            <id>0</id>
                            <device><id>0</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
                            <name>cmd5</name>
                            <protocol>
                              <id>0</id><attributes><attribute><id>0</id><name>url</name><value>http://cmd5.com</value></attribute></attributes><type>HTTP</type>
                            </protocol>
                         </deviceCommand>
                     </sensorCommandRef>
                     <type>RANGE</type>
                     <max>100</max>
                     <min>1</min>
                  </sensor>
               </sliderSensorRef>
           </slider>
        </sliders>
      
        <switchs>
           <switch>
             <id>0</id>
             <name>switch1</name>
             <switchCommandOffRef>
               <id>0</id>
               <deviceCommand>
                  <id>0</id>
                  <name>cmd2</name>
                  <protocol><id>0</id><attributes><attribute><id>0</id><name>url</name><value>http://cmd2.com</value></attribute></attributes><type>HTTP</type></protocol>
               </deviceCommand>
             </switchCommandOffRef>
             <switchCommandOnRef>
               <id>0</id>
               <deviceCommand>
                  <id>0</id>
                  <device><id>0</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
                  <name>cmd1</name>
                  <protocol><id>0</id><attributes><attribute><id>0</id><name>url</name><value>http://cmd1.com</value></attribute></attributes><type>HTTP</type></protocol>
               </deviceCommand>
               </switchCommandOnRef>
               <switchSensorRef>
                 <id>0</id>
                 <sensor>
                    <id>0</id>
                    <name>switchsensor</name>
                    <sensorCommandRef>
                       <id>0</id>
                       <deviceCommand>
                          <id>0</id>
                          <name>cmd3</name>
                          <protocol><id>0</id><attributes><attribute><id>0</id><name>url</name><value>http://cmd3.com</value></attribute></attributes><type>HTTP</type></protocol>
                       </deviceCommand>
                    </sensorCommandRef>
                    <type>SWITCH</type>
                  </sensor>
               </switchSensorRef>
            </switch>
          </switchs>
      </device>
      
      
  • Output:xml or json of the new device.
  • Sample Response:
    • content-type:application/xml :
           
      <device>
        <id>1</id>
        <name>DeviceWithContent</name>
        <model>devc</model>
        <vendor>devc</vendor>
        <account>
            <id>1</id>
        </account>
      
        <deviceCommands>
         <deviceCommand>
             <id>1</id>
             <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
             <name>cmd1</name>
             <protocol>
                 <id>1</id>
                 <attributes><attribute><id>1</id><name>url</name><value>http://cmd1.com</value></attribute></attributes>
                 <type>HTTP</type>
              </protocol>
          </deviceCommand>
          ......
        </deviceCommands>
      
        <sensors>
           <sensor>
             <id>1</id>
             <device>
                <id>1</id>
                <model>devc</model>
                <name>DeviceWithContent</name>
                <vendor>devc</vendor>
             </device>
             <name>switchsensor</name>
             <sensorCommandRef>
               <id>1</id>
               <deviceCommand>
                 <id>3</id>
                 <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
                 <name>cmd3</name>
                 <protocol>
                   <id>3</id>
                   <attributes><attribute><id>3</id><name>url</name><value>http://cmd3.com</value></attribute></attributes>
                   <type>HTTP</type>
                 </protocol>
               </deviceCommand>
               <deviceName>DeviceWithContent</deviceName>
             </sensorCommandRef>
             <type>SWITCH</type>
            </sensor>
            ......
         </sensors>
      
         <sliders>
            <slider>
              <id>1</id>
              <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
              <name>slider1</name>
              <setValueCmd>
                <id>3</id>
                <deviceCommand>
                  <id>6</id>
                  <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
                  <name>cmd6</name>
                  <protocol><id>6</id><attributes><attribute><id>6</id><name>url</name><value>http://cmd6.com</value></attribute></attributes><type>HTTP</type></protocol>
                </deviceCommand>
                <deviceName>DeviceWithContent</deviceName>
              </setValueCmd>
              <sliderSensorRef>
                 <id>0</id>
                 <sensor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="rangeSensorDTO">
                     <id>2</id>
                     <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
                     <name>slidersensor</name>
                     <sensorCommandRef>
                         <id>2</id>
                         <deviceCommand>
                            <id>5</id>
                            <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
                            <name>cmd5</name>
                            <protocol>
                              <id>5</id><attributes><attribute><id>5</id><name>url</name><value>http://cmd5.com</value></attribute></attributes><type>HTTP</type>
                            </protocol>
                         </deviceCommand>
                         <deviceName>DeviceWithContent</deviceName>
                     </sensorCommandRef>
                     <type>RANGE</type>
                     <max>100</max>
                     <min>1</min>
                  </sensor>
               </sliderSensorRef>
           </slider>
        </sliders>
      
        <switchs>
           <switch>
             <id>1</id>
             <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
             <name>switch1</name>
             <switchCommandOffRef>
               <id>4</id>
               <deviceCommand>
                  <id>2</id>
                  <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
                  <name>cmd2</name>
                  <protocol><id>2</id><attributes><attribute><id>2</id><name>url</name><value>http://cmd2.com</value></attribute></attributes><type>HTTP</type></protocol>
               </deviceCommand>
               <deviceName>DeviceWithContent</deviceName>
             </switchCommandOffRef>
             <switchCommandOnRef>
               <id>5</id>
               <deviceCommand>
                  <id>1</id>
                  <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
                  <name>cmd1</name>
                  <protocol><id>1</id><attributes><attribute><id>1</id><name>url</name><value>http://cmd1.com</value></attribute></attributes><type>HTTP</type></protocol>
               </deviceCommand>
               <deviceName>DeviceWithContent</deviceName>
               </switchCommandOnRef>
               <switchSensorRef>
                 <id>1</id>
                 <sensor>
                    <id>1</id>
                    <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
                    <name>switchsensor</name>
                    <sensorCommandRef>
                       <id>1</id>
                       <deviceCommand>
                          <id>3</id>
                          <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
                          <name>cmd3</name>
                          <protocol><id>3</id><attributes><attribute><id>3</id><name>url</name><value>http://cmd3.com</value></attribute></attributes><type>HTTP</type></protocol>
                       </deviceCommand>
                       <deviceName>DeviceWithContent</deviceName>
                    </sensorCommandRef>
                    <type>SWITCH</type>
                  </sensor>
               </switchSensorRef>
            </switch>
          </switchs>
      </device>
      
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(29) Show a list of devices with simple properties under an account, each device includes id, name, vendor and model(support JDBC)

  • Request URL:
     /device/loadall/{account_id}
  • Sample Response:
    • content-type:application/json :
      <devices>
        <device>
         <id>1</id>
         <model>devc</model>
         <name>device1</name>
         <vendor>devc</vendor>
        </device>
      </devices>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error code:404, Not Found. See HTTP/1.1 documentation. If can't find any devices.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(30) Show a device by device id, it includes commands,sensors,sliders and switchs(support JDBC)

  • Request URL:
     /device/load/{device_id}
  • Sample Response:
    • content-type:application/xml :
           
      <device>
        <id>1</id>
        <name>DeviceWithContent</name>
        <model>devc</model>
        <vendor>devc</vendor>
        <account>
            <id>1</id>
        </account>
      
        <deviceCommands>
         <deviceCommand>
             <id>1</id>
             <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
             <name>cmd1</name>
             <protocol>
                 <id>1</id>
                 <attributes><attribute><id>1</id><name>url</name><value>http://cmd1.com</value></attribute></attributes>
                 <type>HTTP</type>
              </protocol>
          </deviceCommand>
          ......
        </deviceCommands>
      
        <sensors>
           <sensor>
             <id>1</id>
             <device>
                <id>1</id>
                <model>devc</model>
                <name>DeviceWithContent</name>
                <vendor>devc</vendor>
             </device>
             <name>switchsensor</name>
             <sensorCommandRef>
               <id>1</id>
               <deviceCommand>
                 <id>3</id>
                 <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
                 <name>cmd3</name>
                 <protocol>
                   <id>3</id>
                   <attributes><attribute><id>3</id><name>url</name><value>http://cmd3.com</value></attribute></attributes>
                   <type>HTTP</type>
                 </protocol>
               </deviceCommand>
               <deviceName>DeviceWithContent</deviceName>
             </sensorCommandRef>
             <type>SWITCH</type>
            </sensor>
            ......
         </sensors>
      
         <sliders>
            <slider>
              <id>1</id>
              <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
              <name>slider1</name>
              <setValueCmd>
                <id>3</id>
                <deviceCommand>
                  <id>6</id>
                  <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
                  <name>cmd6</name>
                  <protocol><id>6</id><attributes><attribute><id>6</id><name>url</name><value>http://cmd6.com</value></attribute></attributes><type>HTTP</type></protocol>
                </deviceCommand>
                <deviceName>DeviceWithContent</deviceName>
              </setValueCmd>
              <sliderSensorRef>
                 <id>0</id>
                 <sensor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="rangeSensorDTO">
                     <id>2</id>
                     <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
                     <name>slidersensor</name>
                     <sensorCommandRef>
                         <id>2</id>
                         <deviceCommand>
                            <id>5</id>
                            <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
                            <name>cmd5</name>
                            <protocol>
                              <id>5</id><attributes><attribute><id>5</id><name>url</name><value>http://cmd5.com</value></attribute></attributes><type>HTTP</type>
                            </protocol>
                         </deviceCommand>
                         <deviceName>DeviceWithContent</deviceName>
                     </sensorCommandRef>
                     <type>RANGE</type>
                     <max>100</max>
                     <min>1</min>
                  </sensor>
               </sliderSensorRef>
           </slider>
        </sliders>
      
        <switchs>
           <switch>
             <id>1</id>
             <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
             <name>switch1</name>
             <switchCommandOffRef>
               <id>4</id>
               <deviceCommand>
                  <id>2</id>
                  <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
                  <name>cmd2</name>
                  <protocol><id>2</id><attributes><attribute><id>2</id><name>url</name><value>http://cmd2.com</value></attribute></attributes><type>HTTP</type></protocol>
               </deviceCommand>
               <deviceName>DeviceWithContent</deviceName>
             </switchCommandOffRef>
             <switchCommandOnRef>
               <id>5</id>
               <deviceCommand>
                  <id>1</id>
                  <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
                  <name>cmd1</name>
                  <protocol><id>1</id><attributes><attribute><id>1</id><name>url</name><value>http://cmd1.com</value></attribute></attributes><type>HTTP</type></protocol>
               </deviceCommand>
               <deviceName>DeviceWithContent</deviceName>
               </switchCommandOnRef>
               <switchSensorRef>
                 <id>1</id>
                 <sensor>
                    <id>1</id>
                    <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
                    <name>switchsensor</name>
                    <sensorCommandRef>
                       <id>1</id>
                       <deviceCommand>
                          <id>3</id>
                          <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
                          <name>cmd3</name>
                          <protocol><id>3</id><attributes><attribute><id>3</id><name>url</name><value>http://cmd3.com</value></attribute></attributes><type>HTTP</type></protocol>
                       </deviceCommand>
                       <deviceName>DeviceWithContent</deviceName>
                    </sensorCommandRef>
                    <type>SWITCH</type>
                  </sensor>
               </switchSensorRef>
            </switch>
          </switchs>
      </device>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(31) Update Device name,vendor and model(support JDBC)

  • Request URL:
     /device/update
  • Request Method: POST
  • Parameters: deviceDTO(the received DeviceDTO Object, in post content)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/device/update
    • content-type:application/xml :
      <device>
         <id>1</id>
         <model>update</model>
         <name>Update device</name>
         <vendor>update</vendor>
      </device>
      
  • Output:true.
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(32) Delete a device by device id(support JDBC)

  • Request URL:
     /device/delete/{device_id}
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(33) Show a list of devices with same contents except id under an Account(support JDBC)

  • Request URL:
     /device/loadsamedevices/{account_id}
  • Request Method: GET
  • Parameters: deviceDTO(the device to be compared, its not specified id, in post content), account_id(account id)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/device/loadsamedevices/1
    • content-type:application/xml :
      <device>
         <id>0</id>
         <model>dev</model>
         <name>device1</name>
         <vendor>dev</vendor>
      </device>
      
  • Output:xml or json of a list of devices.
  • Sample Response:
    • content-type:application/json :
           
      <devices>
        <device>
         <id>0</id>
         <model>dev</model>
         <name>device1</name>
         <vendor>dev</vendor>
        </device>
      </devices>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error code:404, Not Found. See HTTP/1.1 documentation. If can't find any devices.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(34) Create an new device command(support JDBC)

  • Request URL:
     /devicecommand/save
  • Request Method: POST
  • Parameters: deviceCommandDTO(the received DeviceCommandDTO Object, in post content)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/devicecommand/save
    • content-type:application/xml :
      <deviceCommand>
         <id>0</id>
         <name>cmd1</name>
         <protocol>
             <id>0</id>
             <attributes><attribute><id>0</id><name>url</name><value>http://cmd1.com</value></attribute></attributes>
             <type>HTTP</type>
         </protocol>
         <device>
             <id>1</id>
             <model>dev</model>
             <name>device1</name>
             <vendor>dev</vendor>
         </device>
      </deviceCommand>
      
  • Output:xml of the new device command, it has the specified id.
  • Sample Response:
    • content-type:application/xml :
      <deviceCommand>
         <id>1</id>
         <name>command1</name>
         <protocol>
             <id>1</id>
             <attributes><attribute><id>1</id><name>url</name><value>http://cmd1.com</value></attribute></attributes>
             <type>HTTP</type>
         </protocol>
         <device>
             <id>1</id>
             <model>dev</model>
             <name>device1</name>
             <vendor>dev</vendor>
         </device>
      </deviceCommand>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(35) Show a device command by command id(support JDBC)

  • Request URL:
     /devicecommand/load/{command_id}
  • Sample Response:
    • content-type:application/xml :
      <deviceCommand>
         <id>1</id>
         <name>command1</name>
         <protocol>
             <id>1</id>
             <attributes><attribute><id>1</id><name>url</name><value>http://cmd1.com</value></attribute></attributes>
             <type>HTTP</type>
         </protocol>
         <device>
             <id>1</id>
             <model>dev</model>
             <name>device1</name>
             <vendor>dev</vendor>
         </device>
      </deviceCommand>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(36) Update a device command(support JDBC)

  • Request URL:
     /devicecommand/update
  • Request Method: POST
  • Parameters: deviceCommandDTO(the received DeviceCommandDTO Object, in post content)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/devicecommand/update
    • content-type:application/xml :
      <deviceCommand>
         <id>1</id>
         <name>update command1</name>
         <protocol>
             <id>0</id>
             <attributes><attribute><id>0</id><name>url</name><value>http://cmd1.com</value></attribute></attributes>
             <type>HTTP</type>
         </protocol>
         <device>
             <id>1</id>
             <model>dev</model>
             <name>device1</name>
             <vendor>dev</vendor>
         </device>
      </deviceCommand>
      
  • Output:xml of the updated device command.
  • Sample Response:
    • content-type:application/xml :
      <deviceCommand>
         <id>1</id>
         <name>update command1</name>
         <protocol>
             <id>2</id>
             <attributes><attribute><id>2</id><name>url</name><value>http://cmd1.com</value></attribute></attributes>
             <type>HTTP</type>
         </protocol>
         <device>
             <id>1</id>
             <model>dev</model>
             <name>device1</name>
             <vendor>dev</vendor>
         </device>
      </deviceCommand>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(37) Delete a device command by command id(support JDBC)

  • Request URL:
     /devicecommand/delete/{command_id}
  • Sample Response:
    • If success:
       true
    • If fail:
       false
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(38) Create a list of device commands(support JDBC)

  • Request URL:
     /devicecommand/saveall
  • Request Method: POST
  • Parameters: deviceCommandListing(includes a list of deviceCommandDTOs, in post content)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/devicecommand/save
    • content-type:application/xml :
           
      <deviceCommands>
        <deviceCommand>
          <id>0</id>
          <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
          <name>STANDBY/ON</name>
          <protocol>
            <id>0</id>
            <attributes>
               <attribute><id>0</id><name>name</name><value>MP8640</value></attribute>
               <attribute><id>0</id><name>command</name><value>STANDBY/ON</value></attribute>
            </attributes>
            <type>Infrared</type>
          </protocol>
          <sectionId>1</sectionId>
        </deviceCommand>
        ......
      </deviceCommands>
      
  • Output:xml of a deviceCommandListing(includes a list of deviceCommandDTOs), each deviceCommandDTO has the specified id.
  • Sample Response:
    • content-type:application/xml :
           
      <deviceCommands>
        <deviceCommand>
          <id>1</id>
          <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
          <name>STANDBY/ON</name>
          <protocol>
            <id>1</id>
            <attributes>
               <attribute><id>1</id><name>name</name><value>MP8640</value></attribute>
               <attribute><id>2</id><name>command</name><value>STANDBY/ON</value></attribute>
            </attributes>
            <type>Infrared</type>
          </protocol>
          <sectionId>1</sectionId>
        </deviceCommand>
        ......
      </deviceCommands>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(39) Show a list of DeviceCommands under a device by by device id(support JDBC)

  • Request URL:
     /devicecommand/loadbydevice/{device_id}
  • Sample Response:
    • content-type:application/xml :
           
      <deviceCommands>
        <deviceCommand>
          <id>1</id>
          <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
          <name>STANDBY/ON</name>
          <protocol>
            <id>1</id>
            <attributes>
               <attribute><id>1</id><name>name</name><value>MP8640</value></attribute>
               <attribute><id>2</id><name>command</name><value>STANDBY/ON</value></attribute>
            </attributes>
            <type>Infrared</type>
          </protocol>
          <sectionId>1</sectionId>
        </deviceCommand>
        ......
      </deviceCommands>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(40) Show a list of deviceCommandDTOs, each of them has the same properties with the specified deviceCommandDTO(support JDBC)

  • Request URL:
     /devicecommand/loadsamecommands
  • Request Method: GET
  • Parameters: deviceCommandDTO(the device command to be compared, its not specified id, in post content), account_id(account id)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/devicecommand/loadsamecommands
    • content-type:application/xml :
        <deviceCommand>
          <id>0</id>
          <device><id>0</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
          <name>STANDBY/ON</name>
          <protocol>
            <id>0</id>
            <attributes>
               <attribute><id>0</id><name>name</name><value>MP8640</value></attribute>
               <attribute><id>0</id><name>command</name><value>STANDBY/ON</value></attribute>
            </attributes>
            <type>Infrared</type>
          </protocol>
          <sectionId>1</sectionId>
        </deviceCommand>
      
  • Output:xml of a list of device commands.
  • Sample Response:
    • content-type:application/xml :
           
      <deviceCommands>
        <deviceCommand>
          <id>1</id>
          <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
          <name>STANDBY/ON</name>
          <protocol>
            <id>1</id>
            <attributes>
               <attribute><id>1</id><name>name</name><value>MP8640</value></attribute>
               <attribute><id>2</id><name>command</name><value>STANDBY/ON</value></attribute>
            </attributes>
            <type>Infrared</type>
          </protocol>
          <sectionId>1</sectionId>
        </deviceCommand>
        ......
      </deviceCommands>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(41) Create a new sensor under an account(support JDBC)

  • Request URL:
     /sensor/save/{account_id}
  • Request Method: POST
  • Parameters: sensorDTO(the received SensorDTO Object, in post content), account_id(account id)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/sensor/save/1
    • content-type:application/xml :
      <sensor>
        <id>0</id>
        <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
        <name>switchsensor</name>
        <sensorCommandRef>
           <id>0</id>
           <deviceCommand>
              <id>1</id>
              <name>command1</name>
           </deviceCommand>
        </sensorCommandRef>
        <type>SWITCH</type>
      </sensor>
      
  • Output:xml of the new sensor, it has the specified id.
  • Sample Response:
    • content-type:application/xml :
           
      <sensor>
        <id>1</id>
        <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
        <name>switchsensor</name>
        <sensorCommandRef>
           <id>1</id>
           <deviceCommand>
              <id>1</id>
              <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
              <name>command1</name>
           </deviceCommand>
           <deviceName>device1</deviceName>
        </sensorCommandRef>
        <type>SWITCH</type>
      </sensor>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(42) Update a sensor(support JDBC)

  • Request URL:
     /sensor/update
  • Request Method: POST
  • Parameters: sensorDTO(the received SensorDTO Object, in post content)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/sensor/update
    • content-type:application/xml :
           
      <sensor>
        <id>1</id>
        <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
        <name>Update switchsensor</name>
        <sensorCommandRef>
           <id>1</id>
           <deviceCommand>
              <id>1</id>
              <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
              <name>command1</name>
           </deviceCommand>
        </sensorCommandRef>
        <type>SWITCH</type>
      </sensor>
      
  • Output:xml or json of the updated sensor.
  • Sample Response:
    • content-type:application/xml :
           
      <sensor>
        <id>1</id>
        <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
        <name>Update switchsensor</name>
        <sensorCommandRef>
           <id>1</id>
           <deviceCommand>
              <id>1</id>
              <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
              <name>command1</name>
           </deviceCommand>
           <deviceName>device1</deviceName>
        </sensorCommandRef>
        <type>SWITCH</type>
      </sensor>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(43) Delete a sensor by sensor id(support JDBC)

  • Request URL:
     /sensor/delete/{sensor_id}
  • Sample Response:
    • If success:
       true
    • If fail:
       false
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(44) Show a list of sensors under an account(support JDBC)

  • Request URL:
     /sensor/loadall/{account_id}
  • Sample Response:
    • content-type:application/json :
      <sensors>
       <sensor>
        <id>1</id>
        <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
        <name>Update switchsensor</name>
        <sensorCommandRef>
           <id>1</id>
           <deviceCommand>
              <id>1</id>
              <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
              <name>command1</name>
           </deviceCommand>
           <deviceName>device1</deviceName>
        </sensorCommandRef>
        <type>SWITCH</type>
       </sensor>
      </sensors>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error code:404, Not Found. See HTTP/1.1 documentation. If can't find any sensors.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(45) Show a sensor by sensor id(support JDBC)

  • Request URL:
     /sensor/load/{sensor_id}
  • Sample Response:
    • content-type:application/xml :
           
      <sensor>
        <id>1</id>
        <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
        <name>Update switchsensor</name>
        <sensorCommandRef>
           <id>1</id>
           <deviceCommand>
              <id>1</id>
              <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
              <name>command1</name>
           </deviceCommand>
           <deviceName>device1</deviceName>
        </sensorCommandRef>
        <type>SWITCH</type>
      </sensor>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(46) Show a list of sensors, each of them has the same properties with the specified sensor(support JDBC)

  • Request URL:
     /sensor/loadsamesensors
  • Request Method: GET
  • Parameters: sensorDTO(the sensor to be compared, its not specified id, in post content)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/sensor/loadsamesensors
    • content-type:application/xml :
      <rangeSensor>
        <id>0</id>
        <device><id>0</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
        <name>rangesensor</name>
        <sensorCommandRef>
          <id>0</id>
          <deviceCommand>
            <id>0</id>
            <name>command2</name>
          </deviceCommand>
        </sensorCommandRef>
        <type>RANGE</type>
        <max>100</max>
        <min>1</min>
      </rangeSensor>
      
  • Output:xml of a list of sensors.
  • Sample Response:
    • content-type:application/xml :
      <sensors>  
       <rangeSensor>
        <id>1</id>
        <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
        <name>rangesensor</name>
        <sensorCommandRef>
          <id>1</id>
          <deviceCommand>
            <id>2</id>
            <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
            <name>command2</name>
          </deviceCommand>
          <deviceName>device1</deviceName>
        </sensorCommandRef>
        <type>RANGE</type>
        <max>100</max>
        <min>1</min>
       </rangeSensor>
      </sensors>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error code:404, Not Found. See HTTP/1.1 documentation. If can't find any sensors.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(47) Create a new switch under an account(support JDBC)

  • Request URL:
     /switch/save/{account_id}
  • Request Method: POST
  • Parameters: switchDTO(the received SwitchDTO Object, in post content), account_id(account id)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/switch/save/1
    • content-type:application/xml :
           
      <switch>
        <id>0</id>
        <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
        <name>lightswitch</name>
        <switchCommandOffRef>
          <id>0</id>
          <deviceCommand><id>2</id><name>off</name></deviceCommand>
        </switchCommandOffRef>
        <switchCommandOnRef>
          <id>0</id>
          <deviceCommand>
            <id>1</id>
            <name>on</name>
          </deviceCommand>
        </switchCommandOnRef>
        <switchSensorRef>
          <id>0</id>
          <sensor>
            <id>1</id>
            <name>lightsensor</name>
            <sensorCommandRef>
              <id>0</id>
              <deviceCommand><id>3</id><name>status</name></deviceCommand>
            </sensorCommandRef>
            <type>SWITCH</type>
          </sensor>
        </switchSensorRef>
      </switch>
      
  • Output:xml of the new switch, it has the specified id.
  • Sample Response:
    • content-type:application/xml :
           
      <switch>
        <id>1</id>
        <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
        <name>lightswitch</name>
        <switchCommandOffRef>
          <id>2</id>
          <deviceCommand>
            <id>2</id>
            <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
            <name>off</name>
          </deviceCommand>
          <deviceName>light</deviceName>
        </switchCommandOffRef>
        <switchCommandOnRef>
          <id>3</id>
          <deviceCommand>
            <id>1</id>
            <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
            <name>on</name>
          </deviceCommand>
          <deviceName>light</deviceName>
        </switchCommandOnRef>
        <switchSensorRef>
          <id>1</id>
          <sensor>
            <id>1</id>
            <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
            <name>lightsensor</name>
            <sensorCommandRef>
              <id>0</id>
              <deviceCommand><id>3</id><name>status</name></deviceCommand>
            </sensorCommandRef>
            <type>SWITCH</type>
          </sensor>
        </switchSensorRef>
      </switch>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(48) Update a switch(support JDBC)

  • Request URL:
     /switch/update
  • Request Method: POST
  • Parameters: switchDTO(the received SwitchDTO Object, in post content)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/switch/update
    • content-type:application/xml :
     
<switch>
  <id>1</id>
  <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
  <name>update lightswitch</name>
  <switchCommandOffRef>
    <id>1</id>
    <deviceCommand><id>2</id><name>off</name></deviceCommand>
  </switchCommandOffRef>
  <switchCommandOnRef>
    <id>1</id>
    <deviceCommand>
      <id>1</id>
      <name>on</name>
    </deviceCommand>
  </switchCommandOnRef>
  <switchSensorRef>
    <id>1</id>
    <sensor>
      <id>1</id>
      <name>lightsensor</name>
      <sensorCommandRef>
        <id>0</id>
        <deviceCommand><id>3</id><name>status</name></deviceCommand>
      </sensorCommandRef>
      <type>SWITCH</type>
    </sensor>
  </switchSensorRef>
</switch>
  • Output:xml of the updated switch.
  • Sample Response:
    • content-type:application/xml :
           
      <switch>
        <id>1</id>
        <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
        <name>update lightswitch</name>
        <switchCommandOffRef>
          <id>2</id>
          <deviceCommand>
            <id>2</id>
            <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
            <name>off</name>
          </deviceCommand>
          <deviceName>light</deviceName>
        </switchCommandOffRef>
        <switchCommandOnRef>
          <id>3</id>
          <deviceCommand>
            <id>1</id>
            <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
            <name>on</name>
          </deviceCommand>
          <deviceName>light</deviceName>
        </switchCommandOnRef>
        <switchSensorRef>
          <id>1</id>
          <sensor>
            <id>1</id>
            <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
            <name>lightsensor</name>
            <sensorCommandRef>
              <id>0</id>
              <deviceCommand><id>3</id><name>status</name></deviceCommand>
            </sensorCommandRef>
            <type>SWITCH</type>
          </sensor>
        </switchSensorRef>
      </switch>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(49) Delete a switch by switch id(support JDBC)

  • Request URL:
     /switch/delete/{switch_id}
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(50) Show a list of switchs under an account(support JDBC)

  • Request URL:
     /switch/loadall/{account_id}
  • Sample Response:
    • content-type:application/xml :
      <switchs>
       <switch>
        <id>1</id>
        <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
        <name>lightswitch</name>
        <switchCommandOffRef>
          <id>2</id>
          <deviceCommand>
            <id>2</id>
            <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
            <name>off</name>
          </deviceCommand>
          <deviceName>light</deviceName>
        </switchCommandOffRef>
        <switchCommandOnRef>
          <id>3</id>
          <deviceCommand>
            <id>1</id>
            <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
            <name>on</name>
          </deviceCommand>
          <deviceName>light</deviceName>
        </switchCommandOnRef>
        <switchSensorRef>
          <id>1</id>
          <sensor>
            <id>1</id>
            <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
            <name>lightsensor</name>
            <sensorCommandRef>
              <id>0</id>
              <deviceCommand><id>3</id><name>status</name></deviceCommand>
            </sensorCommandRef>
            <type>SWITCH</type>
          </sensor>
        </switchSensorRef>
       </switch>
      </switchs>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error code:404, Not Found. See HTTP/1.1 documentation. If can't find any switchs.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(51) Show a list of switchs, each of them has the same properties with the specified switch(support JDBC)

  • Request URL:
     /switch/loadsameswitchs
  • Request Method: GET
  • Parameters: switchDTO(the switch to be compared, its not specified id, in post content)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/switch/loadsameswitchs
    • content-type:application/xml :
           
      <switch>
        <id>0</id>
        <device><id>0</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
        <name>lightswitch</name>
        <switchCommandOffRef>
          <id>0</id>
          <deviceCommand><id>0</id><name>off</name></deviceCommand>
        </switchCommandOffRef>
        <switchCommandOnRef>
          <id>0</id>
          <deviceCommand>
            <id>0</id>
            <name>on</name>
          </deviceCommand>
        </switchCommandOnRef>
        <switchSensorRef>
          <id>0</id>
          <sensor>
            <id>0</id>
            <name>lightsensor</name>
            <sensorCommandRef>
              <id>0</id>
              <deviceCommand><id>3</id><name>status</name></deviceCommand>
            </sensorCommandRef>
            <type>SWITCH</type>
          </sensor>
        </switchSensorRef>
      </switch>
      
  • Output:xml of a list of switchs.
  • Sample Response:
    • content-type:application/xml :
      <switchs>
       <switch>
        <id>1</id>
        <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
        <name>lightswitch</name>
        <switchCommandOffRef>
          <id>2</id>
          <deviceCommand>
            <id>2</id>
            <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
            <name>off</name>
          </deviceCommand>
          <deviceName>light</deviceName>
        </switchCommandOffRef>
        <switchCommandOnRef>
          <id>3</id>
          <deviceCommand>
            <id>1</id>
            <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
            <name>on</name>
          </deviceCommand>
          <deviceName>light</deviceName>
        </switchCommandOnRef>
        <switchSensorRef>
          <id>1</id>
          <sensor>
            <id>1</id>
            <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
            <name>lightsensor</name>
            <sensorCommandRef>
              <id>0</id>
              <deviceCommand><id>3</id><name>status</name></deviceCommand>
            </sensorCommandRef>
            <type>SWITCH</type>
          </sensor>
        </switchSensorRef>
       </switch>
      </switchs>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error code:404, Not Found. See HTTP/1.1 documentation. If can't find any switchs.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(52) Create a new slider under an account(support JDBC)

  • Request URL:
     /slider/save/{account_id}
  • Request Method: POST
  • Parameters: sliderDTO(the received SliderDTO Object, in post content), account_id(account id)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/slider/save/1
    • content-type:application/xml :
           
      <slider>
        <id>0</id>
        <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
        <name>lightcolor</name>
        <setValueCmd>
          <id>0</id>
          <deviceCommand>
            <id>1</id>
            <name>setcolor</name>
          </deviceCommand>
        </setValueCmd>
        <sliderSensorRef>
          <id>0</id>
          <sensor>
            <id>1</id>
            <name>colorsensor</name>
            <sensorCommandRef>
              <id>1</id>
              <deviceCommand><id>2</id><name>colorstatus</name></deviceCommand>
            </sensorCommandRef>
            <type>COLOR</type>
          </sensor>
        </sliderSensorRef>
      </slider>
      
  • Output:xml of the new slider, it has the specified id.
  • Sample Response:
    • content-type:application/xml :
           
      <slider>
        <id>1</id>
        <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
        <name>lightcolor</name>
        <setValueCmd>
          <id>2</id>
          <deviceCommand>
            <id>1</id>
            <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
            <name>setcolor</name>
          </deviceCommand>
          <deviceName>light</deviceName>
        </setValueCmd>
        <sliderSensorRef>
          <id>1</id>
          <sensor>
            <id>1</id>
            <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
            <name>colorsensor</name>
            <sensorCommandRef>
              <id>0</id>
              <deviceCommand><id>2</id><name>colorstatus</name></deviceCommand>
            </sensorCommandRef>
            <type>COLOR</type>
          </sensor>
        </sliderSensorRef>
      </slider>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(53) Update a slider(support JDBC)

  • Request URL:
     /slider/update
  • Request Method: POST
  • Parameters: sliderDTO(the received SliderDTO Object, in post content)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/slider/update
    • content-type:application/xml :
           
      <slider>
        <id>1</id>
        <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
        <name>update lightcolor</name>
        <setValueCmd>
          <id>2</id>
          <deviceCommand>
            <id>1</id>
            <name>setcolor</name>
          </deviceCommand>
        </setValueCmd>
        <sliderSensorRef>
          <id>1</id>
          <sensor>
            <id>1</id>
            <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
            <name>colorsensor</name>
            <sensorCommandRef>
              <id>1</id>
              <deviceCommand><id>2</id><name>colorstatus</name></deviceCommand>
            </sensorCommandRef>
            <type>COLOR</type>
          </sensor>
        </sliderSensorRef>
      </slider>
      
  • Output:xml of the updated slider.
  • Sample Response:
    • content-type:application/xml :
           
      <slider>
        <id>1</id>
        <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
        <name>update lightcolor</name>
        <setValueCmd>
          <id>2</id>
          <deviceCommand>
            <id>1</id>
            <name>setcolor</name>
          </deviceCommand>
        </setValueCmd>
        <sliderSensorRef>
          <id>1</id>
          <sensor>
            <id>1</id>
            <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
            <name>colorsensor</name>
            <sensorCommandRef>
              <id>1</id>
              <deviceCommand><id>2</id><name>colorstatus</name></deviceCommand>
            </sensorCommandRef>
            <type>COLOR</type>
          </sensor>
        </sliderSensorRef>
      </slider>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(54) Delete a slider by slider id(support JDBC)

  • Request URL:
     /slider/delete/{slider_id}
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(55) Show a list of sliders under an account(support JDBC)

  • Request URL:
     /slider/loadall/{account_id}
  • Sample Response:
    • content-type:application/xml :
           
      <sliders>
        <slider>
          <id>1</id>
          <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
          <name>slider1</name>
          <setValueCmd>
            <id>3</id>
            <deviceCommand>
              <id>6</id>
              <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
              <name>cmd6</name>
              <protocol>
                <id>6</id>
                <attributes><attribute><id>6</id><name>url</name><value>http://cmd6.com</value></attribute></attributes>
                <type>HTTP</type>
              </protocol>
            </deviceCommand>
            <deviceName>DeviceWithContent</deviceName>
            </setValueCmd>
              <sliderSensorRef>
              <id>0</id>
              <sensor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="rangeSensorDTO">
                 <id>2</id>
                 <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
                 <name>slidersensor</name>
                 <sensorCommandRef>
                   <id>2</id>
                   <deviceCommand>
                     <id>5</id>
                     <device><id>1</id><model>devc</model><name>DeviceWithContent</name><vendor>devc</vendor></device>
                     <name>cmd5</name>
                     <protocol><id>5</id><attributes><attribute><id>5</id><name>url</name><value>http://cmd5.com</value></attribute></attributes><type>HTTP</type></protocol>
                   </deviceCommand>
                   <deviceName>DeviceWithContent</deviceName>
                 </sensorCommandRef>
                 <type>RANGE</type>
                 <max>100</max>
                 <min>1</min>
               </sensor>
             </sliderSensorRef>
          </slider>
      </sliders>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error code:404, Not Found. See HTTP/1.1 documentation. If can't find any sliders.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(56) Show a list of sliders, each of them has the same properties with the specified slider(support JDBC)

  • Request URL:
     /slider/loadsamesliders
  • Request Method: GET
  • Parameters: switchDTO(the switch to be compared, its not specified id, in post content)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/slider/loadsamesliders
    • content-type:application/xml :
           
      <slider>
        <id>0</id>
        <device><id>0</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
        <name>update lightcolor</name>
        <setValueCmd>
          <id>0</id>
          <deviceCommand>
            <id>0</id>
            <name>setcolor</name>
          </deviceCommand>
        </setValueCmd>
        <sliderSensorRef>
          <id>0</id>
          <sensor>
            <id>0</id>
            <device><id>0</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
            <name>colorsensor</name>
            <sensorCommandRef>
              <id>0</id>
              <deviceCommand><id>0</id><name>colorstatus</name></deviceCommand>
            </sensorCommandRef>
            <type>COLOR</type>
          </sensor>
        </sliderSensorRef>
      </slider>
      
  • Output:xml of a list of sliders.
  • Sample Response:
    • content-type:application/xml :
       
      <sliders>    
       <slider>
        <id>1</id>
        <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
        <name>update lightcolor</name>
        <setValueCmd>
          <id>2</id>
          <deviceCommand>
            <id>1</id>
            <name>setcolor</name>
          </deviceCommand>
        </setValueCmd>
        <sliderSensorRef>
          <id>1</id>
          <sensor>
            <id>1</id>
            <device><id>1</id><model>dev</model><name>light</name><vendor>dev</vendor></device>
            <name>colorsensor</name>
            <sensorCommandRef>
              <id>1</id>
              <deviceCommand><id>2</id><name>colorstatus</name></deviceCommand>
            </sensorCommandRef>
            <type>COLOR</type>
          </sensor>
        </sliderSensorRef>
       </slider>
      </sliders>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error code:404, Not Found. See HTTP/1.1 documentation. If can't find any sliders.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(57) Create a new deviceMacro under an account(support JDBC)

  • Request URL:
     /devicemacro/save/{account_id}
  • Request Method: POST
  • Parameters: deviceMacroDTO(the received DeviceMacroDTO Object, in post content), account_id(account id)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/slider/save/1
    • content-type:application/xml :
           
      <deviceMacro>
        <id>0</id>
        <account><id>1</id></account>
        <deviceMacroItems>
          <deviceCommandRef>
            <id>0</id>
            <deviceCommand>
              <id>1</id>
              <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
              <name>cmd1</name>
              <protocol><id>1</id><attributes><attribute><id>1</id><name>url</name><value>http://cmd1.com</value></attribute></attributes><type>HTTP</type></protocol>
            </deviceCommand>
          </deviceCommandRef>
          <commandDelay>
            <id>0</id>
            <delaySecond>3</delaySecond>
          </commandDelay>
          ......
        </deviceMacroItems>
        <name>macro1</name>
      </deviceMacro>
      
  • Output:xml of the new devicemacro, it has the specified id.
  • Sample Response:
    • content-type:application/xml :
           
      <deviceMacro>
        <id>1</id>
        <account><id>1</id></account>
        <deviceMacroItems>
          <deviceCommandRef>
            <id>1</id>
            <parentDeviceMacro><id>1</id><deviceMacroItems/><name>macro1</name></parentDeviceMacro>
            <deviceCommand>
              <id>1</id>
              <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
              <name>cmd1</name>
              <protocol><id>1</id><attributes><attribute><id>1</id><name>url</name><value>http://cmd1.com</value></attribute></attributes><type>HTTP</type></protocol>
            </deviceCommand>
            <deviceName>device1</deviceName>
          </deviceCommandRef>
          <commandDelay>
            <id>2</id>
            <parentDeviceMacro><id>1</id><deviceMacroItems/><name>macro1</name></parentDeviceMacro>
            <delaySecond>3</delaySecond>
          </commandDelay>
          ......
        </deviceMacroItems>
        <name>macro1</name>
      </deviceMacro>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(58) Update a devicemacro(support JDBC)

  • Request URL:
     /devicemacro/update
  • Request Method: POST
  • Parameters: deviceMacroDTO(the received DeviceMacroDTO Object, in post content)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/devicemacro/update
    • content-type:application/xml :
           
      <deviceMacro>
        <id>1</id>
        <account><id>1</id></account>
        <deviceMacroItems>
          <deviceCommandRef>
            <id>0</id>
            <deviceCommand>
              <id>1</id>
              <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
              <name>cmd1</name>
              <protocol><id>1</id><attributes><attribute><id>1</id><name>url</name><value>http://cmd1.com</value></attribute></attributes><type>HTTP</type></protocol>
            </deviceCommand>
            <deviceName>device1</deviceName>
          </deviceCommandRef>
          <commandDelay>
            <id>0</id>
            <delaySecond>3</delaySecond>
          </commandDelay>
          ......
        </deviceMacroItems>
        <name>update macro1</name>
      </deviceMacro>
      
  • Output:xml of the updated devicemacro.
  • Sample Response:
    • content-type:application/xml :
           
      <deviceMacro>
        <id>1</id>
        <account><id>1</id></account>
        <deviceMacroItems>
          <deviceCommandRef>
            <id>1</id>
            <parentDeviceMacro><id>1</id><deviceMacroItems/><name>macro1</name></parentDeviceMacro>
            <deviceCommand>
              <id>1</id>
              <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
              <name>cmd1</name>
              <protocol><id>1</id><attributes><attribute><id>1</id><name>url</name><value>http://cmd1.com</value></attribute></attributes><type>HTTP</type></protocol>
            </deviceCommand>
            <deviceName>device1</deviceName>
          </deviceCommandRef>
          <commandDelay>
            <id>2</id>
            <parentDeviceMacro><id>1</id><deviceMacroItems/><name>macro1</name></parentDeviceMacro>
            <delaySecond>3</delaySecond>
          </commandDelay>
          ......
        </deviceMacroItems>
        <name>update macro1</name>
      </deviceMacro>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(59) Delete a devicemacro by macro id(support JDBC)

  • Request URL:
     /devicemacro/delete/{macro_id}
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(60) Show deviceMacroItems under a deviceMacro by macro id(support JDBC)

  • Request URL:
     /devicemacro/loaditemsbyid/{macro_id}
  • Sample Response:
    • content-type:application/xml :
           
        <deviceMacroItems>
          <deviceCommandRef>
            <id>1</id>
            <parentDeviceMacro><id>1</id><deviceMacroItems/><name>macro1</name></parentDeviceMacro>
            <deviceCommand>
              <id>1</id>
              <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
              <name>cmd1</name>
              <protocol><id>1</id><attributes><attribute><id>1</id><name>url</name><value>http://cmd1.com</value></attribute></attributes><type>HTTP</type></protocol>
            </deviceCommand>
            <deviceName>device1</deviceName>
          </deviceCommandRef>
          <commandDelay>
            <id>2</id>
            <parentDeviceMacro><id>1</id><deviceMacroItems/><name>macro1</name></parentDeviceMacro>
            <delaySecond>3</delaySecond>
          </commandDelay>
          ......
        </deviceMacroItems>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error code:404, Not Found. See HTTP/1.1 documentation. If can't find any macro items.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(61) Show deviceMacros under an account(support JDBC)

  • Request URL:
     /devicemacro/loadall/{account_id}
  • Sample Response:
    • content-type:application/xml :
           
      <deviceMacros>
        <deviceMacro>
          <id>1</id>
          <account><id>1</id></account>
          <deviceMacroItems>
            <deviceCommandRef>
              <id>1</id>
              <parentDeviceMacro><id>1</id><deviceMacroItems/><name>macro1</name></parentDeviceMacro>
              <deviceCommand>
                <id>1</id>
                <device><id>1</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
                <name>cmd1</name>
                <protocol><id>1</id><attributes><attribute><id>1</id><name>url</name><value>http://cmd1.com</value></attribute></attributes><type>HTTP</type></protocol>
              </deviceCommand>
              <deviceName>device1</deviceName>
            </deviceCommandRef>
            <commandDelay>
              <id>2</id>
              <parentDeviceMacro><id>1</id><deviceMacroItems/><name>macro1</name></parentDeviceMacro>
              <delaySecond>3</delaySecond>
            </commandDelay>
          </deviceMacroItems>
          <name>macro1</name>
        </deviceMacro>
      </deviceMacros>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error code:404, Not Found. See HTTP/1.1 documentation. If can't find any macros.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(62) Show a list of devicemacros, each of them has the same properties with the specified devicemacaro(support JDBC)

  • Request URL:
     /devicemacro/loadsamemacros/{account_id}
  • Request Method: GET
  • Parameters: deviceMacroDTO(the deviceMacro to be compared, its not specified id, in post content), account_id(account id)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/devicemacro/loadsamemacros/1
    • content-type:application/xml :
      <deviceMacro>
         <id>0</id>
         <deviceMacroItems>
           <deviceCommandRef>
              <id>0</id>
              <deviceCommand>
                <id>0</id>
                <device><id>0</id><model>dev</model><name>device1</name><vendor>dev</vendor></device>
                <name>cmd1</name>
                <protocol>
                  <id>0</id>
                  <attributes><attribute><id>0</id><name>url</name><value>http://cmd1.com</value></attribute></attributes>
                  <type>HTTP</type>
                </protocol>
              </deviceCommand>
            </deviceCommandRef>
          </deviceMacroItems>
          <name>macro1</name>
      </deviceMacro>
      
  • Output:xml of a list of devicemacros.
  • Sample Response:
    • content-type:application/xml :
           
      <deviceMacros>
        <deviceMacro>
          <id>1</id>
          <deviceMacroItems/>
          <name>macro1</name>
        </deviceMacro>
      </deviceMacros>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error code:404, Not Found. See HTTP/1.1 documentation. If can't find any devicemacros.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(63) Save default controllerConfigs under an account, it will be call when create the new Account(support JDBC)

  • Request URL:
     /controllerconfig/savedefault/{account_id}
  • Request Method: POST
  • Parameters: controllerListing(include a list of controllerConfigs, in post content), account_id(account id)
  • Sample Request Url:http://localhost:8080/beehive/rest/controllerconfig/savedefault/1
    • content-type:application/xml :
      <controllerConfigs>
        <controllerConfig>
          <id>0</id>
          <category>roundrobin</category>
          <name>controller.roundrobin.tcpserver.port</name>
          <value>20000</value>
        </controllerConfig>
        <controllerConfig>
           <id>0</id>
           <category>advance</category>
           <name>multicast.address</name>
           <value>224.0.1.100</value>
         </controllerConfig>
         <controllerConfig>
           <id>0</id>
           <category>roundrobin</category>
           <name>controller.roundrobin.multicast.port</name>
           <value>10000</value>
         </controllerConfig>
         <controllerConfig>
           <id>0</id>
           <category>advance</category>
           <name>multicast.port</name>
           <value>3333</value>
         </controllerConfig>
         <controllerConfig>
            <id>0</id>
            <category>roundrobin</category>
            <name>controller.groupname</name>
            <value>floor20</value>
         </controllerConfig>
         ......
      </controllerConfigs>
      
  • Output:true.
  • Errors:
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(64) Show a list of controllerConfigs under an account by categoryName(support JDBC)

  • Request URL:
     /controllerconfig/load/{account_id}/{catagory_name}
  • Sample Response:
    • content-type:application/xml :
      <controllerConfigs>
        <controllerConfig>
          <id>0</id>
          <category>roundrobin</category>
          <name>controller.roundrobin.tcpserver.port</name>
          <value>20000</value>
        </controllerConfig>
        <controllerConfig>
           <id>0</id>
           <category>advance</category>
           <name>multicast.address</name>
           <value>224.0.1.100</value>
         </controllerConfig>
         <controllerConfig>
           <id>0</id>
           <category>roundrobin</category>
           <name>controller.roundrobin.multicast.port</name>
           <value>10000</value>
         </controllerConfig>
         <controllerConfig>
           <id>0</id>
           <category>advance</category>
           <name>multicast.port</name>
           <value>3333</value>
         </controllerConfig>
         <controllerConfig>
            <id>0</id>
            <category>roundrobin</category>
            <name>controller.groupname</name>
            <value>floor20</value>
         </controllerConfig>
         ......
      </controllerConfigs>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(65) Save or update a list of controllerConfigs into an account(support JDBC)

  • Request URL:
     /controllerconfig/saveall/{account_id}
  • Request Method: POST
  • Parameters: controllerListing(include a list of controllerConfigs, in post content), account_id(account id)
  • HTTP basic header Authorization : "Basic base64(username:password)"
  • Sample Request Url:http://localhost:8080/beehive/rest/controllerconfig/saveall/1
    • content-type:application/xml :
      <controllerConfigs>
        <controllerConfig>
          <id>0</id>
          <category>roundrobin</category>
          <name>controller.roundrobin.tcpserver.port</name>
          <value>20000</value>
        </controllerConfig>
        <controllerConfig>
           <id>0</id>
           <category>advance</category>
           <name>multicast.address</name>
           <value>224.0.1.100</value>
         </controllerConfig>
         <controllerConfig>
           <id>0</id>
           <category>roundrobin</category>
           <name>controller.roundrobin.multicast.port</name>
           <value>10000</value>
         </controllerConfig>
         <controllerConfig>
           <id>0</id>
           <category>advance</category>
           <name>multicast.port</name>
           <value>3333</value>
         </controllerConfig>
         <controllerConfig>
            <id>0</id>
            <category>roundrobin</category>
            <name>controller.groupname</name>
            <value>floor20</value>
         </controllerConfig>
         ......
      </controllerConfigs>
      
  • Output:xml or json of the controllerConfigs, it has the specified id.
  • Sample Response:
    • content-type:application/json :
      <controllerConfigs>
        <controllerConfig>
          <id>1</id>
          <category>roundrobin</category>
          <name>controller.roundrobin.tcpserver.port</name>
          <value>20000</value>
        </controllerConfig>
        <controllerConfig>
           <id>2</id>
           <category>advance</category>
           <name>multicast.address</name>
           <value>224.0.1.100</value>
         </controllerConfig>
         <controllerConfig>
           <id>3</id>
           <category>roundrobin</category>
           <name>controller.roundrobin.multicast.port</name>
           <value>10000</value>
         </controllerConfig>
         <controllerConfig>
           <id>4</id>
           <category>advance</category>
           <name>multicast.port</name>
           <value>3333</value>
         </controllerConfig>
         <controllerConfig>
            <id>5</id>
            <category>roundrobin</category>
            <name>controller.groupname</name>
            <value>floor20</value>
         </controllerConfig>
         ......
      </controllerConfigs>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.

(66) Show all controllerConfigs under an account(support JDBC)

  • Request URL:
     /controllerconfig/loadall/{account_id}
  • Sample Response:
    • content-type:application/xml :
      <controllerConfigs>
        <controllerConfig>
          <id>1</id>
          <category>roundrobin</category>
          <name>controller.roundrobin.tcpserver.port</name>
          <value>20000</value>
        </controllerConfig>
        <controllerConfig>
           <id>2</id>
           <category>advance</category>
           <name>multicast.address</name>
           <value>224.0.1.100</value>
         </controllerConfig>
         <controllerConfig>
           <id>3</id>
           <category>roundrobin</category>
           <name>controller.roundrobin.multicast.port</name>
           <value>10000</value>
         </controllerConfig>
         <controllerConfig>
           <id>4</id>
           <category>advance</category>
           <name>multicast.port</name>
           <value>3333</value>
         </controllerConfig>
         <controllerConfig>
            <id>5</id>
            <category>roundrobin</category>
            <name>controller.groupname</name>
            <value>floor20</value>
         </controllerConfig>
         ......
      </controllerConfigs>
      
  • Errors:
    • Error code:401, unauthorized. See HTTP/1.1 documentation.
    • Error Code:500, Server error. See HTTP/1.1 documentation.
 
Labels:

Added by Tomsky Wang

Last edit by Tomsky Wang on Feb 28, 2011 10:11

Adaptavist Theme Builder Powered by Atlassian Confluence
Free theme builder license