background preloader

HATEOAS

HATEOAS
The HATEOAS constraint decouples client and server in a way that allows the server functionality to evolve independently. Details[edit] A REST client enters a REST application through a simple fixed URL. All future actions the client may take are discovered within resource representations returned from the server. The media types used for these representations, and the link relations they may contain, are standardized. The client transitions through application states by selecting from the links within a representation or by manipulating the representation in other ways afforded by its media type. For example [2] here is a GET request to fetch an Account resource, requesting details in an XML representation: GET /account/12345 HTTP/1.1 Host: somebank.org Accept: application/xml ... Here is the response: HTTP/1.1 200 OK Content-Type: application/xml Content-Length: ... <? Some time later the account information is retrieved again, but now the account is overdrawn: Origins[edit] See also[edit]

http://en.wikipedia.org/wiki/HATEOAS

Related:  restful APIAJAXArchitecture Générale

Hypertext Application Language Hypertext Application Language (HAL) is an Internet Draft (a "work in progress") standard convention for defining hypermedia such as links to external resources within JSON or XML code. The standard was initially proposed on June 2012 specifically for use with JSON[1] and has since become available in two variations, each specific to JSON or XML. The two associated MIME types are media type: application/hal+xml and media type: application/hal+json.[2] HAL was created to be simple to use and easily applicable across different domains by avoiding the need to impose any requirements on how the project be structured. Maintaining this minimal impact approach, HAL has enabled developers to create general-purpose libraries which can be easily incorporated on any API that uses HAL.[1]

XMLHttpRequest XMLHttpRequest (XHR) is an API available to web browser scripting languages such as JavaScript. It is used to send HTTP or HTTPS requests to a web server and load the server response data back into the script.[1] Development versions of all major browsers support URI schemes beyond http: and https:, in particular, blob: URLs are supported.[2] XMLHttpRequest is subject to the browser's same-origin policy: for security reasons, requests will only succeed if they are made to the same server that served the original web page. History and support[edit] The World Wide Web Consortium published a Working Draft specification for the XMLHttpRequest object on April 5, 2006, edited by Anne van Kesteren of Opera Software and Dean Jackson of W3C.[17] Its goal is "to document a minimum set of interoperable features based on existing implementations, allowing Web developers to use these features without platform-specific code." Support in Internet Explorer versions 5, 5.5, and 6[edit]

The HTTP OPTIONS method and potential for self-describing RESTful APIs The OPTIONS method is a somewhat obscure part of the HTTP standard that could be used today with a strong impact on the interconnectedness of the interwebs while requiring minimal effort. It's role is well defined in RFC2616, yet no web services that I can find are taking advantage of it. To quote the spec: This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval. Minimally, the response should be a 200 OK and have an Allow header with a list of HTTP methods that may be used on this resource. As an authorized user on an API, if you were to request OPTIONS /users/me, you should receive something like...

XMLHttpRequest Level 2 Abstract The XMLHttpRequest specification defines an API that provides scripted client functionality for transferring data between a client and a server. Status of this Document This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at JSON-LD JSON-LD, or JavaScript Object Notation for Linked Data, is a method of transporting Linked Data using JSON. It was a goal to require as little effort as possible from developers to transform their existing JSON to JSON-LD.[1] This allows data to be serialized in a way that is similar to traditional JSON.[2] It is a World Wide Web Consortium Recommendation that has been developed by the JSON for Linking Data Community Group before it has been transferred to the RDF Working Group[3] for review, improvement, and standardization.[4] Example[edit] By having all data semantically annotated as in the example, an RDF processor can identify that the document contains information about a person (@type) and if the processor understands the FOAF vocabulary it can determine which properties specify the person’s name and homepage. References[edit] Jump up ^ "JSON-LD Syntax 1.0". 2011-12-27.

Same origin policy This mechanism bears a particular significance for modern web applications that extensively depend on HTTP cookies to maintain authenticated user sessions, as servers act based on the HTTP cookie information to reveal sensitive information or take state-changing actions. A strict separation between content provided by unrelated sites must be maintained on the client side to prevent the loss of data confidentiality or integrity. History[edit] untitled REST is hot! But doing REST right is more difficult than most people think. Idempotent methods, hateoas, RMM levels… All terms that a REST developer should know and master. But from a learning (as I do too, by the way) developer perspective, it looks pretty simple: use HTTP methods like get, post, put and delete, map them onto resources, call the underlying database models and you’re done: a fully RESTfull API in just 5 minutes.

Asynchronous XMLHttpRequests with XhrIo - Closure Tools Overview JavaScript's XMLHttpRequest enables the responsive, persistent user interfaces that characterize AJAX applications. Web applications can use XMLHttpRequest to communicate with the server from JavaScript without reloading the page or blocking. But while most modern browsers support XMLHttpRequest, different browsers have different implementations. To make sure your app has the same behavior for each browser, you have to do extra work.

Related: