Following script is giving
'Bad Request - HTTP Error 400. The request is badly formed.'
$apiServer = "https://localhost:44353"
$apiCategory = "/api/school/v1"
$endPointsList = "/school-location/2B86B8A7-A529-4538-9125-00000E4C86AD"
$creds = new-object System.Net.NetworkCredential("user", "p@ssw0rd", "MYDOMAIN")
$headers = @{'Accept' = 'text/plain'; 'X-Traceability-Id' = 'x'; Authorization = 'NTLM ' + $creds }
$url = $apiServer + $apiCategory + $endPointsList
Write-Host $url
Invoke-WebRequest -Method Get -Uri $url -Headers $headers
Error:
https://localhost:44353/api/school/v1/school-location/2B86B8A7-A529-4538-9125-00000E4C86AD
Invoke-WebRequest : Bad Request
HTTP Error 400. The request is badly formed.
At C:\Powershell Scripts\ApiEndPointsTesting.ps1:10 char:1
+ Invoke-WebRequest -Method Get -Uri $url -Headers $headers
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand