Setting up hurl correctly
Posted: Tue Mar 05, 2024 12:58 pm
Currently I have this working command:
When transforming it to HWS, like this:
It returns like this:
What can possibly be changed to get the request working?
Code: Select all
curl.exe --cacert "curl-ca-bundle.crt" --cert alias.cer --key alias.key -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=client_credentials&client_id=BQFACI&client_secret=changeit&scope=Kundenmanagement" https://api-test.atruvia.de:443/authentication/accesstoken
Code: Select all
@REQUIRE "hurl"
CtrlCQuit(True)
EscapeQuit(False)
@INCLUDE "hurlhelper.hws"
@DISPLAY {Hidden = True,Title="agree21-API-Tester"}
Function p_getBearerToken()
DebugPrint("p_getBearerToken()")
Local e = hurl.Easy()
e:setopt_ssl_verifypeer(True)
e:setopt_cainfo("curl-ca-bundle.crt")
e:setopt_sslcert("alias.cer")
e:setopt_sslkey("alias.key")
e:setopt_default_protocol("https")
e:setopt_post(True)
e:setopt_postfields("grant_type=client_credentials&client_id=BQFACI&client_secret=changeit&scope=Kundenmanagement")
e:setopt_writefunction(p_Write)
e:setopt_headerfunction(p_Header)
e:setopt_url("https://api-test.atruvia.de:443/authentication/accesstoken")
DebugPrint("Getting Token")
e:setopt_verbose(1)
e = p_doHurlEasyCall(e)
e:close()
EndFunction
Function p_doHurlEasyCall(e)
tr_data$ = ""
tr_header$ = ""
e:perform()
DebugPrint("Header: "..tr_header$)
DebugPrint("Data: " ..tr_data$)
Return(e)
EndFunction
p_getBearerToken()
Code: Select all
And Action!
p_getBearerToken()
Getting Token
Error in line 42 (agree21API.hws): Problem with the local SSL certificate! (58)