Hi team,
I’m running a XojoCloud server that does a little bit of work and then sends a POST to a restful API. The problem is that sometimes, for a period of time, the POST isn’t being received. The receiver is running on AWS and I’m not quite sure if it’s my end or theirs.
I’ve just implemented a database on the cloud to read the results of the post and was wondering what checks people do to ensure that the send is successful. As you can see below, I read the status and try 5 times before giving up. This code sits in a routine and the response is logged in a db on by cloud server. Any thoughts or improvements welcome!
CaptureSocketInstance.SetRequestContent(s, "application/x-www-form-urlencoded")
dim e as string
dim status as integer = 0
dim retry as integer
while status <> 201 '201 for local machine testing?
retry = retry + 1
if retry >5 then
exit
end if
try
e = CaptureSocketInstance.SendSync("POST", "https://testserver.com/api/simulations") '<> "{}"
catch
system.DebugLog "cant find capture server"
end try
status = CaptureSocketInstance.HTTPStatusCode
system.DebugLog "Status = " + str(status)
wend