Fiction Building Hypermedia Apis With Html5 And Node Pdf


Sunday, September 15, 2019

Building Hypermedia Apis With Html5 And Node Amundsen Mike. Building Hypermedia Apis rar, word, pdf, txt, kindle, zip, and ppt. guide pour la rédaction des. building hypermedia apis with pdf building hypermedia apis with html5 and node mike amundsen Hypermedia As The Engine Of Application. State (HATEOAS). books > Development > Building Hypermedia APIs with HTML5 and Node - download pdf or read online. Rated of 5 – based on 29 votes Posted in.

Building Hypermedia Apis With Html5 And Node Pdf

Language:English, Spanish, Portuguese
Genre:Politics & Laws
Published (Last):01.05.2016
ePub File Size:22.37 MB
PDF File Size:9.30 MB
Distribution:Free* [*Regsitration Required]
Uploaded by: KRISTY

Building Hypermedia APIs with HTML5 and Node Programming the Web with Hypermedia APIs. 6 This books is Free to download. "Building Hypermedia Apis With HTML5 And Node book" is available in PDF Formate. Learn from this free book and enhance . JSBooks/[Building Hypermedia APIs with HTML5 and Node Kindle Edition by Mike Amundsen - ].pdf. Find file Copy path. Fetching contributors.

This book shows system architects and web developers how to design and implement human- and machine-readable web services that remain stable and flexible as they scale. An internationally known author and lecturer, Mike Amundsen travels throughout the United States and Europe consulting and speaking on a wide range of topics including distributed network architecture, Web application development, Cloud computing, and other subjects. His recent work focuses on the role hypermedia plays in creating and maintaining applications that can successfully evolve over time. Would you like to tell us about a lower price? If you are a seller for this product, would you like to suggest updates through seller support? Read more Read less. Frequently bought together.

Write a customer review. Top Reviews Most recent Top Reviews. There was a problem filtering reviews right now. Please try again later. Kindle Edition Verified Purchase. I don't think this will convince you to go all out for hypermedia, but you'll get a solid, clear foundation for how hypermedia can help you better design and implement web APIs. This book covers the case for both human and machine clients.

In particular, I found the use of HTML5 a real treat, as I'd never considered it for machine-to-machine communications. I highly recommend it. Paperback Verified Purchase. It's a great intro to hypermedia and if you work with web services of any kind, any technology it's the kind of book that helps expanding your horizons and suggesting different approaches to common problems.

I don't think the title was a great choice. Or maybe "The Woodstock of web services": Anyways, the only reason for not giving it 5 stars is that I'm not entirely convinced of the practicality of some of those concepts. But that's absolutely nothing against the author nor the book, it's just that hypermedia services are so different than traditional web services that you have to question a few things before start making design changes here and there.

Definitely a book worth reading. Absolutely excellent, but to me it was difficult to assess if the recommended practices are actually in wide use or not. Perfect Thanks! Mike Amundsen displays a deep knowledge of the reasoning behind his recommendations and explains things in a way that allows one to build with the great ideas that he continually displays throughout the text. This is a good intro to building hypermedia apis.

It definitely gives you the information that you need to start reviewing if hypermedia apis are right for you. Don't let the HTML5 and Node thing throw you, the information really does apply to whatever language you are working with. Had a few really good examples, but for the most part examples repeated themselves. I thought overall the book was lacking in high-level content for those unfamiliar with hypermedia design.

Here are some tips for writing great reviews: See all 10 reviews. Amazon Giveaway allows you to run promotional giveaways in order to create buzz, reward your audience, and attract new followers and customers. Learn more about Amazon Giveaway. This item: Creating Evolvable Hypermedia Applications. Set up a giveaway. There's a problem loading this menu right now.

Learn more about Amazon Prime. Get fast, free shipping with Amazon Prime. Back to top. Get to Know Us. Amazon Payment Products. English Choose a language for shopping. Amazon Music Stream millions of songs. Amazon Advertising Find, attract, and engage customers. Amazon Drive Cloud storage from Amazon. The advantage of this approach is that it provides clear description for all parties.

The downside is that it most often is used as a way to express the details of private objects almost always on the server. When these objects change, all previously deployed clients can become broken and must be rebuilt using the newly published schema document. While it is true that this compile-time binding is not a requirement of the SOAP model, to date no major web libraries exist for clients and servers that treat this schema information in a dynamic way that scales for the Internet.

