Web service differences between REST and RPC

后端 未结 9 1276
情歌与酒
情歌与酒 2020-12-07 06:54

I have a web service that accepts JSON parameters and have specific URLs for methods, e.g.:

http://IP:PORT/API/getAllData?p={JSON}

This is

9条回答
  •  -上瘾入骨i
    2020-12-07 07:33

    You can't make a clear separation between REST or RPC just by looking at what you posted.

    One constraint of REST is that it has to be stateless. If you have a session then you have state so you can't call your service RESTful.

    The fact that you have an action in your URL (i.e. getAllData) is an indication towards RPC. In REST you exchange representations and the operation you perform is dictated by the HTTP verbs. Also, in REST, Content negotiation isn't performed with a ?p={JSON} parameter.

    Don't know if your service is RPC, but it is not RESTful. You can learn about the difference online, here's an article to get you started: Debunking the Myths of RPC & REST. You know better what's inside your service so compare it's functions to what RPC is and draw your own conclusions.

提交回复
热议问题