C++/Qt with dream factory


#1

Hello, I’m building an android app in C++/Qt and can’t find any sources on setting up the app so that basic CRUD operations could be run.

So I was wondering has anyone tried using DF with a C++/Qt app, if so could you please tell me where to start?


#2

@verhoher looking through the Qt documentation here I believe you can use the QNetworkAccessManager Class to access RESTful services and perform some basic CRUD operations.


#3

I recently also had to deal with C++/Qt5 + DF for Android/iOS deployment. But my approach also works for non-mobile deployments also of course:

Create a service/swagger definition for your custom service or the auto-generated service-endpoints you really need. Then use https://github.com/swagger-api/swagger-codegen/ or editor.swagger.io -> Generate Client -> C++/Qt and generate the SDK.

Now, Swagger SDK doesnt know about DF and its authentication obviously, so in SWGHttpRequest.h/cpp you have to add a member for the JWT token and add request.setRawHeader(..) for the X-Dreamfactory-Session-Token and X-Dreamfactory-Api-Key in the middle of void HttpRequestWorker::execute(HttpRequestInput *input) where it does the request

Then in your application code, perform the login (without the SDK) and init the SDK with the JWT passed in via constructor. Now use the SDKs API functions and you are set :wink:

I have some blog-post upcoming in next couple of days about swagger-based SDK generation + DF integration, See http://www.devops-blog.net/dreamfactory then