Hi guys i’m trying to create a raspberry pi application that sends HTTP post requests to an API.
I successfully created it on my mac, using the Xojo.Net.HTTPSocket with my own methods.
This works 100% fine on my mac and does everything I need it to do, but when I run it on the raspberry pi using the remote debugger it crashes with no error message when I press any of the buttons (buttons initiate requests)
Dim params As New Xojo.Core.Dictionary
params.Value("key") = apikey
params.Value("identifier") = id
params.Value("password") = pass
Dim json As Text
json = Xojo.Data.GenerateJSON(params)
Window1.Listbox1.AddRow(json)
Dim data As Xojo.Core.MemoryBlock
data = Xojo.Core.TextEncoding.UTF8.ConvertTextToData(json)
Self.SetRequestContent(data, "application/json")
self.Send("POST", "https:/myapi.example")
Then the PageRecieved method which exists in an instance of my custom class “http” (inherits from Xojo.Net.HTTPSocket)
This processes the response data and displays it in a list box:
if HTTPStatus = 202 then
Window1.Listbox1.AddRow("------202, Accepted-----")
if json.HasKey("token") then //ASSUME Response from Login
Dim t As Text = json.Value("token")
App.token = t
Dim e As Integer = json.Value("expires")
Dim expires As Text = e.ToText
Window1.Listbox1.AddRow(t)
Window1.Listbox1.AddRow(expires)
end if
end if
If anyone can help me out I would really appreciate it.