Sunday is my favorite day of most weeks.
Whether you are religious or not (I am), taking a 'day of rest' once a week will do wonders for life. For me personally, I need that day to wind down and rest; physically, mentally, and emotionally. It is refreshing to be able to put aside the worries and stresses of daily life, and focus on #whatmatters.Despite a sore back, I was able to enjoy the day with family. I did some writing, my #gtd weekly review, got creamed in fantasy football, and had family over for cake and ice cream to celebrate the November birthdays.
I am not a huge proponent of sports on Sundays, but today brought something particularly exciting for any Utah sports fan. Real Salt Lake brought home the first league championship for a professional sports team in Utah. The game came down to a shootout in overtime. I only got to watch the final minutes, but it was definitely a historic moment.
Some say that Sunday is the first day of the week, others consider it the last. I know what the calendar says, and I tend to agree with it. I feel like Sunday is a great way to start the week, as opposed to close out what's already been done. It's a day to look ahead and be ready for the upcoming week. I hope you have a great one. day 4, have a good one. I'm about to round out week one of the #30day project. Have you been noticing any small details that make you smile? Are you paying attention to the daily occurrences that make life great? Start noticing by writing it down. Posterous is a great tool, as is a journal. T ake a #30day project, and be happy.The PO service responds to the HTTP POST with a URL to the submitted PO. Thus, the client can retrieve the PO any time thereafter (to update/edit it). The PO has become a piece of information which is shared between the client and the server. The shared information (PO) is given an address (URL) by the server and is exposed as a Web service.I will first provide a brief introduction to REST and then describe how to build Web services in the REST style.
What is REST?
REST is a term coined by Roy Fielding in his Ph.D. dissertation [1] to describe an architecture style of networked systems. REST is an acronym standing for Representational State Transfer.Why is it called Representational State Transfer?
The Web is comprised of resources. A resource is any item of interest. For example, the Boeing Aircraft Corp may define a 747 resource. Clients may access that resource with this URL: A representation of the resource is returned (e.g., Boeing747.html). The representation places the client application in a state. The result of the client traversing a hyperlink in Boeing747.html is another resource is accessed. The new representation places the client application into yet another state. Thus, the client application changes (transfers) state with each resource representation --> Representational State Transfer! Here is Roy Fielding's explanation of the meaning of Representational State Transfer: "Representational State Transfer is intended to evoke an image of how a well-designed Web application behaves: a network of web pages (a virtual state-machine), where the user progresses through an application by selecting links (state transitions), resulting in the next page (representing the next state of the application) being transferred to the user and rendered for their use."Motivation for REST
The motivation for REST was to capture the characteristics of the Web which made the Web successful. Subsequently these characteristics are being used to guide the evolution of the Web.REST - An Architectural Style, Not a Standard
REST is not a standard. You will not see the W3C putting out a REST specification. You will not see IBM or Microsoft or Sun selling a REST developer's toolkit. Why? Because REST is just an architectural style. You can't bottle up that style. You can only understand it, and design your Web services in that style. (Analogous to the client-server architectural style. There is no client-server standard.) While REST is not a standard, it does use standards:
- HTTP
- URL
- XML/HTML/GIF/JPEG/etc (Resource Representations)
- text/xml, text/html, image/gif, image/jpeg, etc (MIME Types)
The Classic REST System
The Web is a REST system! Many of those Web services that you have been using these many years - book-ordering services, search services, online dictionary services, etc - are REST-based Web services. Alas, you have been using REST, building REST services and you didn't even know it. REST is concerned with the "big picture" of the Web. It does not deal with implementation details (e.g., using Java servlets or CGI to implement a Web service). So let's look at an example of creating a Web service from the REST "big picture" perspective.Parts Depot Web Services
Parts Depot, Inc (fictitious company) has deployed some web services to enable its customers to:Let's consider how each of these services are implemented in a RESTful fashion.
- get a list of parts
- get detailed information about a particular part
- submit a Purchase Order (PO)
Get Parts List
The web service makes available a URL to a parts list resource. For example, a client would use this URL to get the parts list: Note that "how" the web service generates the parts list is completely transparent to the client. All the client knows is that if he/she submits the above URL then a document containing the list of parts is returned. Since the implementation is transparent to clients, Parts Depot is free to modify the underlying implementation of this resource without impacting clients. This is loose coupling.Here's the document that the client receives:
[Assume that through content negotiation the service determined that the client wants the representation as XML (for machine-to-machine processing).] Note that the parts list has links to get detailed info about each part. This is a key feature of REST. The client transfers from one state to the next by examining and choosing from among the alternative URLs in the response document.Get Detailed Part Data
The web service makes available a URL to each part resource. Example, here's how a client requests part 00345: Here's the document that the client receives: Again observe how this data is linked to still more data - the specification for this part may be found by traversing the hyperlink. Each response document allows the client to drill down to get more detailed information.Submit PO
The web service makes available a URL to submit a PO. The client creates a PO instance document which conforms to the PO schema that Parts Depot has designed (and publicized in a WSDL document). The client submits PO.xml as the payload of an HTTP POST.
2. Create a URL to each resource. The resources should be nouns, not verbs. For example, do not use this:
Note the verb, getPart. Instead, use a noun:3. Categorize your resources according to whether clients can just receive a representation of the resource, or whether clients can modify (add to) the resource. For the former, make those resources accessible using an HTTP GET. For the later, make those resources accessible using HTTP POST, PUT, and/or DELETE. 4. All resources accessible via HTTP GET should be side-effect free. That is, the resource should just return a representation of the resource. Invoking the resource should not result in modifying the resource. 5. No man/woman is an island. Likewise, no representation should be an island. In other words, put hyperlinks within resource representations to enable clients to drill down for more information, and/or to obtain related information. 6. Design to reveal data gradually. Don't reveal everything in a single response document. Provide hyperlinks to obtain more details. 7. Specify the format of response data using a schema (DTD, W3C Schema, RelaxNG, or Schematron). For those services that require a POST or PUT to it, also provide a schema to specify the format of the response. 8. Describe how your services are to be invoked using either a WSDL document, or simply an HTML document.
Gus is in his box. Oz is on the fairly new ottoman with the
brand-spanking new round pillow Jenny made!
Presenter: Scott Davis
Author:
RESTful Web Services in Grails
Well the first attempt at getting 8 1/2 hours of sleep didn't work out so well. I went to bed an 1/2 hour late for starters and tossed around a long while and then I woke up an hour earlier than was necessary.
Oddly enough I do think that I rested.Google half-way cancelled their SOAP API a while ago, but they now* offer a parametrized URL that returns a JSON data set. Google says this REST approach is useful for "Flash developers, and those developers that have a need to access the AJAX Search API from other Non-Javascript environments." This may be even simpler to use than the SOAP API, though I wonder how long (and how well) it's going to be working. Here's an example query:
I used the Google Search SOAP API on several site some time ago and because the API doesn't work for all the time I moved to the Yahoo Search API. Actually I don't like the Yahoo results (the quality of results might be the reason that many people doesn't use Yahoo to search the net). The REST search API from Google is a good alternative, even if you need to re-write your whole application. Your can search in different Google search product and you have plenty parameter to filter your result:
http://code.google.com/apis/ajaxsearch/documentation/reference.html#_intro_fonje