RESTful Searches For TV Detectives

It is a dark and stormy night. A woman draws cash from an ATM. A man steps out of the shadows, brandishing a knife. "Give me your money," he snarls.

Meanwhile, back at the station, Detectives Fraser and Caccatiura are filling in paperwork. The phone rings.

"ATM mugging," explains Fraser to Caccatiura. "Anna, pull up the CCTV footage by the bank."

"Got it. Looks like we have a match," she says seconds later, as the apparently Flash-based face-recognition software stops cycling through the police database and settles on a face. "Rick Richards, 245 Ocean Drive."

Meanwhile, back at 245 Ocean Drive, Richards stashes the knife under a gnome in the garden.

Meanwhile, back at Judge Silversmith's large and expensive home, Detective Fraser petitions the judge for a warrant. "You've got your warrant, Detective," says Silversmith, "but it only covers the house."

Meanwhile, back at 245 Ocean Drive, Fraser executes the warrant on Richards. "Find me the knife," growls Fraser to his minions who never seem to say much.

Meanwhile, back at the station, Caccatiura shakes down a contact. "Look in the garden," he advises.

Fraser returns. "Nothing," he elaborates.

Caccatiura says, "Hey, we got a break."

Meanwhile, back at the judge's large and expensive home, Caccatiura asks to modify the warrant. "Ok Detective, you got probable cause. But don't bother me again."

Meanwhile, back at 245 Ocean Drive, Fraser blows the front door off and stomps through to the garden. "Hey, you can't go there," whines Richards.

"Tell it to the judge," rasps the detective. "How do you explain this?" he continues, pointing to a big, shiny knife concealed poorly under a garden gnome.

"Never seen it before in my life," protests Richards defiantly. "Why don't you ask the gnome?"

"Wise guy, eh? You're nicked, sunshine."

Meanwhile, back at the station, Fraser hangs out with Caccatiura. "So, Anna, how did you get the new warrant so fast?"

"I'll put in terms a TV detective will understand. Judge Silversmith controls our searches. Each warrant represents a search we can do. First you applied for (POSTed) a new warrant; then you executed it (GET) and brought the results of the search back to the station. Our suspect was clever, though, and hid the weapon under a gnome where our first warrant couldn't find it. So I asked the judge for a Warrant Modification Form, filled it in and PUT it to him to sign. He said OK and told me where I could find the updated warrant on file. You executed it again and this time we hit paydirt when we got the results back. Hmm, thinking about it, I should really ask the judge to DELETE that warrant from last week to search your locker for embarrassing photographs."

Meanwhile, Richards is lead past in handcuffs. "You guys!" he shouts.

Andy Stewart, 23 February 2007

Posted in Rails, REST


Have your say

You can use Markdown in your comments. If you want to post code, do this:

<pre><code class="ruby|javascript|css|html">your code here</code></pre>

Thanks!