mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-09 02:16:50 +00:00
Minor changes
This commit is contained in:
parent
b0d33fad74
commit
d6af430df8
@ -9,30 +9,32 @@ sharing: true
|
|||||||
footer: true
|
footer: true
|
||||||
logo: restful.png
|
logo: restful.png
|
||||||
ha_category: Automation
|
ha_category: Automation
|
||||||
ha_release: 0.36.0
|
ha_release: 0.36
|
||||||
---
|
---
|
||||||
|
|
||||||
This component can expose regular rest commands as services. Services can be called from a [script] or in [automation].
|
This component can expose regular REST commands as services. Services can be called from a [script] or in [automation].
|
||||||
|
|
||||||
[script]: /components/script/
|
[script]: /components/script/
|
||||||
[automation]: /getting-started/automation/
|
[automation]: /getting-started/automation/
|
||||||
|
|
||||||
To enable this switch, add the following lines to your `configuration.yaml` file:
|
To enable this switch, add the following lines to your `configuration.yaml` file:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# Example configuration.yaml entry
|
# Example configuration.yaml entry
|
||||||
# Exposes service rest_command.example_request
|
|
||||||
rest_command:
|
rest_command:
|
||||||
example_request:
|
example_request:
|
||||||
url: 'http://example.com/'
|
url: 'http://example.com/'
|
||||||
```
|
```
|
||||||
|
|
||||||
Configuration variables:
|
Configuration variables:
|
||||||
- **url** (*Required*): URL (support template) for sending request.
|
|
||||||
- **method** (*Optional*): HTTP method (get, post, put, delete). Default is get.
|
- **[service_name]** (*Required*): The name used to expose the service. E.g. in the above example would it be ` rest_command.example_request`.
|
||||||
- **payload** (*Optional*): A string/Template to send with request.
|
- **url** (*Required*): The URL (support template) for sending request.
|
||||||
- **username** (*Optional*): username for HTTP authentication
|
- **method** (*Optional*): HTTP method (get, post, put, delete). Default is get.
|
||||||
- **password** (*Optional*): password for HTTP authentication
|
- **payload** (*Optional*): A string/template to send with request.
|
||||||
- **timeout** (*Optional*): Timeout for requests, default 10 seconds.
|
- **username** (*Optional*): The username for HTTP authentication.
|
||||||
|
- **password** (*Optional*): The password for HTTP authentication.
|
||||||
|
- **timeout** (*Optional*): Timeout for requests. Defaults to 10 seconds.
|
||||||
|
|
||||||
The commands can be dynamic, using templates to insert values of other entities. Service call support variables for template stuff.
|
The commands can be dynamic, using templates to insert values of other entities. Service call support variables for template stuff.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user