douaonong7807 2014-09-22 11:37
浏览 45
已采纳

我需要Web API或普通的Web服务吗? [关闭]

My Android app calls for some data that I have stored in my database. I've worked with some Java Dynamic Web Apps, wherein they'll use cxf and write web APIs, catering to the requests. This seemed like the obvious idea for me to take up. So I wrote my REST API, used Jersey, and everything seemed to be working fine.

But then I checked out the cost of hosting a Java app on server, and then I decided to write the API in PHP. I thought that REST was basically just providing different URLs. But then I came across this tutorial here. In this tutorial, the author just makes call to normal PHP files, and that's it. I am echoing JSON encoded data in my PHP script, that I get back. This does not sound very RESTful to me. Maybe because I don't see /getClientInfo,addClientInfo kind of URLs.

Calling normal PHP scripts is just so normal. What did REST add to it?

  • 写回答

1条回答 默认 最新

  • dongnuo6310 2014-09-22 13:05
    关注

    In short: it does not matter. At all.

    The actual API here is an HTTP interface. The web server this all runs on is the API. You're just dressing it up differently by using different URLs or possibly different protocols on top of HTTP, e.g. SOAP or such. But fundamentally nothing changes, you're making an HTTP request and you're receiving data back in an HTTP response, period.

    REST is simply one way to structure your API's URL names and parameter conventions etc., and a way that makes sense in the context of HTTP. But it's not the only way and by itself REST doesn't do anything that's absolutely necessary or not doable any other way.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 matlab如何绘制三维瀑布图
  • ¥15 关于用abap来解决动态规划的问题,但是要求输出索引值,这个是难点
  • ¥15 在ISIS中什么是IP从地址
  • ¥15 压测时,并发量过高时,响应时间出现尖刺
  • ¥15 关于vmprotect3.8.4虚拟文件一项
  • ¥15 在不用IT调试的情况下怎样能连外网
  • ¥20 C#调用虚拟键盘TabTip.exe
  • ¥15 Qt4代码实现下面的界面
  • ¥15 CCS离散化传递函数与仿真不一致
  • ¥15 prism提示我reinstall prism 如何解决