Hi,
i want to run a CURL.exe with parameters using shell.execute on Windows. This seems to work, but my credentials for this request are not accepted, i always get an error “unauthorized”.
When i run the same command from commandline or Powershell, it work perfect.
So i think there is somethings wrong with my commandstring which i use in shell.execute.
My code looks like this:
[code]dim Username As String = txtUsername.Text()
dim Password As String = txtPassword.Text()
dim CURLPath As String = “c:\tools\curl\bin\curl.exe”
dim CURLParameter As String = “–include --request GET --user '” + Username + “:” + Password + “’ https://api.ionos.com/cloudapi/v5/datacenters”
MsgBox(CURLPath + " " + CURLParameter)
dim sh As new Shell
sh.Execute(CURLPath, CURLParameter)
TextAreaCURLOutput.Text = sh.Result[/code]
this is what i get from sh.result:
[code] % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
100 107 0 107 0 0 681 0 --:–:-- --:–:-- --:–:-- 681HTTP/1.1 401 Unauthorized
Date: Tue, 11 Jun 2019 20:58:04 GMT
Server: Apache/2.4.25 (Debian)
WWW-Authenticate: Basic realm=“formJDBCRealm”
X-RateLimit-Remaining: 300
X-RateLimit-Burst: 300
X-RateLimit-Limit: 600
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: *
Access-Control-Expose-Headers: *
Access-Control-Allow-Methods: *
Access-Control-Allow-Credentials: true
Transfer-Encoding: chunked
{
“httpStatus” : 401,
“messages” : [ {
“errorCode” : “315”,
“message” : “Unauthorized”
} ]
}
[/code]
The command which works from commandline is:
c:\\tools\\curl\\bin\\curl.exe --include --request GET --user 'michael.bzdega@mydomain.com:myPassword' https://api.ionos.com/cloudapi/v5/datacenters
any ideas what’s wrong here?
Michael