Another common solution is to try to make the URI carry type information. This is a popular solution since most frameworks can easily generate these URIs from metadata within the source code. This method also makes things relatively easy for frameworks that use templating and other processing based on the type. Of course the biggest drawback is that you lose control of your public URI space.

Typing via URIs means private source code decides what your URIs look like and any change to source code threatens to invalidate previously published and possibly cached URIs. Developers who want to remain in control of their URIs can opt for the another common typing option: This approach has the distinct advantage of allowing frameworks to sniff the contents of the payload in order to find the type hint and process the data accordingly.

The primary drawback of this method, however, is that the payload is now tightly bound to source code and, again, changes to the source code on the server will modify response payloads and may invalidate incoming request payloads from clients who have no idea the server has changed the details of the typed object.

Another solution is to create a custom public media type for each private object on the server. The advantage here is that you have full control over both the public URI and the payload although most frameworks link a private class to these custom media types.

The downfall of this approach is that it merely pushes the problem along; in this scenario a single application could generate dozens of new media types. It would be an incredible feat for an independent client application to try to keep up with recognizing and parsing the thousands of media types that might be produced in a single year. As is probably evident to the reader, type-marshaling is a difficult challenge for distributed networks where client and server applications are built, modified, and maintained independently, and where public-facing connectors may be expected to be maintained in production for a decade or more.

The solutions illustrated above all fall short of supporting this kind of environment because they all suffer from the same flaw: The short answer is to stop trying to keep clients and servers in sync by working out ways to share private types. Instead what is needed is a technique for describing data in a way that is not bound to any internal type, programming language, web framework, or operating system. And one answer is to look beyond payloads based on marshaled types and toward payloads based on the principles of hypermedia.

Relying on payloads based on hypermedia designs avoids the common pitfalls of the type-marshaling dilemma. Hypermedia payloads carry two types of vital metadata: Both are important to enabling stable and flexible distributed network applications. By committing to message designs without the constraints of a particular internal type system, designers are free to craft payloads to more directly address the needs of the problem domain.

By creating messages that contain not just data points but also information about the data e. Finally, by crafting responses that include data and its metadata ; information about the current state of the application itself; and possible transitions available at the present moment, distributed network applications can offer interfaces—interfaces that take advantage of new state transitions and new information flows that may appear over the lifetime of the application—to both human and machine-driven agents.

This type of message design places stability and flexibility at the forefront of the architecture. Hypermedia messages contain not only the data requested but also metadata. To make this point clear, consider a server that offers data on users defined for a network application.

The server might return the data in the following form:. Note that the data contains no descriptive information, or no metadata. This works if both the client and server have a complete shared understanding over all the possible requests and responses ahead of time.

It works if a human is assumed to be able to infer the missing details. However, in a distributed network where independent individuals might be able to create new applications to access this same data—individuals that might not know all of the details of every shared request and response—this raw data can be a problem.

Hypermedia designs can send additional metadata that describes the raw data. Here is the same data marked up using the HTML hypermedia format:. The example here is simplistic this is just one possible way to add metadata to the reponse , but it conveys the idea. Hypermedia designs include more than raw data; they include metadata in a form easily consumed by both humans and machines. The details of selecting an appropriate data format to carry the metadata is part of the design process that will be explored later in this chapter see Hypermedia Design Elements.

Marking up the raw data is only part of the process of designing hypermedia. Another important task is to include metadata about the state of the application itself.

It is the availability of application metadata in the message that turns an ordinary media type into a hypermedia type.

This kind of application metadata allows the client to modify the state of the application, and to drive the application forward in a way that gives the client the power to add, edit, and delete content, compute results, and submit filters and sorts on the available data.

This is hypermedia. This is the engine of application state to which Fielding refers in his dissertation. Below are some examples of application metadata in an HTML message. You can see a list of users as in the previous example along with navigation, filtering, and search options that are appropriate for this response and the identified user making the request.

This information lets the client application know that there are ways to navigate through the list, filter the data, and search it by username. Good hypermedia designs make sure the application metadata is context-sensitive. Just as human users can become confused or frustrated when offered too many options, quality hypermedia design includes making decisions on the most appropriate metadata to provide with each response. Most of the examples in this section use the HTML media type, a well-known format.

