Re: [CODE4LIB] good web service api

2007-06-30 Thread Eric Hellman

Eric,

I'll address only the xml design for  your first link, and I'll ask
questions, not because I want to know the answer, but because the
answers determine whether your xml response is good.

is this response supposed to work only for mylibrary?
does version refer to mylibrary or to the response format?
why is there an error element if there's not been an error?
why is there a message element if there's no message?
why is code PCDATA rather than  a CDATA attribute?
are the facets always ordered?
is there a difference between a facet_name and a name?
is the name and note attached to the facet or contained by the facet?
why do facets have ids?
is id an ID?

I also find that it helps to try to read things like this aloud in English.

MyLibrary, could I get all the facets you have?

Hello, I'm MyLibrary version 0.001.
I would like to report an error with code zero and no message.
As for my facets, a facet, which I id as 2, is named as a facet
Formats, and I should note as a facet it is The physical
manifestation of information, and that's what I have to say about
this facet.
Another facet, which I id as 3, is named as a facet People, and I
should note as a facet it is Human beings both real and fictional,
and that's what I have to say about this facet.
etc...
And those are all the facets.
Goodbye!


At 2:15 PM -0400 6/29/07, Eric Lease Morgan wrote:

What are the characteristics of a good Web Service API?

We here at Notre Dame finished writing the MyLibrary Perl API a long
time ago. It does what is was designed to do, and we believe others
could be benefit from our experience. At the same time, the API is
based on Perl and we realize not everybody likes (or knows) Perl.
Some would say, Why didn't you write in X? where X is their
favorite programming language. Well, that is just not practical.

I believe the solution to the dilemma is a Web Service API against
MyLibrary similar to the Web Services API provided by Fedora. Any
scripts sends name/value pairs on a URL and gets back XML. This way
any language can be used against MyLibrary (which we now calling a
digital library framework  toolbox).

Here are the only two working examples I have:

  http://dewey.library.nd.edu/mylibrary/ws/?obj=facetcmd=getAll
  http://dewey.library.nd.edu/mylibrary/ws/?obj=facetcmd=getOneid=2

Try a few of errors:

  http://dewey.library.nd.edu/mylibrary/ws/?obj=facetcmd=getNone
  http://dewey.library.nd.edu/mylibrary/ws/?obj=facetcmd=getOneid=45
  http://dewey.library.nd.edu/mylibrary/ws/?obj=facetcmd=getOneid=x

I can create all sorts of commands like:

  * get all facets
  * get all terms
  * get all librarians
  * get all resources
  * get all resources classified with this term
  * create facet, term, librarian, or resource
  * edit facet, term, etc.
  * delete facet, term, etc.

Given such an interface library (MyLibrary) content can be used in
all sort of venues much more easily.

While I don't expect anybody here to know what commands to support,
I am more interested in the how. What are the characteristics of
good name/value pairs? Should they be terse or verbose? To what
extent should the name/value pairs require a version number or a
stylesheet parameter? Besides being encoded in XML, what should the
output look like? What are characteristics of good XML in this
regard? Heck, then there is authorization? How do I disable people
from deleting resources and such.

This might be just an academic exercise, but with the advent of more
and more Web Services computing I thought I might give a MyLibrary
Web Services API a whirl.

--
Eric Lease Morgan
University Libraries of Notre Dame

code4lib_fridays++



--

Eric Hellman, DirectorOCLC Openly
Informatics Division
[EMAIL PROTECTED]  [EMAIL PROTECTED]   2 Broad St., Suite 
208
tel 1-973-509-7800 fax 1-734-468-6216 Bloomfield, NJ 07003
http://openly.oclc.org/1cate/  1 Click Access To Everything


Re: [CODE4LIB] good web service api

2007-06-30 Thread Alexander Johannesen

On 6/30/07, Eric Lease Morgan [EMAIL PROTECTED] wrote:

What are the characteristics of a good Web Service API?


That you refrain from the notion of an API. :)

Seriously, before you do anything, read the book Restful WebServices
by Sam Ruby and Leonard Richardson
(http://www.oreilly.com/catalog/9780596529260/). I'd do it the ROA way
(and have for some time; resource oriented architecture), but I do
understand it puts certain strain on the areas of the brain
responsible for learning conceptually new things.


Alex
--
---
Project Wrangler, SOA, Information Alchymist, UX, RESTafarian, Topic Maps
-- http://shelter.nu/blog/ 


[CODE4LIB] Richardson and Ruby's *Restful Web Services* (was Re: [CODE4LIB] good web service api)

2007-06-30 Thread Raymond Yee

I have to agree with Alex -- Ruby and Richardson's book *Restful Web
Services* (RWS for short)  is well-worth reading if you are setting out
to create a good web service API.   I'm working through the book
myself right now and would love to discuss the book here if there is any
interest.

For example, to the point that we should refrain from the notion of an
API.  I'm trying to understand how far we can really fold the human user
interface and the machine machine interface into one -- instead of
having the UI and the API as fairly distinct things.  I've not had a
chance to actually try for myself the extended examples given in the
book of a social bookmarking system.  Does the example provide for both
the human and machine interfaces all in one?

-Raymond

Alexander Johannesen wrote:

On 6/30/07, Eric Lease Morgan [EMAIL PROTECTED] wrote:

What are the characteristics of a good Web Service API?


That you refrain from the notion of an API. :)

Seriously, before you do anything, read the book Restful WebServices
by Sam Ruby and Leonard Richardson
(http://www.oreilly.com/catalog/9780596529260/). I'd do it the ROA way
(and have for some time; resource oriented architecture), but I do
understand it puts certain strain on the areas of the brain
responsible for learning conceptually new things.


Alex
--
---

Project Wrangler, SOA, Information Alchymist, UX, RESTafarian, Topic Maps
-- http://shelter.nu/blog/




--
--
Raymond Yee, Ph.D.  102 South Hall
Visiting ScholarUC Berkeley
School of Information   Berkeley, CA 94720-4600
[EMAIL PROTECTED][EMAIL PROTECTED]
http://blog.dataunbound.com http://blog.mashupguide.net