Passing values between apps and webserver
I'm really new in Qt and web server programming.
How do I really to pass value from my app to cloud service and from cloud service back to client app?
Do I have to upload my app to the cloud or create a new script say java script in the server to receive and pass values? XMLHTTPRequest? JSON? Is there any example? I've been searching the net high and low but all I found is bit and pieces. I just couldn't get a whole big picture out of it. I can't get the connections between the examples I found:(
I'm currently using google cloud and created a sql database in it. If I'm required to create an app in the google cloud, what app engine or service do I use?
I'm using sqlite in my app.
You are mixing up some things here. Your app is split in two parts:
- server part (not written in qt, might be provided by a third party or written by you in a server language such as PHP)
- client app (qt)
Thus, you won't necessarily need to upload your app to the cloud. However, you might need a webserver if you intend to host your app on your own.
There are different ways to implement a web service and choosing the correct one depends on your needs. If you only want to store some simple key - value pairs on a server, a mobile backend as a service, such as the WebStorage offered by V-Play could be a solution for you.
If you need very complex tasks, you might want to implement an API on your own. You might want to have a look at this tutorial.
No matter what kind of API your application will use, you will most likely talk to it using JSON or XML using XMLHttpRequest.. You can find a small code snippet that shows you how to read and parse JSON from a server using XMLHttpRequest here.
You can use this snippet to play around with the fake-APIs provided here.
A very complete example where an API is used is the Qt World Summit 2017 app. Instead of the asset-url used here, also a http:// url could be used.
Let me know what you would like to do and I can try to give you more guidance.