RESTful API Design Methodology

Source: Internet
Author: User
Tags representational state transfer

1. If you have already begun to reach out to a friend of the RESTful API design approach, you should first have a general understanding of HTTP/HTTPS, although it has nothing to do with restful APIs. However, to increase the security of the site is very important, here is related to whether to expose the API interface, otherwise it will lead to the disclosure of user information, so that the credibility of the site is affected.

2. What is rest?

Rest full Name (Resource representational state transfer) that is, the resource is in some form in the network to transfer status--so-called State transfer

It can be said that rest is a system architecture design style rather than a standard, is a design style acceptable to everyone, is a distributed Application layer solution

3. The background of the birth?

In the early days, the front and back of the page was one, such as php,jsp. With the rapid development, now the mobile end is flooded with a variety of clients (client), so there is an urgent need for a unified mechanism to complete the front-end communication, so rest is applied.

3.RESTful API

For restful APIs, like computers, there are zero-to-none. And the RESTful API is a more mature application API design theory at present

4. What is the purpose of using the RESTful API?

Objective: To further decouple the client and server side.

5. Advantages

(1) Client-Server (client-server): The server that provides the service and the client that uses the service detach decouple;

Advantages: Improve the convenience of the client (simple operation)

Simplify servers for scalability (high performance, low cost)

Allow client server-side teaming optimizations that are unaffected by each other

(2) stateless (stateless): Each request from the customer must contain all the information required by the server to process the request (Request information uniqueness);

Pros: Increased visibility (each request can be considered separately)

Increased reliability (more prone to failure recovery)

Increased scalability (reduced server resource usage)

(3) cacheable (cachable): The server must let the client know if the request can be cached? If possible, the client can reuse the previous request information to send the request;

Pros: Reduce the number of interactive connections

Reduce network latency in the connection process

(4) tiered systems (layered system): Allows the middle tier (proxy, gateway, etc.) between the server and the client to respond to the client's request instead of the server, and the client does not need to be concerned with the components that interact with it;

Advantages: Improved scalability of the system

Simplifies the complexity of the system

(5) Unified Interface (Uniform Interface): The method of communication between the customer and the server must be unified. (Example: Get,post,put. DELETE)

Benefits: Improved visibility of interactions

Encourage individual optimizations to improve components

(6) Support on-demand code (Code-on-demand, optional): The server can provide some code or script and execute it in the client's running environment.

Benefits: Improved Scalability

6.API communication protocol with the client, always using the HTTPS protocol.

7. Resource-centric URL design

Resources are a core element of the RESTful API, and all operations are done for specific resources. The resource is the URL (Uniform resoure Locator), so a concise, clear, structured URL design is essential.

RESTful API Design Methodology

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.