URLConnection - fails, Thunderclient succeeds

So heres something even more hard to grasp - if I use an HTTPSecureSocket it works as expected. Could it be that the API server is using HTTP 1.0 and moving from 2020r2.1 to 2021r3.1 xojo has some change under the hood inside URLConnect? This URLConnect is HTTP 1.1 right? These are endpoints I havent used before but they are in the exact same group pf endpoints in this API. What I find stunning is that in 2021r3.1, some nearly identical calls work and some dont.

HTTPSecureSocket is written in Xojo and isn’t very standards compliant. URLConnection is powered by the system - NSURLConnection on Mac and WinHTTP on Windows - so it’s behavior will naturally be different. You might even see a different effect between Mac and Windows.

1 Like

Ok, many thanks to all who chimed in! I logged a suppor ticket with the API folks who said to append the “body” info to the url query. So, had they not had a body in the docs, but an example
well I must say you guys insisting that GET shouldnt have a body is ultimately what lead to the solution. Im still confused as to why some work that way but Im moving on. You gus are the best, thanks, heres what works, hoping op might find this useful:

me.RequestHeader("Content-Type") = "application/json"
me.RequestHeader("api-token") = APIKey

Var json As New JSONItem
'json.Value("dsid") = 50982

'me.SetRequestContent(json.ToString, "application/json")
var payload as string = "https://api.myserver.com/v1/datasource/tree?dsid=50982"
me.Send("GET", payload)
1 Like