Powershell: HTTP REST / API Request

Date: 2021-11-02
$token = "REYmXihTVUlRiZHNpNzZdGRzaGdma2picT="
$baseUrl = "http://localhost:40000"
$appCode = "TEST"
$url = "$baseUrl/api/application/" + [System.Web.HTTPUtility]::UrlEncode($appCode)
$file = "data.json"
$body = Get-Content -Raw $file
$headers = @{
    Authorization = "Bearer $token"
}
Write-Host "Sending request: POST: $url"
Invoke-WebRequest -Uri $url -Method POST -Body $body -ContentType "application/json" -Headers $headers
55110cookie-checkPowershell: HTTP REST / API Request