But HTML is not the only possible way to provide hypermedia to clients. In fact, HTML is lacking in some key hypermedia elements that might be important in your use cases. There are a handful of hypermedia elements that you can use to express application metadata.

HTML has many; others appear in different media types. In order to allow clients to drive the application state, these elements must appear within the server responses. This section identifies one of the common pitfalls of implementing applications on the Web: Many web applications today suffer from this problem, often because the programming languages, frameworks, and editors in use today encourage it.

However, a more stable and flexible approach is available using hypermedia-rich messages as the primary way to share understanding between clients and servers. Unlike data-only messages based on type-marshaling, hypermedia messages contain the raw data, metadata about that data, and metadata about the state of the application. The next section describes a set of abstract factors that make up a set of building blocks for designing hypermedia messages.

These building blocks are called H-Factors.

Designing hypermedia messages involves deciding how to represent the requested data including metadata about the requested data as well as deciding how to represent application metadata such as possible filters, searches, and options for sending data to the server for processing and storage. The details of representing the application metadata is handled by hypermedia elements within the message.

The actual message elements, attributes, etc. However, despite these variances, the abstract options represented are the same across all media types and format.

There are nine H-Factors, and they can be placed into two groups: The five link factors denote specific linking interactions between client and server: The remaining four control factors provide support for customizing metadata details e. HTTP Headers of the hypermedia interaction: Reads, Updates, Method, and Link Annotations. Each of the H-Factors provide unique support for hypermedia designs. In this way, H-Factors are the building blocks for adding application hypermedia to messages.

Building Hypermedia APIs with HTML5 and Node [Book]

It is not important that your design use every one of these factors. In fact, to date, there is no widely used hypermedia design that incorporates all of these factors. What is important, however, is knowing the role each factor plays and how it can be used to meet the needs of your particular implementation. Below are brief descriptions of each of these factors along with examples from existing media types and formats.

Link factors represent opportunities for a client to advance the state of the application. This is done by activating a link. Some links are designed to update a portion of the display content with new material LE while other links are used to navigate to a new location LO. Some links allow for additional inputs for read-only operations LT , and some links are designed to support sending data to the server for storage LI and LN.

In effect, this results in merging the current content display with that of the content at the other end of the resolved URI. This is sometimes called transclusion. In the above example, the URI in the src attribute is used as the read target and the resulting response is rendered inline on the web page.

This is also known as a traversal or navigational link. In a common web browser, activating this control would result in replacing the current contents of the viewport with the response. The LT factor provides a way to indicate one or more parameters that can be supplied when executing a read operation. However, LT factors offer additional information in the message to instruct clients on accepting additional inputs and including those inputs as part of the request.

The LT element is, in effect, a link template. The details on how link templates LT are expressed and the rules for constructing URIs depends on the documentation provided within the media type itself. Templated links can also be expressed directly using tokens within the link itself.

Building Hypermedia APIs with HTML5 and Node (pdf)

The LI factor provides a way for media types to define support for idempotent submissions to the server. While HTML does not have direct support for idempotent submits within markup e. Like the LT factor, LN can offer the client a template that contains one or more elements that act as a hint for clients. These data elements can be used to construct a message body using rules defined within the media type documentation.

In the above example, clients that understand and support the HTML media type can construct the following request and submit it to the server:. It should be noted that the details of how clients compose valid payloads can vary between media types. The important point is that the media type identifies and defines support for non-idempotent operations. Control factors provide support for additional metadata when executing link operations.

Regardless of the mechanism, control factors fall into four categories: Read, Update, Method, and Link Annotation.

Building Hypermedia APIs with HTML5 and Node by Mike Amundsen

One way in which media types can expose control information to clients is to support manipulation of control data for read operations CR. One example is the Accept-Language header. Below is an example of XInclude markup that contains a custom accept-language attribute:.

In the example above, the hypermedia type adopted a direct mapping between a control factor the accept-language XML attribute and the HTTP protocol header Accept-Language. There does not need to be a direct correlation in names as long as the documentation of the hypermedia design provides details on how the message element and the protocol element are associated. The value for this attribute is used to populate the Content-Type header when sending the request to the server.

Media types may also support the ability to change the control data for the protocol method used for the request. In the first part of the example below, the markup indicates a send operation using the POST method. The second part uses the same markup with the exception that the GET method is indicated. This second example results in a read operation:.

