We are trying to post a report to Web API with security chanel (https).
First step is to get a token from the web server then post the report contents with the token.
I am trying to run cURL command from TCL script. When I tried on command line it works fine. I can get a token but when I run it from script, I have got an error as
“ERROR:n couldn’t execute “curl -X POST https:/apps.viha.ca/auth/connect/token -H “Content-Type: application/x-www-form-urlencoded” -H “cache-control: no-cache” -d “grant_type=c”: no such file or directory”
I have this code in tcl
set cURLComand “curl -X POST https://……./token -H \”Content-Type: application/x-www-form-urlencoded\” -H \”cache-control: no-cache\” -d \”grant_type=client…&client_id=Clover&client_secret=clov%20id%20server%20sec\””
if { [catch {exec $cURLComand} procStat] } {
echo “ERROR:n $procStat”
}
and get this error below
“ERROR:n couldn’t execute “curl -X POST https:/…/token -H “Content-Type: application/x-www-form-urlencoded” -H “cache-control: no-cache” -d “grant_type=c”: no such file or directory”
I have done some research and someone suggested to exec command under a certain path from the enviroment path.
with all the path below I could not tell which bin it should be in
curl -X POST https://apps.viha.ca/auth/connect/token -H “Content-Type: application/x-www-form-urlencoded” -H “cache-control: no-cache” -d “grant_type=client_credentials&scope=EMR…..20secret”
p= /cloverleaf/cis6.1/integrator/bin
p= /cloverleaf/cis6.1/integrator/contrib
p= /cloverleaf/cis6.1/integrator/sbin
p= /cloverleaf/cis6.1/integrator/dbms/bin
p= /cloverleaf/cis6.1/integrator/tcl/bin
p= /cloverleaf/cis6.1/integrator/clgui/bin
p= /cloverleaf/cis6.1/integrator/clgui/java/bin
p= /cloverleaf/cis6.1/integrator/usercmds
p= /usr/bin
p= /etc
p= /usr/sbin
p= /usr/ucb
p= /home/hci/bin
p= /usr/bin/X11
p= /sbin
p= .
p= /usr/local/bin
p= /usr/local/scripts
p= /bin
p= /home/hci/bin
p= /usr/bin/X11
p= /usr/openwin/bin
p= /usr/bin/X11
p= /usr/openwin/bin
“ERROR:n couldn’t execute “curl -X POST https:/…token -H “Content-Type: application/x-www-form-urlencoded” -H “cache-control: no-cache” -d “grant_type=c”: no such file or directory”
Please help and I am not sure if I am in the right track on this.
with the work we are trying to do, it is better to use tclcURL or cURL command line here.