关于RESTful

转载 2015年11月18日 15:05:09

最近纠结于RESTful的规范,翻了一下wiki,发现已经说的很好了,原文关于web服务的部分如下:


原文链接:https://en.wikipedia.org/wiki/Representational_state_transfer#CITEREFFielding2000

Applied to web services

Web service APIs that adhere to the REST architectural constraints are called RESTful APIs. HTTP-based RESTful APIs are defined with these aspects:

  • base URI, such as http://example.com/resources/
  • an Internet media type for the data. This is often JSON but can be any other valid Internet media type (e.g., XML, Atom, microformats, images, etc.)
  • standard HTTP methods (e.g., GET, PUT, POST, or DELETE)
  • hypertext links to reference state
  • hypertext links to reference-related resources[9]

Example[edit]

The following table shows the HTTP methods that are typically used to implement a RESTful API:

RESTful API HTTP methods
Resource GET PUT POST DELETE
Collection URI, such ashttp://api.example.com/resources/ List the URIs and perhaps other details of the collection's members. Replace the entire collection with another collection. Create a new entry in the collection. The new entry's URI is assigned automatically and is usually returned by the operation.[10] Delete the entire collection.
Element URI, such ashttp://api.example.com/resources/item17 Retrieve a representation of the addressed member of the collection, expressed in an appropriate Internet media type. Replace the addressed member of the collection, or if it does not exist, create it. Not generally used. Treat the addressed member as a collection in its own right and create a new entry in it.[10] Delete the addressed member of the collection.

The PUT and DELETE methods are referred to as idempotent, meaning that the operation will produce the same result no matter how many times it is repeated. The GET method is asafe method (or nullipotent), meaning that calling it produces no side-effects. In other words, retrieving or accessing a record does not change it.

Unlike SOAP-based web services, there is no "official" standard for RESTful web APIs.[11] This is because REST is an architectural style, while SOAP is a protocol. Even though REST is not a standard per se, most RESTful implementations make use of standards such as HTTPURIJSON, and XML.[11]

相关文章推荐

Java RESTful Web Service实战

  • 2017年11月14日 15:37
  • 49.14MB
  • 下载

C# 以 HTTP/SSL(双向) 方式请求 Java Jersey 发布的 Restful 资源与TCPSocket客户端

由于项目需要,现在要用C#以HTTP方式请求Java Jersey发布的 Restful资源。自己写了一个工具类,开源一下。 高手请飘过。请不要做非人类的事情,转载请留名!     usi...

RestFul服务介绍

  • 2017年11月21日 09:25
  • 269KB
  • 下载

RESTful PHP Web Service

  • 2017年10月31日 16:58
  • 12.56MB
  • 下载

SpringBoot-创建RESTful风格的 http接口访问jpa 来操作数据库

1.开发工具IDE:Intellij Idea,数据库mysql(SpringBoot,创建RESTful 接口很方便,只要建立好数据模型,然后创建一个模型仓库接口就ok了)2.开始开发2.1项目目录...
  • r8l8q8
  • r8l8q8
  • 2017年08月04日 20:41
  • 603

C++实现 Https Server 支持 restful json

  • 2017年10月19日 00:16
  • 20KB
  • 下载

w7 restful客户端

  • 2017年06月01日 19:30
  • 59.64MB
  • 下载

REST和RESTFUL的相关概念理解

1.REST和RESTFUL是什么    REST ( REpresentational State Transfer ),State Transfer 为 "状态传输" 或 "状态转移 ",Repr...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:关于RESTful
举报原因:
原因补充:

(最多只允许输入30个字)