In addition to the ability to directly modify control data for read and submit operations, media types can define CL factors that provide inline metadata for the links themselves. Link control data allows client applications to locate and understand the meaning of selected link elements with the document. For example, Atom documentation identifies a list of registered Link Relation Values that clients may encounter within responses.

Clients can use these link relation values as explanatory remarks on the meaning and possible uses of the provided link. In the above example, the client application web browser can use the URI supplied in the href attribute as the source of style rendering directives for the HTML document.

This section has identified a limited set of elements H-Factors that describe well-known protocol-related operations. These operations make up a complete set of hypermedia factors.

These factors can be found, to some degree, in media types designed to support hypermedia on the Web. H-Factors are the building blocks for designing your own hypermedia APIs. Along with knowing the set of hypermedia factors that can be expressed within a message, there are a number of basic design elements that need to be addressed when authoring hypermedia types. These elements are:. They each have their advantages and limitations, which will be covered in this section. Many hypermedia types allow client-initiated state transfer sending data from the client to the server.

In Identifying Hypermedia: H-Factors , several hypermedia factors were identified as supporting state transfer. Hypermedia designs typically have three styles of state transfer: None i. Hypermedia designs usually express some level of domain affinity. Domain styles can be categorized as Specific, General, or Agnostic. Hypermedia designs may also contain elements that express possible application flow options.

This allows client applications to recognize and respond to possible options that allow for advancing the application through state transitions at the appropriate times.

Application Flow styles for hypermedia can be identified as None, Intrinsic, or Applied. These hypermedia design elements minus the Base Format element can be viewed as a matrix. All hypermedia types can be inspected for these design elements Format, State Transfer, Domain Style, and Application Flow and their values identified.

In this way, you can analyze existing hypermedia types and use the same information in making selections for your own hypermedia type designs. Just as the previous section Identifying Hypermedia: H-Factors identified a set of factors or building blocks for hypermedia, this section describes a set of design elements or techniques for applying those factors to a hypermedia design.

The following sections explore each of these design elements, provide examples, and offer some guidance on their use in your hypermedia designs. A critical element in any hypermedia design is the base-level message format. This section explores the advantages and limitations of these common formats. The XML media type is a common base format for designing hypermedia. There are several advantages to using XML as your base format.

XML data types are also standardized. Even better, almost all programming environments support these technologies in a consistent way. Designers can take advantage of this pattern in many ways, including using elements to define top-level data descriptors in the media type, and attributes as additional or metadata items. There are some related XML standards XLink, XForms that can be applied, but these may or may not be exactly what the use case requires and these additional standards may not be widely supported on all target platforms.

However, if your use cases require strong standardized support for your hypermedia type across a wide range of platforms and environments, XML can be an excellent choice as a base format. Today it is possible to find JavaScript as the default programming language for clients web browsers , servers Node. This data structure has been standardized, and parsers are available for a wide range of languages outside JavaScript, too.

Another advantage of JSON is that it is a very terse format. For example, unlike XML, whose design can end up using more bytes for element names than for the data these elements describe, JSON has relatively low overhead and this can make messages very small and easy to move about. While JSON is a standard, it is still relatively new. Designing a hypermedia type with JSON requires the definition of all the H-Factor elements from scratch, including figuring out the best way to express control data information such as language preferences and protocol method names, etc.

Despite these drawbacks, if your target audience is made up of web browsers and other environments where JavaScript is common, JSON may be a good fit as the base format for your hypermedia type design. HTML can be an excellent choice as a base format for your hypermedia design for a number of reasons. First, it is a mature and stable technology that is more than twenty years old.

Second, HTML has one of the most ubiquitous client applications common web browsers available on almost any platform. Third, browsers support code-on-demand via JavaScript, which adds a power dimension to delivering hypermedia via HTML. This is probably because HTML suffers from an unfair assumption that it is an old-school, bloated technology appropriate only for cases where a human is driving a web browser client. HTML does have some drawbacks. One of the biggest downsides to using HTML as your base format is that it is domain-agnostic see Agnostic.

But these limitations are usually outweighed by the advantages of HTML. That means it is relatively easy to use HTML for use cases that do not require web browsers e.

Since HTML can be used in wide number of client environments including web browsers, HTML can be a very good choice as a base format for your hypermedia designs.

