Migrated from Redmine #674 | Author: Craig Jackson
Status: New | Priority: High, I’m very impatient | Created: 2021-03-24
Any idea why this is not working in Powershell - I get the following error
*
Invoke-RestMethod : {“code”:400,“message”:“”,“data”:{“company”:[“Invalid type given, value should be float, string, or integer”],“login”:[“Invalid
type given, value should be float, string, or integer”],“password”:[“Invalid type given, value should be float, string, or
integer”]},“message_data”:}
At line:11 char:10
- $token = Invoke-RestMethod -Uri “${uri}” -Method Post -Headers $heade …
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
- FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand*
CODE
$uri = “https://user-api-v2.nhsbookings.com/admin/auth”
$headers = @{
“company” = “xxxxx”
“login” = “xxxx”
“password”= “xxxxx”
}
$token = Invoke-RestMethod -Uri “${uri}” -Method Post -Headers $headers -ContentType application/json