What is HTTP?

Source: Internet
Author: User
Tags representational state transfer
    • What is HTTP?
Most of the websites we 've seen may start with "www", but a complete address is like this: the full name of http://www.baidu.com/HTTP is Hypertext Transfer Protocol (Hypertext Transfer Protocol ), hypertext is a text with links, and transport protocol is a rule for getting something from one place to another. These rules are used to transfer pages to your browser.
    • Relationship between the client and the server
We can use HTTP to capture information on any web page on the Internet. These web pages are other computers on the Internet, and these computers are what we call servers. Clients and servers are everywhere on the Internet. Clients request resources such as webpages and files. The server stores the information. When you generate an HTTP request, this request will find the server that can execute the request through the Internet, and then the server will return a response to you.
    • Rest
Rest (representational state transfer) is a specific state transmission. In fact, the relationship between the client and the server is a prerequisite for rest. What is status transmission? You can go through a website by clicking the link, so you have created a status transfer and will take you to the next page every time. This page also represents the application Program . When something follows the rest rules, we call it restful.
    • Restful API
Application Programming Interface Code Protocol, which is a specific method used for interaction between a program and an application. A restful API or Web Service must meet the following requirements:
      • Separation of client and server
      • The request and request are not retained.
      • Use http and HTTP methods
    • Request
Four request actions:
      • Get: get information from a specific source
      • Post: Send new information to a specific source
      • Put: update existing information of a specific source
      • Delete: deletes existing information from a specific source.
HTTP request composition:
      • Request Line: Tell the server which kind of request is happening and what resources are being searched
      • Header: Additional information sent to the server, for example, which client sends the request
      • Body: The GET request can be empty. The post and put requests contain data.
    • Response response
The result of a successful request to the server is included in a response, which is a message that the server returns to the client. The response from the server contains a three-digit status code (HTTP status codes ). These codes start with 1, 2, 3, 4, and 5. (Http://zh.wikipedia.org/wiki/HTTP%E7%8A%B6%E6%80%81%E7%A0%81) Five status code:
      • 1xx: the server is executing your request
      • 2XX: the server has responded successfully.
      • 3xx: This type of Status Code indicates that the client must take further operations to complete the request. Usually, redirection is required.
      • 4xx: client Error
      • 5xx: Server Error
HTTP Response composition:
      • Response line: contains the HTTP status code
      • Header: contains information about the server and the response.
      • Body: Response content
    • Data format
      • XML (Extensible Markup Language) Extensible Markup Language

It is very similar to HTML, and uses the tags of angle brackets. The difference is that XML allows you to use the tags you assemble yourself.

<Pet> <Name> Jeffrey </Name> <Species> giraffe </species> </PET>
      • JSON (Java Script Object Notation) JS object symbol
JSON and XML are usually two choices. The JSON data format is similar to the JavaScript Object.
{"Pets": {"name": "Jeffrey", "species": "giraffe "}}

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.