Problem
I am having a hard time converting a curl call into a Powershell Invoke-RestMethod call as Powershell doesn't really thow the most informative error messages (if any).
Curl call (Ubuntu)
token = "djsakldsakldjaslda"
host = "https://lalala.azuredatabricks.net/"
curl -X POST -H "Authorization: Bearer $(token)" $(host)/api/2.0/clusters/create -d $(cat my_file.json)
Invoke-RestMethod call (Powershell)
$token= "djsakldsakldjaslda"
$host = "https://lalala.azuredatabricks.net/"
Invoke-RestMethod -Method Post -Uri $host/api/2.0/clusters/create -Headers @{"Authorization" = "Bearer " + $token} -Body $(get-content my_file.json -raw | ConvertFrom-Json)
I have various formats for the body, but no matter what I send, I just get some HTML back for a login page. On Ubuntu with Curl everything works perfectly.
NOTE:
The problem seemed to be that PowerShell cannot handle double-"/" as in "https://lalala.azuredatabricks.net//api/2.0/clusters/create".
The strange part is that Invoke-RestMethod gets to the login page, but fails from there.