Protocol Buffers can be used in hypermedia designs. However, many of these formats lack not only native hypermedia controls, but the document structure needed to define them. For example, XML offers element names and attributes to hold your application-specific metadata.

JSON has hash tables and arrays that can be given meaningful names to match your application domain. HTML has a number of attributes especially designed to hold domain-specific information.

Most of the alternate base formats mentioned here do not have these types of allowances. For the purposes of this book, attention will remain on the three most commonly used base formats today.

If your use case calls for supporting hypermedia using one of these other formats, you may have some additional challenges, but you should still be able to apply the same design ideas shown here.

Technically, RDF is not format or media type. It is a data interchange standard that leverages the tuples pattern, relies heavily in URIs, and uses well-defined ontologies. Another key aspect of hypermedia design is supporting the transfer of information i. This client-initiated state transfer is really the heart of hypermedia messaging. There are many media type designs focused on efficient transfer of data from servers to clients, but not many do a good job of defining how clients can send data to servers.

In some cases, read-only designs are appropriate for the task. For example, bots that search for and index specific data on the Web usually have no reason to send data to other servers. However, in cases where client applications are expected to collect inputs e. For the purposes of this book, we can divide the work of expressing client-initiated state transfer for hypermedia types into three types: As was already mentioned, there are a number of scenarios where hypermedia types do not need to support client-initiated state transfers.

In these cases, the media types are, essentially, read-only. That does not mean that the messages are devoid of hypermedia controls. If your use case does not require clients to transfer data directly to servers, using a media type design that supports no client-initiated state transfer is a perfectly valid design choice.

Another common approach to handling client-initiated state transfer is to rely on predefined transfer bodies that clients learn and then use when indicated.

One of the advantages of using predefined state transfers is that client-coding can be relatively straightforward. Client applications can be pre-loaded with the complete set of valid state transfer bodies along with rules regarding required elements, supported data types, message encoding, etc.

The only remaining task is to teach clients to recognize state transfer opportunities with response messages, and to know which transfer body is appropriate. In the case of the AtomPub protocol, there are two basic client-initiated state transfers defined in the specification:. These transfers represent entries in an Atom feed document and can be treated as a stand-alone resource.

These transfers support binary uploads images, etc. The details on how clients can recognize when state transfers are supported e. In cases where your media type only needs to support a limited set of possible state transfers from the client, it can be a good design choice to define these state transfer bodies within documentation and encourage client applications to embed the rules for handling this limited set directly in the client code.

A very familiar method for handling client-initiated state transfers is to use an ad-hoc design pattern. In this pattern, the details about what elements are valid for a particular state transfer are sent within the hypermedia message itself.

Since each message can have one or more of these control sets, clients must not only know how to recognize the hypermedia controls but also how to interpret the rules for composing valid transfers as they appear. The primary advantage of adopting the ad-hoc style is flexibility. Document authors are free to include any number of transfer elements inputs needed to fulfill the immediate requirements.

This also means that client applications must be prepared to recognize and support the state transfer rules as they appear in each response.

Building Hypermedia Apis With HTML5 And Node Book

For human-driven clients, ad-hoc state transfers can be handled by rendering the inputs and waiting for activation. However, for clients that have no human to intervene, the ad-hoc style can be an added challenge.

If your primary use case is for automated client applications, the ad-hoc state transfer style may not be the best design choice. The HTML documentation identifies the hypermedia elements e. Once client applications know how to handle the designated elements, they will be prepared to handle a wide range of hypermedia messages. If your use case requires the power and flexibility of ad-hoc state transfers, this is probably the best choice for your media type design.

The process of selecting element and attribute names, deciding where hierarchies should exist, and so on, is the essence of translating the problem domain into message form. Modeling the problem domain focuses on the information that needs to be shared, stored, computed, etc.

These elements are then passed between parties where they can be processed, computed, stored, and passed again when requested. Achieving a desirable domain model for messaging is the art of hypermedia design. The closer a design is to modeling the problem space, the easier it is to use the design to accurately express important activities over a distributed network.

However, the more closely tied a message design is to a single problem domain, the less likely it is that the design can be applied to a wide range of problems.

This balance between specificity and generality is at the core of hypermedia design. It can be helpful to view this issue like others covered here in three broad categories:

KANDI from Kentucky
Feel free to read my other articles. I am highly influenced by renting movies. I relish searchingly .