What differentiates a REST web service from a RPC-like one?

前端 未结 5 1548
Happy的楠姐
Happy的楠姐 2021-01-31 04:09

I have a web application that uses AJAX to grab JSON data from the server. It requires that the user first log in with their browser so that a cookie can be set. Only the

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-31 04:23

    REST is best described to work with the resources, where as RPC is more about the actions.

    REST: stands for Representational State Transfer. It is a simple way to organize interactions between independent systems. RESTful applications use HTTP requests to post data (create and/or update), read data (e.g., make queries), and delete data. Thus, REST uses HTTP for all four CRUD (Create/Read/Update/Delete) operations.

    RPC: RPC is basically used to communicate across the different modules to serve user requests. e.g. In openstack like how nova, glance and neutron work together when booting a virtual machine.

    REST/RPC:

    As a programming approach, REST is a lightweight alternative to Web Services and RPC. Much like Web Services, a REST service is:

    1. Platform-independent (you don't care if the server is Unix, the client is a Mac, or anything else),
    2. Language-independent (C# can talk to Java, etc.),
    3. Standards-based (runs on top of HTTP), and
    4. Can easily be used in the presence of firewalls.

提交回复
热议问题