HI All
I have been trying to get a currency update from an API. If I put the string in the browser then I get the correct response. Now I have tried thru code mixing and matching info that I got from B4A and at the moment the requests go thru but no return info
If you have any input, please let me know. THX
I have been trying to get a currency update from an API. If I put the string in the browser then I get the correct response. Now I have tried thru code mixing and matching info that I got from B4A and at the moment the requests go thru but no return info
If you have any input, please let me know. THX
B4X:
#Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 600
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private Button1 As Button
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("1") 'Load the layout file.
MainForm.Show
req
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Sub req
Dim j As HttpJob
j.Initialize("",Me)
j.Download("http://apilayer.net/api/live?access_key=4c3d6103b3a149ce34d0b56b651a5210¤cies=ZAR&format=1")
Dim result As ResultSet 'String
result= j.Poststring(j.Download)
'Log(j.GetString(j.Download))
Log(result)
j.GetRequest.SetHeader("Content-Type", "application/json; charset=utf-8")
End Sub
Sub JobDone (job1 As HttpJob)
Dim resultJSON As String
Log("USDZAR " & job1.JobName)
Log("jobsucess " & job1.Success )
resultJSON = job1.GetString
Log ("JSON " & resultJSON)
job1.Release
End Sub