mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-11-09 11:09:00 +00:00
Add REST sensor/binary_sensor/switch templated headers & params (#20058)
This commit is contained in:
@@ -124,7 +124,11 @@ password:
|
||||
headers:
|
||||
description: The headers for the requests.
|
||||
required: false
|
||||
type: [list, string]
|
||||
type: [list, template]
|
||||
params:
|
||||
description: The query params for the requests.
|
||||
required: false
|
||||
type: [list, template]
|
||||
{% endconfiguration %}
|
||||
|
||||
## Examples
|
||||
@@ -153,7 +157,9 @@ binary_sensor:
|
||||
|
||||
### Accessing an HTTP authentication protected endpoint
|
||||
|
||||
The REST sensor supports HTTP authentication and customized headers.
|
||||
The REST sensor supports HTTP authentication and template-enabled customized headers.
|
||||
|
||||
{% raw %}
|
||||
|
||||
```yaml
|
||||
binary_sensor:
|
||||
@@ -165,8 +171,12 @@ binary_sensor:
|
||||
headers:
|
||||
User-Agent: Home Assistant
|
||||
Content-Type: application/json
|
||||
X-Custom-Header: '{{ states("input_text.the_custom_header") }}'
|
||||
```
|
||||
|
||||
{% endraw %}
|
||||
|
||||
|
||||
The headers will contain all relevant details. This will also give
|
||||
you the ability to access endpoints that are protected by tokens.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user