qtrest / qtrest Goto Github PK
View Code? Open in Web Editor NEWQt REST Client
License: MIT License
Qt REST Client
License: MIT License
Why getVariantMap method is private in AbstractJsonRestListModel and AbstractXmlRestListModel? I think this method should be declared as protected similarly to getVariantList. The reason is that it can be useful for additional methods in C++ model. For example, calling an additional action of rest api.
Thanks for missing part in QT!
Can you provide some code snippets of how to use your lib in C++?
I have a little trouble using ready model (JsonRestListModel) from within C++:
I tried the following code:
APIBase * api = new APIBase();
api->setBaseUrl("http://192.168.2.200:8888");
JsonRestListModel model;
model.setApiInstance(api);
model.requests()->setGet("/api/object");
model.requests()->setGetDetails("/api/object/{id}");
QVariantMap filters;
filters["isArchive"] = "0";
model.setFilters(filters);
QStringList fields;
fields << "id" << "name" << "type";
model.setFields(fields);
model.fetchDetail("object_id");
But it returns "No item with id object_id"
When inheriting from APIBase, the following code works:
MyApi * client = new MyApi();
client->setBaseUrl("http://192.168.2.200:8888");
QNetworkReply *reply = client->getObjectDetails("object_id");
QEventLoop loop;
connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
loop.exec();
QVERIFY(!reply->error());
QJsonParseError parseError;
QJsonDocument document = QJsonDocument::fromJson(reply->readAll(), &parseError);
MyApi looks like the following:
QNetworkReply *MyApi::getObjectDetails(QString id)
{
if (id.isEmpty()) {
qDebug() << "ID is empty!";
return 0;
}
QUrl url = QUrl(baseUrl()+"/api/object/"+id);
QNetworkReply *reply = get(url);
return reply;
}
Tanx!
Hi,
I am trying to build your qtrest-example, but failing misreably . can you please help so that understanding the structure of qtrest client will eased out.
This looks like a very promising library. I would like to use it for communicating with our company private Buildbot using its REST API. The problem is that our Buildbot instance is proxied behind Apache, which is configured to do client certificate authentication (all employees have their own client certificate).
So I would need a way to configure the QSslConfiguration that qtrest uses, so that in my application, I can let the user select his/her .p12
certificate bundle to be used for authentication.
Hello!
Sorry for this silly question, but can this be used for a website that has different API methods?
If yes, can you please just guide me some steps? Because I'm a bit new to C++ (Blame me) and need to know just some basic information about this :)
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.