Learning rest together (5) -- rest Server Response

Source: Internet
Author: User

Original address: http://rest.elkstein.org/

Learn rest: a tutorial

A fast-training courseRest-
Re
PresentationalSTateTRansfer, a new approach to systems architecture and a lightweight alternative to Web Services

Rest-transition of expressive state-quick learning tutorial, a new system architecture method that can replace the lightweight Web service protocol.

_______________________________________________________________________________________

In rest, the server is usually an XML file, for example:

<parts-list> <part id="3322">  <name>ACME Boomerang</name>  <desc>   Used by Coyote in <i>Zoom at the Top</i>, 1962  </desc>  <price currency="usd" quantity="1">17.32</price>  <uri>http://www.acme.com/parts/3322</uri> </part> <part id="783">  <name>ACME Dehydrated Boulders</name>  <desc>   Used by Coyote in <i>Scrambled Aches</i>, 1957  </desc>  <price currency="usd" quantity="pack">19.95</price>  <uri>http://www.acme.com/parts/783</uri> </part></parts-list>

However, other formats can also be used. Unlike the soap service, rest is not bound to XML. Possible formats of rest are CSV (comma-separated values) and JSON (JavaScript Object Notation ).

Each format has its own advantages and disadvantages. XML is easy to expand (the client needs to ignore unfamiliar fields) and is type-safe; CSV is more compact; JSON is easy to be processed by the Javascript client (or in other languages ).

Except in special cases, rest does not support HTML and other formats, such as formats that make sense to humans, or formats that are not easy to process on the client. In particular, the rest service requires that a human-readable document be returned or the entire WWW be viewed. In fact, we found that HTML is the most commonly used rese response format .......

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.