rest/description

From Microformats Wiki
Revision as of 19:40, 4 November 2005 by DrErnie (talk | contribs) (→‎Implementations (Twill): form example)
Jump to navigation Jump to search

REST Service Description Conventions (RSDC)

The general consensus (as articulated by Roy and Mark, though disputed by others) is that REST does not need a WSDL-style description language. After all, we use the web without requiring directions, right?

At the same time, there is still confusion about what actually works, and how.

Brainstorming

In at least the Microformats case ("REX") where you're assuming a browser, we can presumably get by with the following constraints (in addition to REST itself, of course; e.g., properly-formed URIs):

  • information is provided via HTML
  • inputs are always key-value pairs of strings (except for file uploads)
  • only hyperlinks that share the same root are part of the REST service
  • there must be a way to discover all valid queries starting from the first link
  • forms MUST specify correct actions (e.g., PUT, DELETE), even if the actual implementation uses JavaScript

Implementations (Twill)

twill is a web app testing language by Titus Brown that functions like a smart REST client!

"Twill is especially good at retrieving and submitting web forms. The form-related feature uses the [following] commands:"

showforms
shows the forms contained in a web page. Unnamed forms get an ordinal number to use as a form ID
formvalue <form_id> <name> <value>
fills a field of the specified form with a given value
submit <button_id>
lets you press a Submit button, thus submitting the form
formclear <form_id>
resets all the fields in a form

In particular, Twill information in the following format:

>> showforms
Form #1
## __Name______ __Type___ __ID________ __Value__________________
     name         text      (None)
     password     password  (None)
     confirm      checkbox  (None)       [] of ['yes']
     colour       radio     (None)       [] of ['green', 'blue', 'brown', 'ot ...
     size         select    (None)       ['Medium (10")'] of ['Tiny (4")', 'S ...
     toppings     select    (None)       ['cheese'] of ['cheese', 'pepperoni' ...
     time         hidden    (None)       1118768019.17
     1               submit    (None)       Submit


Those comment were extracted from ONLamp's web testing article, which also discusses:

Python Browser Poseur (PBP)
by Cory Dodt (came first)
Beautiful Soup
a third-party HTML parsing tool
Quixote
a nice, small Pythonic web framework
John J. Lee's websearch tools
mechanize (inspired by Perl), ClientForm, and ClientCookie
pyparsing
object-oriented text processing
Selenium
JavaScript framework for browser/Plone testing
Agile Testing blog
by Grig Gheorghiu.