这就是我设计 REST 的方式吗?我想要使用 REST 吗?
简而言之,我正在编写一个 Android 应用程序,我想从远程数据库中提取数据。我正在研究 .NET Web 服务,但是这个 如何调用 SOAP Web 服务关于 Android 的问题使我远离了那个方向。
REST 是否像编写一些简短的 PHP 来处理诸如 https://www.example 之类的内容一样简单.com/data.php?employee=michael 并让它返回相关的 XML 或 JSON 数据?对我来说,这似乎是各种网站和视频向我描述的。另外,这是通过互联网为移动设备、桌面应用程序等执行此类操作的最佳方式吗?
In short, I am writing an Android application that I want to have pull data from a remote database. I was looking into .NET web services, but this How to call a SOAP web service on Android question pointed me away from that direction.
Is REST as simple as writing some short PHP to handle something like https://www.example.com/data.php?employee=michael and have it return relevant XML or JSON data? That to me seems like what has been described to me by various sites and videos. Also, is this the best way to do this kind of operation over the internet for mobile devices, desktop applications, etc?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您所描述的内容几乎就是 REST 的内容。也许,但是 michael 员工的 URL 可能是这样的:
https://www.example.com/ 。
无论如何,REST 的想法是资源通过 URL 公开,并且一切都是无状态的 这是一个非常好的模型,可以用来从数据库中提取数据。它可以在移动应用程序和桌面应用程序中使用。
What you describe is pretty much what REST is about. Perhaps, however the URL to michael employee could be something like that:
https://www.example.com/employees/michael
Anyway, the idea with REST is that resources are exposed through URLs and that everything is stateless. This is a very good model to use in order to pull data from a database. It can be used both from mobile as well as desktop applications.
您所讨论的只是 REST 的一小部分。为了简单地从数据库中提取原始数据,基于 HTTP - I 类系统可能足以满足您的需求。
What you are discussing is only a small part of what REST is about. For simply pulling raw data from a database a HTTP based - Type I system is probably sufficient for your needs.