rest assured qa testing code example

Example 1: qt rest api

QJsonDocument jsdoc;
jsdoc = QJsonDocument::fromJson(reply->readAll());
QJsonObject jsobj = jsdoc.object();
QJsonArray jsarr = jsobj[“feeds”].toArray();
foreach (const QJsonValue &value, jsarr) {
QJsonObject jsob = value.toObject();
qDebug() << jsob[“entry_id”].toInt();
qDebug() << jsob[“field1”].toString();
qDebug() << jsob[“field2”].toString();
qDebug() << jsob[“field3”].toString();
qDebug() << jsob[“created_at”].toString();
}
reply->deleteLater();

Example 2: qt rest api

QUrl myurl;
myurl.setScheme(“http”); //https also applicable
myurl.setHost(“api.thingspeak.com”); 
myurl.setPath(“/update.json”);

Tags:

Misc Example