Difference between revisions of "REST and Hypermedia"
|Line 2:||Line 2:|
Latest revision as of 04:06, 23 May 2019
- 1 External
- 2 Internal
- 3 API
- 4 URL
- 5 URI
- 6 URN
- 7 Endpoint
- 8 Resource
- 9 Method
- 10 HTTP Protocol Semantics within a REST Application Context
- 11 Representation
- 12 Universal Resource Locator (URL)
- 13 Universal Resource Identifier (URI)
- 14 Representational State Transfer (REST)
- 15 Multipurpose Internet Mail Extension (MIME)
- 16 Media Type
A resource is a logical entity that an application can access through a resource path. A resource is a top-level constituent of a REST API. Resources are sometimes referred to as the nouns of the API. A resource has a number of methods.
TODO: receive data from client via path, Spring REST Concepts: Spring_REST_Concepts#Via_Path
Path Parameter, Path Variable, Variable Path Part
Also referred to as "path variable" or "variable path part".
A method corresponds to a REST API request that is submitted by the user of the API to a resource and to the response returned to the user. Methods belong to resources, and are defined by combinations of resource paths and operations. The API methods represent the programming interface between the client and the API.
A Method Request is part of the API's interface with the API's client.
A Method Response is part of the API's interface with the API's client.
HTTP Protocol Semantics within a REST Application Context
A resource's operations are defined by HTTP verbs:
Replace the state of the given resource with the one described in the given representation. PUT is semantic opposite of GET: whereas GET requests are used to send a resource representation from server to client, PUT is used to send a resource representation from client to server. Semantically, PUT mens "put this data at this URL", replacing any data that is already there. PUT is intended to perform a wholesale replacement of the resource, rather than a partial update operation. The partial update can be performed with PATCH. Put is an idempotent operation. If any of the resource representation part is missing, that state will be overwritten with null.
Defined in RFC 5789.
Updates a resource by modifying part of the state of the given resource based on the given representation. If some bit of resource state is not mentioned in the representation, it should be left unmodified. PATCH is like PUT, but allows for fine-grained changes in resource state.
Destroy the resource.
Discover which methods this resource responds to. This method is mostly used when a client explores the API.
Universal Resource Locator (URL)
Universal Resource Locator
Universal Resource Identifier (URI)
Universal Resource Identifier
Representational State Transfer (REST)
RWA page 32
Multipurpose Internet Mail Extension (MIME)
MIME is an internet standard that extends the format of e-mail to support text in character sets other then ASCII, non-text attachments, such as audio, video, images, application programs, etc., message bodies with multiple parts and header information in non-ASCII characters sets. MIME is specified in six linked RFCs: RFC 2045, RFC 2046, RFC 2047, RFC 4288, RFC 4289 and RFC 2049.
MIME is relevant to HTTP. The content types define by MIME are used in the definition of HTTP content. HTTP clients use MIME content type headers to indicate the desired application to process the specific type of content they send. HTTP servers insert MIME content type information in all their responses.
MIME defines the following headers:
A media type, also called media-type, content type or MIME type is a two-part string identifying the format of a document. Usually, knowing a document's format allows us to parse it. IANA (Internet Assigned Numbers Authority) is the official authority for the standardization and publication of media types. Within the context of REST, the media type is a format of a request and response body. Media types are specified by RFC6838 - Media Type Specifications and Registration Procedures.
The media type string consists of a type and a subtype. The subtype can be further be structured into a tree. A media type can optionally define a suffix and parameters:
type "/" [tree "." ] subtype ["+" suffix] *[";" parameter]
The currently registered types are: "application", "audio", "example", "font", "image", "message", "model", "multipart", "text" and "video".
An HTML file may be designated as: