I have the handheld capturing data and when complete, want to post the verified JSON string back to the server. The URL is in the form http://192.168.0.1/api/upload The URL is purely fictional as it's a real live service. I'm getting an Internal Server Error, but before I pester the web programmer, just wanted to ensure what I'm doing is correct.
If I remove the Set Header, I get the error, Media Type Not Supported. Would welcome any helpful pointers.
Thanks, Colin
B4X:
Sub btnUploadCycleCounts_Click
Dim lJson As String=GenerateJSON
Dim job2 As HttpJob
job2.Initialize("Job2", Me)
job2.PostString(GlobalFunctions.BaseURL&"/api/handheld", lJson)
job2.GetRequest.SetHeader("Content-Type", "application/json")
ToastMessageShow("Created",True)
End Sub
Sub JobDone (Job As HttpJob)
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
If Job.Success = True Then
Log(Job.GetString)
Else
Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
End Sub
If I remove the Set Header, I get the error, Media Type Not Supported. Would welcome any helpful pointers.
Thanks, Colin