background preloader

RESTful Web services: The basics

RESTful Web services: The basics
The basics REST defines a set of architectural principles by which you can design Web services that focus on a system's resources, including how resource states are addressed and transferred over HTTP by a wide range of clients written in different languages. If measured by the number of Web services that use it, REST has emerged in the last few years alone as a predominant Web service design model. REST didn't attract this much attention when it was first introduced in 2000 by Roy Fielding at the University of California, Irvine, in his academic dissertation, "Architectural Styles and the Design of Network-based Software Architectures," which analyzes a set of software architecture principles that use the Web as a platform for distributed computing (see Resources for a link to this dissertation). This article suggests that in its purest form today, when it's attracting this much attention, a concrete implementation of a REST Web service follows four basic design principles: Back to top

Simple example - Node.js, Restify, MongoDb and Mongoose - Backbone.js Tutorials Before I start, the Backbone.js parts of this tutorial will be using techniques described in "Organizing your application using Modules to construct a simple guestbook. Getting started To easily understand this tutorial you should jump straight into the example code base. Example Codebase Example Demo This tutorial will assist you in saving data(Backbone.js Models) to MongoDb and retrieving a list(Backbone.js Collections) of them back. The technologies This stack is great for rapid prototyping and highly intuitive. Node.js "Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Restify "Restify is a node.js module built specifically to enable you to build correct REST web services. MongoDb "MongoDB (from "humongous") is a scalable, high-performance, open source NoSQL database." Mongoose "Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment." Building the server Restify configuration Mongoose Schema

rest - RESTful URL design for search Representational state transfer Representational State Transfer (REST) is a software architecture style consisting of guidelines and best practices for creating scalable web services.[1][2] REST is a coordinated set of constraints applied to the design of components in a distributed hypermedia system that can lead to a more performant and maintainable architecture.[3] REST has gained widespread acceptance across the Web[citation needed] as a simpler alternative to SOAP and WSDL-based Web services. RESTful systems typically, but not always, communicate over the Hypertext Transfer Protocol with the same HTTP verbs (GET, POST, PUT, DELETE, etc.) used by web browsers to retrieve web pages and send data to remote servers.[3] The REST architectural style was developed by W3C Technical Architecture Group (TAG) in parallel with HTTP 1.1, based on the existing design of HTTP 1.0.[4] The World Wide Web represents the largest implementation of a system conforming to the REST architectural style. Architectural properties[edit]

Stateful vs. Stateless Web Services Es ist schon ein paar Tage her, als ich Zeuge einer kleinen Debatte unter Entwicklern wurde. Es ging um die Entwicklung eines Web Services, welches eine große Menge an Daten beliefern sollte. Während des Brainstormings über Spezifikationen und Parameter wurde auch darüber diskutiert, ob der Web Service stateful - also mit einer Session - oder stateless konzipiert werden soll. Völlig parteilos - ich kenne beide Entwickler :-) - möchte ich diese zwei Design-Konzepte ein wenig aus meiner eigenen Betrachtungsweise durchleuchten. Zunächst sollte man sich meiner Meinung nach der Natur des Web Services im Klaren sein. Einen entfernten Aufruf - den berüchtigten "Remote Call" durchzuführen ist mit der Web Services-Technologie mittlerweile kinderleicht. Doch zurück zum Thema: Grundsätzlich wurden Web Services für den automatisierten (also maschinellen) Informationsaustausch geschaffen. So. Ergo: Web Services sind erst mal von Haus aus "stateless".

web services - Understanding REST: Verbs, error codes, and authentication 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]

Learn REST: A Tutorial Programming Stateful JAX-WS Web Services Using HTTP Session This chapter describes how you can develop JAX-WS Web Services that interact with an Oracle database. Overview of Stateful Web Services Normally, a JAX-WS Web Service is stateless: that is, none of the local variables and object values that you set in the Web Service object are saved from one invocation to the next. Even sequential requests from a single client are treated each as independent, stateless method invocations. There are Web Service use cases where a client may want to save data on the service during one invocation and then use that data during a subsequent invocation. For example, a shopping cart object may be added to by repeated calls to the addToCart web method and then fetched by the getCart web method. Enabling stateful support in a JAX-WS Web Service requires a minimal amount of coding on both the client and server. Accessing HTTP Session on the Server On the server, every Web Service invocation is tied to an HttpSession object. The steps required on the server:

