|
Beehive 3.0 REST JSON API documentation(support JDBC)
The following document describes the Beehive 3.0 REST/JSON API(support JDBC) which supports JSON client. For the new REST/JDBC API feature, we recommand to use JSON data.
By default the response format is XML, you can also use JSON. You should to specify 'Accept' type in HTTP header, if you want to use JSONP, see how to 'Use JSONP format' in this document.The JSON format is different with the previous Beehive REST API, because the JSON provider changed(from jettison to jackson).
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:
- JSON format changed(from jettison to jackson)
- 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.
- (2) List all hardware vendors in the database
- (3) List all models of a vendor in the database
- (4) List all RemoteSections of a model in the database
- (5) List all RemoteOptions of a RemoteSection in the database
- (6) List all Codes of a Section in the database
- (7) List all icons identified by button command name (Included in M2)
- (8) List all icons (Included in M2)
- (9) Get all templates from account (Included in M7)
- (10) Save a template into account (Included in M7)
- (11) Update a template into account (Included in M7)
- (12) Delete a template from account (Included in M7)
- (13) Upload template resource(images etc) into account (Included in M7)
- (14) Download template resource(images etc) from account (Included in M7)
- (15) Upload account resource(openremote.zip for controller) into account (Included in M7)
- (16) Download account resource(openremote.zip for controller) from account (Included in M7)
- (17) Search public templates by keywords from others (Included in M7)
- (18) Create a new user with the Admin role, it will create a new account also(support JDBC)
- (19) Show user by user id(support JDBC)
- (20) Show user by user name(support JDBC)
- (21) Update User token and pendingRoleName by posted UserDTO(support JDBC)
- (22) Delete a user by user id(support JDBC)
- (23) Create an invitee by posted UserDTO under the specified Account(support JDBC)
- (24) Show all users under an Account.(support JDBC)
- (25) Create an new simple device under an account, it just includes name,vendor and model(support JDBC)
- (26) Create an new device with contents, the contents includes commands, sensors, switchs and sliders(support JDBC)
- (27) Show a list of devices with simple properties under an account, each device includes id, name, vendor and model(support JDBC)
- (28) Show a device by device id, it includes commands,sensors,sliders and switchs(support JDBC)
- (29) Update Device name,vendor and model(support JDBC)
- (30) Delete a device by device id(support JDBC)
- (31) Show a list of devices with same contents except id under an Account(support JDBC)
- (32) Create an new device command(support JDBC)
- (33) Show a device command by command id(support JDBC)
- (34) Update a device command(support JDBC)
- (35) Delete a device command by command id(support JDBC)
- (36) Create a list of device commands(support JDBC)
- (37) Show a list of DeviceCommands under a device by by device id(support JDBC)
- (38) Show a list of deviceCommandDTOs, each of them has the same properties with the specified deviceCommandDTO(support JDBC)
- (39) Create a new sensor under an account(support JDBC)
- (40) Update a sensor(support JDBC)
- (41) Delete a sensor by sensor id(support JDBC)
- (42) Show a list of sensors under an account(support JDBC)
- (43) Show a sensor by sensor id(support JDBC)
- (44) Show a list of sensors, each of them has the same properties with the specified sensor(support JDBC)
- (45) Create a new switch under an account(support JDBC)
- (46) Update a switch(support JDBC)
- (47) Delete a switch by switch id(support JDBC)
- (48) Show a list of switchs under an account(support JDBC)
- (49) Show a list of switchs, each of them has the same properties with the specified switch(support JDBC)
- (50) Create a new slider under an account(support JDBC)
- (51) Update a slider(support JDBC)
- (52) Delete a slider by slider id(support JDBC)
- (53) Show a list of sliders under an account(support JDBC)
- (54) Show a list of sliders, each of them has the same properties with the specified slider(support JDBC)
- (55) Create a new deviceMacro under an account(support JDBC)
- (56) Update a devicemacro(support JDBC)
- (57) Delete a devicemacro by macro id(support JDBC)
- (58) Show deviceMacroItems under a deviceMacro by macro id(support JDBC)
- (59) Show deviceMacros under an account(support JDBC)
- (60) Show a list of devicemacros, each of them has the same properties with the specified devicemacaro(support JDBC)
- (61) Save default controllerConfigs under an account, it will be call when create the new Account(support JDBC)
- (62) Show a list of controllerConfigs under an account by categoryName(support JDBC)
- (63) Save or update a list of controllerConfigs into an account(support JDBC)
- (64) Show all controllerConfigs under an account(support JDBC)
- Use JSONP format
(1) Export a LIRC configuration as a text file, concatenate different RemoteSection.
- Parameters: ids (RemoteSection ids, separate by comma)
- Output:Combined Configuration files content as String.
(2) List all hardware vendors in the database
- Output:json of a vendors list.
- Sample Response:
- content-type:application/json
- 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
- Sample Response:
- content-type:application/json :
- 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
- Sample Response:
- content-type:application/json :
- 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
- Sample Response:
- content-type:application/json :
- 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
- Sample Response:
- content-type:application/json :
- 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)
- Sample Response:
- content-type:application/json :
- 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)
- Sample Response:
- content-type:application/json :
- 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)
- Sample Response:
- content-type:application/json :
- 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)
- Sample Response:
- content-type:application/json :
- 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 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:json of the updated template in account.
- Sample Response:
- content-type:application/json :
- 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)
- 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)
- 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)
- 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)
- 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)
- 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)
- Sample Response:
- content-type:application/json :
- 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) Create a new user with the Admin role, it will create a new account also(support JDBC)
- Output:json of the new user.
- Sample Response:
- content-type:application/json :
- Errors:
- Error Code:500, Server error. See HTTP/1.1 documentation.
(19) Show user by user id(support JDBC)
- Sample Response:
- content-type:application/json :
- Errors:
- Error Code:404, No user found.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(20) Show user by user name(support JDBC)
- Sample Response:
- content-type:application/json :
- Errors:
- Error Code:404, No user found.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(21) Update User token and pendingRoleName by posted UserDTO(support JDBC)
- Errors:
- Error Code:500, Server error. See HTTP/1.1 documentation.
(22) Delete a user by user id(support JDBC)
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(23) Create an invitee by posted UserDTO under the specified Account(support JDBC)
- Output:json of the new invitee.
- Sample Response:
- content-type:application/json :
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(24) Show all users under an Account.(support JDBC)
- Sample Response:
- content-type:application/json :
- 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.
(25) Create an new simple device under an account, it just includes name,vendor and model(support JDBC)
- 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/json :
- Output:json of the new device.
- Sample Response:
- content-type:application/json :
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(26) Create an new device with contents, the contents includes commands, sensors, switchs and sliders(support JDBC)
- 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/json :
{"deviceAttrs":null,"deviceCommands":[{"id":0,"name":"cmd1","protocol":{"attributes":[{"id":0,"name":"url","value":"http://
cmd1.com"}],"id":0,"type":"HTTP"},"sectionId":null},{"id":0,"name":"cmd2","protocol":{"attributes":[{"id":0,"name":"url","value":"http://
cmd2.com"}],"id":0,"type":"HTTP"},"sectionId":null},{"id":0,"name":"cmd3","protocol":{"attributes":[{"id":0,"name":"url","value":"http://
cmd3.com"}],"id":0,"type":"HTTP"},"sectionId":null},{"id":0,"name":"cmd4","protocol":{"attributes":[{"id":0,"name":"url","value":"http://
cmd4.com"}],"id":0,"type":"HTTP"},"sectionId":null},{"id":0,"name":"cmd5","protocol":{"attributes":[{"id":0,"name":"url","value":"http://
cmd5.com"}],"id":0,"type":"HTTP"},"sectionId":null},{"id":0,"name":"cmd6","protocol":{"attributes":[{"id":0,"name":"url","value":"http://
cmd6.com"}],"id":0,"type":"HTTP"},"sectionId":null}],"id":0,"model":"devc","name":"DeviceWithContent","sensors":
[{"classType":"Sensor","id":0,"name":"switchsensor","sensorCommandRef":{"deviceCommand":{"id":0,"name":"cmd3","protocol":{"attributes":[{"id":0,"name":"url","value":"http://
cmd3.com"}],"id":0,"type":"HTTP"},"sectionId":null},"id":0},"type":"SWITCH"},{"classType":"RangeSensor","id":0,"max":100,"min":1,"name":"slidersensor","sensorCommandRef":
{"deviceCommand":{"id":0,"name":"cmd5","protocol":{"attributes":[{"id":0,"name":"url","value":"http://
cmd5.com"}],"id":0,"type":"HTTP"},"sectionId":null},"id":0},"type":"RANGE"}],"sliders":[{"id":0,"name":"slider1","setValueCmd":{"deviceCommand":
{"id":0,"name":"cmd6","protocol":{"attributes":[{"id":0,"name":"url","value":"http://cmd6.com"}],"id":0,"type":"HTTP"},"sectionId":null},"id":0},"sliderSensorRef":
{"id":0,"sensor":{"classType":"RangeSensor","id":0,"max":100,"min":1,"name":"slidersensor","sensorCommandRef":{"deviceCommand":{"id":0,"name":"cmd5","protocol":{"attributes":
[{"id":0,"name":"url","value":"http://cmd5.com"}],"id":0,"type":"HTTP"},"sectionId":null},"id":0},"type":"RANGE"}}}],"switchs":
[{"id":0,"name":"switch1","switchCommandOffRef":{"deviceCommand":{"id":0,"name":"cmd2","protocol":{"attributes":[{"id":0,"name":"url","value":"http://
cmd2.com"}],"id":0,"type":"HTTP"},"sectionId":null},"id":0},"switchCommandOnRef":{"deviceCommand":{"id":0,"name":"cmd1","protocol":{"attributes":
[{"id":0,"name":"url","value":"http://cmd1.com"}],"id":0,"type":"HTTP"},"sectionId":null},"id":0},"switchSensorRef":{"id":0,"sensor":
{"classType":"Sensor","id":0,"name":"switchsensor","sensorCommandRef":{"deviceCommand":{"id":0,"name":"cmd3","protocol":{"attributes":[{"id":0,"name":"url","value":"http://
cmd3.com"}],"id":0,"type":"HTTP"},"sectionId":null},"id":0},"type":"SWITCH"}}}],"vendor":"devc"}
- Output:json of the new device.
- Sample Response:
- content-type:application/json :
{"name":"DeviceWithContent","account":{"id":1},"model":"devc","sensors":[{"classType":"Sensor","name":"switchsensor","type":"SWITCH","device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sensorCommandRef":
{"sensor":null,"deviceCommand":{"name":"cmd3","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd3.com","id":3}],"id":3},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":3},"deviceName":"DeviceWithContent","id":1},"id":1},
{"classType":"RangeSensor","min":1,"max":100,"name":"slidersensor","type":"RANGE","device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sensorCommandRef":
{"sensor":null,"deviceCommand":{"name":"cmd5","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd5.com","id":5}],"id":5},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":5},"deviceName":"DeviceWithContent","id":2},"id":2}],"switchs":
[{"name":"switch1","device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"switchCommandOffRef":
{"offSwitch":null,"deviceCommand":{"name":"cmd2","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd2.com","id":2}],"id":2},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":2},"deviceName":"DeviceWithContent","id":4},"switchCommandOnRef":
{"onSwitch":null,"deviceCommand":{"name":"cmd1","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd1.com","id":1}],"id":1},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":1},"deviceName":"DeviceWithContent","id":5},"switchSensorRef":
{"switchToggle":null,"sensor":{"classType":"Sensor","name":"switchsensor","type":"SWITCH","device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sensorCommandRef":
{"sensor":null,"deviceCommand":{"name":"cmd3","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd3.com","id":3}],"id":3},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":3},"deviceName":"DeviceWithContent","id":1},"id":1},"id":0},"id":1}],"deviceCommands":
[{"name":"cmd1","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd1.com","id":1}],"id":1},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":1},
{"name":"cmd2","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd2.com","id":2}],"id":2},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":2},
{"name":"cmd3","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd3.com","id":3}],"id":3},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":3},
{"name":"cmd4","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd4.com","id":4}],"id":4},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":4},
{"name":"cmd5","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd5.com","id":5}],"id":5},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":5},
{"name":"cmd6","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd6.com","id":6}],"id":6},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":6}],"sliders":
[{"name":"slider1","device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sliderSensorRef":
{"slider":null,"sensor":{"classType":"RangeSensor","min":1,"max":100,"name":"slidersensor","type":"RANGE","device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sensorCommandRef":
{"sensor":null,"deviceCommand":{"name":"cmd5","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd5.com","id":5}],"id":5},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":5},"deviceName":"DeviceWithContent","id":2},"id":2},"id":0},"setValueCmd":
{"slider":null,"deviceCommand":{"name":"cmd6","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd6.com","id":6}],"id":6},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":6},"deviceName":"DeviceWithContent","id":3},"id":1}],"vendor":"devc","id":2}
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(27) Show a list of devices with simple properties under an account, each device includes id, name, vendor and model(support JDBC)
- Sample Response:
- content-type:application/json :
- 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.
(28) Show a device by device id, it includes commands,sensors,sliders and switchs(support JDBC)
- Sample Response:
- content-type:application/json :
{"name":"DeviceWithContent","account":{"id":1},"model":"devc","sensors":[{"classType":"Sensor","name":"switchsensor","type":"SWITCH","device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sensorCommandRef":
{"sensor":null,"deviceCommand":{"name":"cmd3","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd3.com","id":3}],"id":3},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":3},"deviceName":"DeviceWithContent","id":1},"id":1},
{"classType":"RangeSensor","min":1,"max":100,"name":"slidersensor","type":"RANGE","device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sensorCommandRef":
{"sensor":null,"deviceCommand":{"name":"cmd5","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd5.com","id":5}],"id":5},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":5},"deviceName":"DeviceWithContent","id":2},"id":2}],"switchs":
[{"name":"switch1","device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"switchCommandOffRef":
{"offSwitch":null,"deviceCommand":{"name":"cmd2","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd2.com","id":2}],"id":2},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":2},"deviceName":"DeviceWithContent","id":4},"switchCommandOnRef":
{"onSwitch":null,"deviceCommand":{"name":"cmd1","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd1.com","id":1}],"id":1},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":1},"deviceName":"DeviceWithContent","id":5},"switchSensorRef":
{"switchToggle":null,"sensor":{"classType":"Sensor","name":"switchsensor","type":"SWITCH","device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sensorCommandRef":
{"sensor":null,"deviceCommand":{"name":"cmd3","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd3.com","id":3}],"id":3},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":3},"deviceName":"DeviceWithContent","id":1},"id":1},"id":0},"id":1}],"deviceCommands":
[{"name":"cmd1","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd1.com","id":1}],"id":1},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":1},
{"name":"cmd2","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd2.com","id":2}],"id":2},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":2},
{"name":"cmd3","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd3.com","id":3}],"id":3},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":3},
{"name":"cmd4","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd4.com","id":4}],"id":4},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":4},
{"name":"cmd5","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd5.com","id":5}],"id":5},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":5},
{"name":"cmd6","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd6.com","id":6}],"id":6},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":6}],"sliders":
[{"name":"slider1","device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sliderSensorRef":
{"slider":null,"sensor":{"classType":"RangeSensor","min":1,"max":100,"name":"slidersensor","type":"RANGE","device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sensorCommandRef":
{"sensor":null,"deviceCommand":{"name":"cmd5","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd5.com","id":5}],"id":5},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":5},"deviceName":"DeviceWithContent","id":2},"id":2},"id":0},"setValueCmd":
{"slider":null,"deviceCommand":{"name":"cmd6","protocol":{"type":"HTTP","attributes":[{"name":"url","value":"http://cmd6.com","id":6}],"id":6},"device":
{"name":"DeviceWithContent","account":null,"model":"devc","sensors":null,"switchs":null,"deviceCommands":null,"sliders":null,"vendor":"devc","id":2},"sectionId":null,"id":6},"deviceName":"DeviceWithContent","id":3},"id":1}],"vendor":"devc","id":2}
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(29) Update Device name,vendor and model(support JDBC)
- 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/json :
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(30) Delete a device by device id(support JDBC)
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(31) Show a list of devices with same contents except id under an Account(support JDBC)
- 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/json :
- Output:json of a list of devices.
- Sample Response:
- content-type:application/json :
- 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.
(32) Create an new device command(support JDBC)
- 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/json :
- Output:json of the new device command, it has the specified id.
- Sample Response:
- content-type:application/json :
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(33) Show a device command by command id(support JDBC)
- Sample Response:
- content-type:application/json :
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(34) Update a device command(support JDBC)
- 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/json :
- Output:json of the updated device command.
- Sample Response:
- content-type:application/json :
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(35) Delete a device command by command id(support JDBC)
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(36) Create a list of device commands(support JDBC)
- 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/json :
- Output:json of a deviceCommandListing(includes a list of deviceCommandDTOs), each deviceCommandDTO has the specified id.
- Sample Response:
- content-type:application/json :
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(37) Show a list of DeviceCommands under a device by by device id(support JDBC)
- Sample Response:
- content-type:application/json :
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(38) Show a list of deviceCommandDTOs, each of them has the same properties with the specified deviceCommandDTO(support JDBC)
- 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/json :
- Output:json of a list of device commands.
- Sample Response:
- content-type:application/json :
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(39) Create a new sensor under an account(support JDBC)
- 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/json :
- Output:json of the new sensor, it has the specified id.
- Sample Response:
- content-type:application/json :
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(40) Update a sensor(support JDBC)
- 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/json :
- Output:json of the updated sensor.
- Sample Response:
- content-type:application/json :
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(41) Delete a sensor by sensor id(support JDBC)
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(42) Show a list of sensors under an account(support JDBC)
- Sample Response:
- content-type:application/json :
- 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.
(43) Show a sensor by sensor id(support JDBC)
- Sample Response:
- content-type:application/json :
- 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, each of them has the same properties with the specified sensor(support JDBC)
- 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/json :
- Output:json of a list of sensors.
- Sample Response:
- content-type:application/json :
- 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) Create a new switch under an account(support JDBC)
- 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/json :
- Output:json of the new switch, it has the specified id.
- Sample Response:
- content-type:application/json :
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(46) Update a switch(support JDBC)
- 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/json :
- Output:json of the updated switch.
- Sample Response:
- content-type:application/json :
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(47) Delete a switch by switch id(support JDBC)
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(48) Show a list of switchs under an account(support JDBC)
- Sample Response:
- content-type:application/json :
- 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.
(49) Show a list of switchs, each of them has the same properties with the specified switch(support JDBC)
- 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/json :
- Output:json of a list of switchs.
- Sample Response:
- content-type:application/json :
- 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.
(50) Create a new slider under an account(support JDBC)
- 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/json :
- Output:json of the new slider, it has the specified id.
- Sample Response:
- content-type:application/json :
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(51) Update a slider(support JDBC)
- 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/json :
- Output:json of the updated slider.
- Sample Response:
- content-type:application/json :
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(52) Delete a slider by slider id(support JDBC)
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(53) Show a list of sliders under an account(support JDBC)
- Sample Response:
- content-type:application/json :
- 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.
(54) Show a list of sliders, each of them has the same properties with the specified slider(support JDBC)
- 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/json :
- Output:json of a list of sliders.
- Sample Response:
- content-type:application/json :
- 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.
(55) Create a new deviceMacro under an account(support JDBC)
- 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/json :
- Output:json of the new devicemacro, it has the specified id.
- Sample Response:
- content-type:application/json :
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(56) Update a devicemacro(support JDBC)
- 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/json :
- Output:json of the updated devicemacro.
- Sample Response:
- content-type:application/json :
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(57) Delete a devicemacro by macro id(support JDBC)
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(58) Show deviceMacroItems under a deviceMacro by macro id(support JDBC)
- Sample Response:
- content-type:application/json :
- 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.
(59) Show deviceMacros under an account(support JDBC)
- Sample Response:
- content-type:application/json :
- 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.
(60) Show a list of devicemacros, each of them has the same properties with the specified devicemacaro(support JDBC)
- 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/json :
- Output:json of a list of devicemacros.
- Sample Response:
- content-type:application/json :
- 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.
(61) Save default controllerConfigs under an account, it will be call when create the new Account(support JDBC)
- Errors:
- Error Code:500, Server error. See HTTP/1.1 documentation.
(62) Show a list of controllerConfigs under an account by categoryName(support JDBC)
- Sample Response:
- content-type:application/json :
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(63) Save or update a list of controllerConfigs into an account(support JDBC)
- 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/json :
- Output:json of the controllerConfigs, it has the specified id.
- Sample Response:
- content-type:application/json :
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
(64) Show all controllerConfigs under an account(support JDBC)
- Sample Response:
- content-type:application/json :
- Errors:
- Error code:401, unauthorized. See HTTP/1.1 documentation.
- Error Code:500, Server error. See HTTP/1.1 documentation.
Use JSONP format
JSON-P is a method of wrapping the JSON output of API calls to allow other developers to call cross site. To use JSON-P, developer should include a 'callback' as request parameter like this: http://localhost:8080/beehive/rest/lirc?callback=aaa
then response will be :
|
|
|
|
|