REST Api for QT app
I'm looking for a way to make my Qt App expose an REST API ... Is it possible ?
You need to create a server with Qt. It's possible, yes, and will get even easier in the future, as there is some interest in the general area.
For now, I'll just push some Qt classes at you. Investigate, then come back if there are any questions.
In general, the central point of Qt Network module is QNetworkAccessManager. For creating a daemon (or service, as Windows folks keep naming them), you can take a look at "QtService":https://qt.gitorious.org/qt-solutions/qt-solutions/source/80592b0e7145fb876ea0e84a6e3dadfd5f7481b6:qtservice addon.
So, i take a look to QTService and try to run the example of http server.
But i get an error : "The service Qt HTTP Daemon could not start ..."
I'm newbie in C++ and QT, so i take a look at qtservice.cpp but i still incapable to identify my problem ..
Any idea ?
No sorry, I've never used that module. There is a plan to add a new QApplication-like class for creating daemons, but I think it's not integrated yet.
Finally, i use "qhttpserver": https://github.com/nikhilm/qhttpserver to create my server HTTP .
Is it a library in QT for create REST API ? or did i have to create ressources(REST) myself ?
There is no build-in support for REST in Qt. Maybe there is some in QHttpServer, I don't know.
Ok, thanks you.
huytard last edited by
Try QttpServer for an RESTish API server:
- Qt provides support for JSON, logging
- URL routing
- libuv performance
- MongoDB friendly
- Redis friendly
kafeg last edited by
Please see to my rest client implementation https://forum.qt.io/topic/64999/qt-rest-client-beta
Antony007 last edited by
h00bs last edited by h00bs
If anyone is looking for a way to connect to a REST api, we've written a tutorial with an open-source example app, that connects to a weather REST service: https://v-play.net/cross-platform-app-development/access-rest-services-qt-v-play-weather-service-example-app-open-source
the OP was asking for a REST API server/provider, rather than a REST client.
Something like Cutelyst