Action¶
Definition¶
<action name="ActionName">
Performs an action in http_service, device module or frontend service.
Attribute | Type | Description |
---|---|---|
name | string | Required. The name of the action. Action names are written according to the PascalCase convention, e.g. 'SetTemperature'. |
Children¶
Behaviour¶
The <action> element in the service interface connects the corresponding <invoke_service_action> element in the domain to a specific service action inside <target>. The target service must be either an http_service or frontend service, which would return either success
or fail
status inside an action response.
Each of the parameters used by the specified <target> must be passed under <parameters>.
If the <action> contains a <failure_reason>, the target service must be able to return a fail
status with the reason name in the response. Check the documentation of this child element for more information.
Examples¶
Set temperature¶
<action name="SetTemperature">
<parameters>
<parameter predicate="degrees" format="value"/>
</parameters>
<failure_reasons>
<failure_reason name="temperature_too_high"/>
</failure_reasons>
<target>
<http endpoint="http://climate-http-service/set_temperature"/>
</target>
</action>
Forward a Call¶
<action name="Call">
<parameters>
<parameter predicate="phone_number" format="grammar_entry"/>
</parameters>
<failure_reasons/>
<target>
<frontend/>
</target>
</action>
Last update: December 12, 2022