Hi Chris, try not to get too overwhelmed - it takes a while sometimes before the “ah-hah!” moment where all this programming stuff clicks and the lightbulb over your head appears. I think @Ian_Kennedy is offering you some good advice, and I can certainly chip in.
To begin with I like to build apps (like yours) one piece at a time, test it, save it, and then add another layer - debugging as I go.
Your app is a rather complex one for someone claiming to be new to programming, but the XOJO platform will help you make quick work of it.
The example projects that shipped with your copy of XOJO do have two good examples of the POST and GET methods of a URLConnection. This URLConnection is really the heart of the app you’re working on.
The part that I have gotten tripped up on before is the concept of an asynchronous request, where the response is somewhat detached and not (visibly) tied to the sequential execution of your code. A bit like tossing a message over a wall, then a short period later it’s tossed back. When it arrives your app is anticipating it, but for me it was hard to understand where and when it would land.
Getting back to the basics of your Autotask API and building the pieces that send and later receive your transaction…
You need to create a variable to store your URLConnection object, where it will persist beyond the scope of the method calling it. For the sake of this discussion I’m assuming you are making a Desktop application (not a multi-user WebApp, which has more rules to consider).
Create a Var in the App object, declare it as a URLConnection, and create a New instance of it each time you use it.
E.g., “App.my_Autotask_API = New URLConnection
”
Again, back to the App object, create a method with a name something like “my_Autotask_API_ContentReceived_action”, that takes a number of parameters:
Sender As URLConnection, URL As String, HTTPStatus As Integer, content As String
…all the same parameters as you see defined in the documentation.
In the method you’re writing declare some AddHandler’s that ‘watch’ for the URLConnection’s ContentReceived() event, something like this…
AddHandler my_Autotask_API.ContentReceived, AddressOf my_Autotask_API_ContentReceived_action
Now create a really dumbed-down call (some code in a simple button will work) where you create the “GET” request using ''App.my_Autotask_API", and then see what comes back to you in the my_Autotask_API_ContentReceived_action
. I hope this helps!