Files
Home-Assistant/helpers/rest_command.yaml
T
2026-06-28 14:27:20 -04:00

38 lines
1.4 KiB
YAML

# REST commands to create and update Notion pages.
notion_create_print:
url: "https://api.notion.com/v1/pages"
method: POST
content_type: "application/json"
headers:
Authorization: !secret notion_token_bearer
Notion-Version: "2022-06-28"
payload: >
{
"parent": { "database_id": "c7bab550efd740909f656f101697832d" },
"properties": {
"File Name": { "title": [{ "text": { "content": "{{ file_name }}" } }] },
"Status": { "select": { "name": "Printing" } },
"Printer": { "select": { "name": "{{ printer_name }}" } },
"Filament Type": { "select": { "name": "{{ filament_type }}" } },
"Filament Color": { "rich_text": [{ "text": { "content": "{{ filament_color }}" } }] },
"date:Started:start": { "date": { "start": "{{ started }}", "time_zone": "America/New_York" } }
}
}
notion_update_print:
url: "https://api.notion.com/v1/pages/{{ page_id }}"
method: PATCH
content_type: "application/json"
headers:
Authorization: !secret notion_token_bearer
Notion-Version: "2022-06-28"
payload: >
{
"properties": {
"Status": { "select": { "name": "{{ status }}" } },
"Weight (g)": { "number": {{ weight }} },
"Length (mm)": { "number": {{ length }} },
"date:Completed:start": { "date": { "start": "{{ completed }}", "time_zone": "America/New_York" } }
}
}