RESTful API Design: Teach a Dog to REST | Apigee UPDATED November 2011: Check out the second edition of the webinar - RESTful API Design. It's been 10 years since Roy Fielding first defined REST in his dissertation on Architectural Styles and the Design of Network-based Software Architectures. Since then, REST is often held as the standard for usable, well-designed, easy-to-integrate APIs. At the Cloudstock hackathon, I presented "Teach a Dog to REST," asking the question: where are all the elegant REST APIs we'd all hoped to see? While many claim REST has arrived, many APIs in the wild exhibit arbitrary, productivity-killing deviations from true REST. Slides + Audio: Architectural Styles and the Design of Network-based Software ArchitecturesSo, where are all the elegant REST APIs?

Custom Search This document describes how to use the JSON/Atom Custom Search API. Making a request REST, or Representational State Transfer, in the JSON/Atom Custom Search API is somewhat different from traditional REST. Instead of providing access to resources, the API provides access to a service. You can retrieve results for a particular search by sending an HTTP GET request to its URI. Three query parameters are required with each search request: API key - Use the key query parameter to identify your application.Custom search engine ID - Use cx to specify the custom search engine you want to use to perform this search. All other query parameters are optional. Here is an example of a request which searches a test Custom Search Engine for lectures: GET Query parameters There are two types of parameters that you can pass in your request: All parameter values need to be URL encoded. API-specific query parameters

REST API Tutorial Stateful Web Services mit JAX-WS | techscouting through the java newstechscouting through the java news Ohne die Sinnhaftigkeit von zustandsbehafteten Web Services vorab diskutieren zu wollen sind hier 3 Möglichkeiten genannt solche mit Hilfe von JAX-WS bzw. dessen Referenzimplementierung umzusetzen. Variante 1: Direkter Zugriff auf die HTTP-Session über den WebServiceContext Bei einem Web Service, der auf HTTP und SOAP aufsetzt und in einem Servlet-Container läuft, war es natürlich schon immer möglich die HTPP-Session des Servlet-Containers als Zustandsspeicher zu verwenden. Zugriff auf besagte Session bekommt man über den WebServiceContext, welcher über die Annotation @Resource injected werden kann. Ein Beispiel zeigt das folgende Listing: Die Verwaltung der HTTP-Session auf der Serverseite übernimmt dann wie gewohnt der Servlet-Container. Mehr zu dieser Variante findet man in einem Blogartikel von Rama Pulavarthi. Variante 2: Per Annotation eine Instanz pro HTTP-Session Mehr dazu steht in einem Blogartikel von Kohsuke Kawaguchi. Variante 3: Protokollunabhängig über WS-Adressing Fazit

CSS Style Guides As we wrap up our recent poll on ordering CSS properties, it brings up the larger issue of CSS style guides. Ordering properties is just one choice you have to make that makes up a complete styling strategy. Naming is a part of it. Let's round up some existing ones. But first... I love pattern libraries. The List I'll list some excerpts from each that I like below. GitHub GitHub CSS Style Guide → As a rule of thumb, don't nest further than 3 levels deep. Unit-less line-height is preferred because it does not inherit a percentage value of its parent element, but instead is based on a multiplier of the font-size. Google Google HTML/CSS Style Guide → Use ID and class names that are as short as possible but as long as necessary. E.g. Do not concatenate words and abbreviations in selectors by any characters (including none at all) other than hyphens, in order to improve understanding and scannability. E.g. .demo-image not .demoimage or .demo_image Idiomatic CSS Nicolas Gallagher's Idiomatic CSS → More?

Related: