URLConnection bad url

Greetings!
I am using URLConnection to query the status from a camera.
No authorization is required, and on postman desktop app it sends and receives the JSON without problems.
BUT on Xojo, I am getting “Error occurred while sending request (likely a bad url)” in the “Error” event handler.

mConnection on Window as URLConnection
Any suggestions?
Code on button below

var json as Dictionary = new Dictionary
var params as Dictionary = new Dictionary
params.value("timeout")= 20
json.Value("apiVersion") = "1.1"
json.Value("context") = "83"
json.Value("method") = "systemready"
json.Value("params") = params

var jsonData as String = GenerateJSON(json)
'returns {"apiVersion":"1.1","context":"83","method":"systemready",'params”:{“timeout”:20}}

var camUrl as String
camUrl = "https://192.168.1.223/axis-cgi/systemready.cgi"
system.DebugLog(camUrl)

try
mConnection.RequestHeader("Content-Type") = "application/json"
mConnection.RequestHeader("Accept")="*/*"
mConnection.RequestHeader("Connection")="keep-alive"
mConnection.SetRequestContent(jsonData,"application/json")
mConnection.Send("POST",camUrl,10)

catch e as NetworkException

system.DebugLog(e.Message)

end

nevermind, works with http://..

1 Like

Microsoft’s “likely a bad url” is the worst thing they could have included in the message, as it’ll be included for just about any error, such as a DNS issue. In your case, it was kind of right… from a certain point of view. But the issue wasn’t really the url, instead it was the attempt to use TLS without a domain.

2 Likes

The nuances of URI and URL,

URI - Universal Resource Indicator. The identity of a resource that may include the location and access method.

URL - Universal Resource Locator. The location of a resource that must include the access method. https:// is a bad URL for a resource that can not be retrieved with TLS.