Getting Started with Enginio using C++

Setup Qt Application Project

To link to Enginio in a qmake-based project, add the line shown below to the .pro file.

QT += enginio

Initialize Enginio Client

To use the Enginio library, the required library headers must be included.

 #include <Enginio/Enginio>

Then an EnginioClient must be instantiated. The client requires a backend id, which can be copied from the Dashboard. Go to the Enginio Dashboard and select a backend. Copy the backend id value.

QByteArray backendId("YOUR_OWN_BACKEND_ID");
EnginioClient *client = new EnginioClient;

For testing purposes, it is easiest to hardcode the backend id directly into application code. However, this might not be always the best choice, and sometimes it might be beneficial to put the backend configuration in a separate configuration file.

Storing the First Object

Create an object in JSON format and fill in the data:

    QJsonObject city;
    city.insert("objectType", QString("")); // an object type is required for all objects in Enginio
    city.insert("name", QString("Oslo")); // other properties can be chosen freely
    city.insert("population", 624000);

Create the object in the Enginio database by calling EnginioClient::create():

    connect(client, SIGNAL(finished(EnginioReply*)), this, SLOT(uploadFinished(EnginioReply*)));

Note that the create() method performs the actual asynchronous network communication. Wait for completion by connecting to the finished and error signals.

Check the Enginio dashboard for the newly created object.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.