Merge pull request #848 from falkheiland/main

Update publish.md
pull/851/head
Philipp C. Heckel 2023-08-22 11:40:38 +02:00 committed by GitHub
commit f17538b7df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 7 deletions

View File

@ -457,6 +457,7 @@ You can set the priority with the header `X-Priority` (or any of its aliases: `P
=== "PowerShell" === "PowerShell"
``` powershell ``` powershell
$Request = @{ $Request = @{
Method = 'POST'
URI = "https://ntfy.sh/phil_alerts" URI = "https://ntfy.sh/phil_alerts"
Headers = @{ Headers = @{
Priority = "5" Priority = "5"
@ -1033,7 +1034,7 @@ is the only required one:
$Request = @{ $Request = @{
Method = "POST" Method = "POST"
URI = "https://ntfy.sh" URI = "https://ntfy.sh"
Body = @{ Body = ConvertTo-JSON @{
Topic = "mytopic" Topic = "mytopic"
Title = "Low disk space alert" Title = "Low disk space alert"
Message = "Disk space is low at 5.1 GB" Message = "Disk space is low at 5.1 GB"
@ -1042,7 +1043,7 @@ is the only required one:
FileName = "diskspace.jpg" FileName = "diskspace.jpg"
Tags = @("warning", "cd") Tags = @("warning", "cd")
Click = "https://homecamera.lan/xasds1h2xsSsa/" Click = "https://homecamera.lan/xasds1h2xsSsa/"
Actions = ConvertTo-JSON @( Actions = @(
@{ @{
Action = "view" Action = "view"
Label = "Admin panel" Label = "Admin panel"
@ -1919,10 +1920,10 @@ And the same example using [JSON publishing](#publish-as-json):
$Request = @{ $Request = @{
Method = "POST" Method = "POST"
URI = "https://ntfy.sh" URI = "https://ntfy.sh"
Body = @{ Body = ConvertTo-Json -Depth 3 @{
Topic = "wifey" Topic = "wifey"
Message = "Your wife requested you send a picture of yourself." Message = "Your wife requested you send a picture of yourself."
Actions = ConvertTo-Json -Depth 3 @( Actions = @(
@{ @{
Action = "broadcast" Action = "broadcast"
Label = "Take picture" Label = "Take picture"
@ -2072,7 +2073,7 @@ Here's an example using the [`X-Actions` header](#using-a-header):
'method' => 'POST', 'method' => 'POST',
'header' => 'header' =>
"Content-Type: text/plain\r\n" . "Content-Type: text/plain\r\n" .
"Actions: http, Close door, https://api.mygarage.lan/, method=PUT, headers.Authorization=Bearer zAzsx1sk.., body={\"action\": \"close\"}", 'Actions: http, Close door, https://api.mygarage.lan/, method=PUT, headers.Authorization=Bearer zAzsx1sk.., body={\"action\": \"close\"}',
'content' => 'Garage door has been open for 15 minutes. Close it?' 'content' => 'Garage door has been open for 15 minutes. Close it?'
] ]
])); ]));
@ -2199,10 +2200,10 @@ And the same example using [JSON publishing](#publish-as-json):
$Request = @{ $Request = @{
Method = "POST" Method = "POST"
URI = "https://ntfy.sh" URI = "https://ntfy.sh"
Body = @{ Body = ConvertTo-Json -Depth 3 @{
Topic = "myhome" Topic = "myhome"
Message = "Garage door has been open for 15 minutes. Close it?" Message = "Garage door has been open for 15 minutes. Close it?"
Actions = ConvertTo-Json -Depth 3 @( Actions = @(
@{ @{
Action = "http" Action = "http"
Label = "Close door" Label = "Close door"