Запросы к REST API на PowerShell

Contents
Введение
GET
POST
PUT
DELETE
Другие статьи о PowerShell

Введение

GET

$headers=@{} $headers.Add("accept", "application/json") $headers.Add("Authorization", "Bearer a-proper-token-goes-here") $response = Invoke-WebRequest -Uri 'https://example.com/engine/api/v1/wfs' -Method GET -Headers $headers

POST

$headers=@{} $headers.Add("accept", "application/json") $headers.Add("Authorization", "Bearer a-proper-token-goes-here") $headers.Add("content-type", "application/json") $response = Invoke-WebRequest -Uri 'https://example.com/engine/api/v1/wfs' -Method POST -Headers $headers -ContentType 'application/json' -Body '{"status":"WAITING","approver_can_revoke":true,"target_role_revoked":false,"can_bypass_revoke_wf":false,"steps":[{"name":"step"}],"name":"name"}'

PUT

$headers=@{} $headers.Add("accept", "application/json") $headers.Add("Authorization", "Bearer a-proper-token-goes-here") $headers.Add("content-type", "application/json") $response = Invoke-WebRequest -Uri 'https://example.com/engine/api/v1/wfs/wf_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{"status":"WAITING","approver_can_revoke":true,"target_role_revoked":false,"can_bypass_revoke_wf":false,"steps":[{"name":"step"}],"name":"name"}'

Banner Image

DELETE

$headers=@{} $headers.Add("accept", "application/json") $headers.Add("Authorization", "Bearer a-proper-token-goes-here") $response = Invoke-WebRequest -Uri 'https://example.com/engine/api/v1/wfs/wf_id' -Method DELETE -Headers $headers

Related Articles
Windows
PowerShell
Install
Basics
Alias
Functions
Network
Users
Files
REST API requests
Errors
Banner Image

Search on this site

Subscribe to @aofeed channel for updates

Visit Channel

@aofeed

Feedback and Questions in Telegram

@aofeedchat