Django RESTful specification

Source: Internet
Author: User
Tags representational state transfer

One, REST Frame work
    • Rest is not technology-related, it represents a software architecture style, rest is the abbreviation for representational state transfer, and Chinese translates as "representational states transfer"

    • Rest looks at the entire network from the resource's perspective, which identifies the resources distributed across a node in the network through URLs, and the client application uses URLs to obtain representations of the resources, resulting in these applications transforming state

    • Rest is not technology-related, it represents a software architecture style, rest is the abbreviation for representational state transfer, and Chinese translates as "representational states transfer"

    • All the data, but the data obtained through the network or operation (increase and deletion), are resources, all the data as a resource is the most essential attribute of rest difference and other architectural style

    • For the resource-oriented architectural style of rest, a new architectural concept is proposed, namely: resource-oriented architecture (Roa:resource oriented Architecture)

?
Second, RESTful standard interface design
?

  1. The API communicates with the user protocol, always using the HTTPS protocol. (Landlord Poor HTTP protocol)

  2. Domain name
    Https://api.example.com try to deploy the API to a dedicated domain name (cross-domain issues, two requests are sent)
    Https://yuan.cn/api/recommends the use of such a cost-saving, simple API design

  3. Version
    URLs, such as: https://api.example.com/v1/

  4. Raises multiple requests when a request header crosses a domain

  5. The path, depending on what is on the network is a resource, is used to denote (plural)
    Https://api.example.com/v1/zoos
    Https://api.example.com/v1/animals
    Https://api.example.com/v1/employees

  6. Method
    GET: Fetching resources from the server (one or more items)
    POST: Create a new resource on the server
    PUT: Update the resource on the server (the full resource after the client provides the change) (all changes)
    PATCH: Update resources on the server (client provides changed properties) (the user may only need to change some of them, such as passwords, security issues, mailboxes, no need to change all)
    Delete: Remove resources from the server

  7. filtering, passing search conditions in the form of URL upload parameters
    HTTPS://API.EXAMPLE.COM/V1/ZOOS?LIMIT=10: Specifies the number of records returned
    HTTPS://API.EXAMPLE.COM/V1/ZOOS?OFFSET=10: Specifies the start position of the returned record
    HTTPS://API.EXAMPLE.COM/V1/ZOOS?PAGE=2&PER_PAGE=100: Specify pages, and the number of records per page
    HTTPS://API.EXAMPLE.COM/V1/ZOOS?SORTBY=NAME&ORDER=ASC: Specifies which attribute the returned result is sorted by, and the sort order
    Https://api.example.com/v1/zoos?animal_type_id=1: Specifying filter criteria

Django RESTful specification

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.