Showing posts with label Google. Show all posts
Showing posts with label Google. Show all posts

Friday, June 13, 2008

Command line Google searches with goosh

Goosh (short for Google Shell) is a web page that acts like a command-line interface for Google running in your browser window. It's the Google equivalent of the DOS prompt or Unix shell.

At first I just thought it was cute, which it is. But now I've found myself doing most of my searches from it. So let's take it for a spin.

Here's the empty goosh command line.


Now type a search term and hit Enter. The first 4 results display.


Type the number of the result to open that link in a new tab. Type m (for more) to see more results. Type c (for clear) to clear the results. Pressing the up arrow will cycle through previous commands that you typed, just like you can in a shell window. Nice.

There's a cleverness in the way Google's different search capabilities are partitioned in goosh. Type "cd images" and you switch to the images directory.


From the images directory, type your search term, and the image results display.


Or type "video chicago" and you'll search YouTube for Chicago videos.

Now, the kids on Slashdot don't seem to care for it because, well, you can't run unix commands in goosh, which utterly misses the point.


Finally, a geeky in-joke I just can't resist.

Friday, February 8, 2008

Designing a RESTful API

There's a bit of art that goes into designing any API. We've designed and refined a SOAP API over the last couple of years, and the RPC-like nature of SOAP does seem to make things fairly simple from an API designer's perspective. Everything looks more or less like methods you would see in C#, only exposed through a service.

Designing a RESTful API, on the other hand, is a process I am finding to be a much bigger mental leap.

The REST model is best suited for problems where you're dealing with assets - that is, things that you act upon. But I couldn't find any good examples that were truly RESTful and also handled complex asset scenarios.

What is truly RESTful? Well, to be truly RESTful you use all 4 HTTP verbs (GET, PUT, POST, DELETE). You don't add action verbs as params (?name=smith&action=delete). I could be flip and say it's not RESTful because it's cheating, but it's not about a dogma. The design criteria was to make the API as simple as possible, and having to know about special action= parameters requires additional knowledge on the part of the consumer. For us, the consumer should be able to have no prior knowledge of the API, just of the resources they want to access, and still be able to accomplish useful work.

The complex asset scenario is trickier, I think. Most of the RESTful APIs out there deal with rather flat and simple resource structures. Amazon's S3 resource structure never gets more complex than GET /[bucket-name]/[key-name], and Google's search API is also flat but decorated with lots of filters: GET /search?q=bill+material&output=xml&client=test&site=operations

Don't get me wrong - simple is good! It's just that these aren't great models to learn from for a more complex set of assets. For example, say I have a taxonomy of categories with n numbers of subcategories. Each category can contain n number of items. Items can also contain subitems. Categories and items can each have a set of properties, and furthermore each category and item can be one of a certain set of types, which means they can have different property sets. And the same items can appear in more than 1 category. In some cases I only want to retrieve a subset of all available properties for n items or categories.

Category A (categoryType=F1)
.|- Category AA (categoryType=G4)
....|-Item 27 (itemType=9H)
....|-Item 492 (itemType=4Y)
.|- Item 1 (itemType=9H)
Category B (categoryType=F1)
Category C (categoryType=F1)
.|-Category CC (categoryType=H8)
.|-Category CD (categoryType=H8)
...|-Item 1 (itemType=9H)
.....|-Item 303 (itemType=7T)
.....|-Item 305 (itemType=7T)
.....|-Item 306 (itemType=7T)
.|-Item 27 (itemType=9H)

This is, in a nutshell, the set of resources I need to be able to expose through the API.

For something with this level of complexity, where thinking in terms of sets becomes more natural, I found Microsoft's Astoria project (officially: ADO.NET Data Services) to be very helpful. Especially the concept of filtering resources.

Take the following example: GET /Customers[ALFKI]/Orders[1]/Employees, which filters the assets based on the data in the brackets, in this case returning those employees who created Order ID=1 for customer ID=ALFKI. The beauty of this approach is that it's easy to extend the filters in the brackets. So I could do GET /Customers[ALFKI]/Orders[1,2,9]/Employees or even /Customers[ALFKI,PDX,MSTR]/Orders[1-1000]/Employees.


The RESTful API we're working on isn't done yet - we're just starting to create a mock service that spits out static XML so we can get a feel for how the various consumers will actually use the API. This will let us play with the details of the API and the XML format before we commit to building all the data plumbing underneath it.

Here are some RESTful resources I found helpful:
  • Using ADO.NET Data Services - some great thinking from Microsoft on building a RESTful API for selecting complex data sets
  • Why REST Failed - the title is overstated, but Elliotte Rusty Harold (no relation to me) does a great job explaining the current challenges with PUT and DELETE support in modern browsers. Good for understanding what you're getting into.
  • Why PUT and DELETE? - an interview with Elliotte Rusty Harold that does a nice job of explaining why you want to go to the effort of supporting all 4 HTTP verbs despite the limited browser support. In a word - elegance.


Tuesday, December 4, 2007

Where is the Microsoft cloud?

I've been doing heavy research lately into scalable distributed systems, and Amazon's S3 and EC2 are front and center in my brain as I'm working my way through the literature.

Amazon's AWS and now IBM's BlueCloud are out in front with cloud computing offerings. Google may or may not be planning something akin to S3 with Google shared storage combined with APIs.


In the midst of my research, I saw that Microsoft has a codename - Oslo - for their next iteration of SOA tools. And so the obvious question (to me, at least) is: where is Microsoft's cloud computing offering?

Well, looks like BizTalk Services may be Microsoft's response. Charles Young has an overview of his early experiences with it.

Looks like I have more research to do...