C++/Qt 的 RESTful 接口?

发布于 2024-09-01 16:36:55 字数 283 浏览 3 评论 0原文

我想将 RESTful-API 集成到我的 Qt 项目中。
我已经阅读了页面上的示例,但这仅适用于从 RESTful 接口接收数据,不适用于向服务器发送新数据。例如,在 Java 中,我可以使用 RESTlet,是否也可以在 Qt 中使用类似的东西?
或者是否有一种简单的方法将数据从 Qt 发送到 RESTful,例如当我之前创建 XML 时?

I want to integrate the RESTful-API in my Qt-Project.
I already read the example on this page, but this is only for receiving data from a RESTful-interface, not for sending new data to the server. In Java, I can use RESTlet for example, is there any possibility to use something like that for Qt, too?
Or is there even a simple way to send data from Qt to RESTful, for example when I create a XML before?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

£冰雨忧蓝° 2024-09-08 16:36:55

由于 REST 只是普通的 URL 访问,因此您没有理由不能使用 Qt HttpClient 接口与后端 Java REST 接口进行对话。您只需决定使用 XML 还是 JSON - 两者都有非常强大的可用库,而且都只是文本接口。

你问的很奇怪,我今天自己正在做这件事 - 我正在 Java 中实现一个基于 JSON 的 REST 接口,我很快就会将管道连接到我的 Qt 应用程序。

随着我的进步,我将努力更新这个答案。

Since REST is just normal URL access, there's no reason you can't use the Qt HttpClient interfaces to talk to you backend Java REST interface. You just have to make a determination to use XML or JSON - both have very capable libraries available, and both are just text interfaces.

Odd you ask, I'm in the middle of doing this very thing myself today - I'm implementing a JSON based REST interface in Java, and I'll wire up the plumbing to my Qt app shortly.

I'll make an effort to update this answer as I progress.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文