The REST API serves different purposes. It can be used for integration with other systems. Normally the REST API is used for communication with the User Interfaces, Remote UIs (e.g. fat clients or HTML5 web applications), etc., as it allows access to certain resources. The Automation ESH REST API gives access to three REST Resources:
MODULE-TYPES – com.prosyst.mbs.services.automation.rest.ModuleTypeRestResource, is a REST service available under alias http:///module-types and lists module types.
TEMPLATES – com.prosyst.mbs.services.automation.rest.TemplateRestResource, is a REST service available under alias http:///templates" and lists rule templates.
RULES – com.prosyst.mbs.services.automation.rest.RuleRestResource, is a REST service available under alias http:///rules and lists rule instances.
MODULE-TYPES Resource can be used for:
MODULE-TYPES (/module-types) – path of the resource
GET /module-types – returns all registered module types.
optional parameter 'type' with possible values: 'trigger', 'condition' or 'action' – filters the response to include only module definitions of specified category.
optional parameter 'tags' – filters the response to include only module types which have specified tags.
GET /module-types/<moduleTypeUID> – returned response includes only the content of the specified module type.
TEMPLATES Resource can be used for:
TEMPLATES (/templates) – path of the resource
GET /templates – returns all registered rule templates.
GET /templates/<templateUID> – returned response includes only the content of the specified template.
RULES Resource can be used for:
RULES (/rules) – path of the resource
GET /rules – returns all registered rule instances.
POST /rules – adds new rule instance to the rule registry.
DELETE /rules/<ruleUID> – deletes the specified rule instance.
PUT /rules/<ruleUID> – updates the specified rule instance.
PUT /rules/<ruleUID>/enable – enables/disables specified rule instance.
PUT /rules/<ruleUID>/runnow – executes actions of specified rule instance.
GET /rules/<ruleUID>/config – returns the configuration of the specified rule instance.
PUT /rules/<ruleUID>/config – updates the configuration of the specified rule instance.
GET /rules/<ruleUID>/triggers – returns the triggers defined for the specified rule instance.
GET /rules/<ruleUID>/conditions – returns the conditions defined for the specified rule instance.
GET /rules/<ruleUID>/actions – returns the actions defined for the specified rule instance.
GET /rules/<ruleUID>/<moduleCategory>/<id> – returns module instance with specified id and category (triggers/conditions/actions) of the specified rule.
GET /rules/<ruleUID>/<moduleCategory>/<id>/config – returns the configuration of the specified module instance.
GET /rules/<ruleUID>/<moduleCategory>/<id>/config/<param> – returns the value of specified module configuration parameter (media type is text/plain).
PUT /rules/<ruleUID>/<moduleCategory>/<id>/config/<param> – updates the value of specified module configuration parameter (media type is text/plain).
Dependencies
The MODULE-TYPES – com.prosyst.mbs.services.automation.rest.ModuleTypeRestResource, depends on org.eclipse.smarthome.automation.type.ModuleTypeRegistry service.
The TEMPLATES – com.prosyst.mbs.services.automation.rest.TemplateRestResource, depends on org.eclipse.smarthome.automation.template.TemplateRegistry service.
The RULES – com.prosyst.mbs.services.automation.rest.RuleRestResource, depends on org.eclipse.smarthome.automation.RuleRegistry service.