Important concepts in the rest path-rest architecture

Source: Internet
Author: User

Resources

Within the framework of rest, everything is about resources. Each resource is defined as a URI.

format: <protocol>://<service-name>/<ResourceType>/<ResourceID>

In addition, another key part of the URI is "VERB", which always corresponds to what we call them as methods, usually in four forms-- Get/post/put/update

With regard to the expression of resources, rest has many forms of expression, with XML and JSON being the most common.

News

Rest uses the HTTP protocol as the transport medium between the client and server. The client sends HTTP Response to the client by sending an HTTP Request to Server;server.

For the convenience of understanding, explain the HTTP request/response in an illustrated way.

The following sections are excerpted from: https://www.tutorialspoint.com/restful/restful_messages.htm

HTTP Request

A HTTP Request has five major parts:

    • Verb-indicate HTTP methods such as GET, POST, DELETE, PUT etc.

    • URI-Uniform Resource Identifier (URI) to identify, the Resource on server

    • HTTP version-indicate HTTP version, for example HTTP v1.1.

    • Request Header-Contains metadata for the HTTP Request message as Key-value pairs. For example, the client (or browser) type, format supported by client, format of message body, cache settings etc.

    • Request Body-Message content or Resource representation.

HTTP Response

A HTTP Response have four major parts:

    • status/response Code-Indicate Server Status for the requested resource. For the example 404 means resource not found and the means response is OK.

    • HTTP version-indicate HTTP version, for example HTTP v1.1.

    • Response Header-Contains metadata for the HTTP Response message as Key-value pairs. For example, content length, content type, Response date, server type etc.

    • Response Body-Response message content or Resource representation.

Example

As we have explained on RESTful Web services-first Application tutorial, let's put Http://localhost:8080/UserMa Nagement/rest/userservice/users in POSTMAN with GET request. If you click on the Preview button residing near send button of Postman and then click on the Send button, the Followi ng output.

Here's can see, the browser sent a GET request and received a response body as XML.

Important concepts in the rest path-rest architecture

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.