Skip to content

Commit

Permalink
Update examples.md with Powershell Invoke-WebRequest deauthorize devi…
Browse files Browse the repository at this point in the history
…ce on a network

Separated the curl example into two based on operating system type; shell and powershell.

The latter has two flavors, a non-standard curl.exe binary with matching parameter syntax, or a powershell Invoke-WebRequest _native_ equivalent.

The error encountered by a customer indicated curl is an alias for Invoke-WebRequest on Powershell.
  • Loading branch information
aaronjohnson authored Oct 23, 2024
1 parent 2f6f5a1 commit 06f4501
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion docs/api/central/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,39 @@ curl -H "Authorization: token $ZT_TOKEN" -X POST \
<TabItem value="deauthorize-member">
### Deauthorize a network member
### Deauthorize a network member ( shell )
curl on Unix
```sh
curl -H "Authorization: token $ZT_TOKEN" -X POST \
"https://api.zerotier.com/api/v1/network/$NWID/member/$MEMBER_ID" \
--data '{"config": {"authorized": false}}'
```
### Deauthorize a network member ( Powershell Invoke-WebRequest )
```code
$ZT_TOKEN = ""
$NWID = ""
$MEMBER_ID = ""
$headers = @{
"Authorization" = "token $ZT_TOKEN"
}
$body = @{
config = @{
authorized = $false
}
} | ConvertTo-Json
Invoke-WebRequest -Uri "https://api.zerotier.com/api/v1/network/$NWID/member/$MEMBER_ID" `
-Method Post -Headers $headers -Body $body -ContentType "application/json"
```
Please note, if you encounter an error, System.String and System.Collections.IDictionary when using curl within Powershell, be advised this is an _alias_ which can lead to confusion because it is a wrapper for Invoke-WebRequest which has different parameter syntax than curl on non-windows operating systems. As an alternative solution, curl.exe can be used, however may not be available on your system. Caveat emptor.
</TabItem>
</Tabs>

0 comments on commit 06f4501

Please sign in to comment.