[Gllug] REST example

SteveC steve at asklater.com
Sat Nov 12 19:18:41 UTC 2005


* @ 12/11/05 05:55:20 PM stan at saticed.me.uk wrote:
> Can anyone think of an example for the REST compatible way to deal with
> an increasing or decreasing count.  i.e. continuing the example from [1]
> if I want to decrease the quantity value from the return of
> http://www.parts-depot.com/parts/00345 - how is that achieved since it
> changes the server state?  I thought the client could PUT a copy of the
> data received previously with a lower quantity, but didn't think that
> would be very robust with multiple clients.

Huh? I'm not quite sure what you're asking but that URL,
http://www.parts-depot.com/parts/00345, is giving the current state of
some backend database.

The client might HTTP PUT some xml to something like /order which
includes 1 or more '345' parts. Then, the number of parts available will
drop. Alternatively the PUT might fail with some HTTP error code if the
parts are no longer available.

If you mean you want it to decrease because you're writing the admin app
then that's different. Yes, PUT some similar xml with a smaller Quantity
to that 00345 URL to update it's state if you want to be really
RESTful... but you probably don't want to do that: You want to have some
admin app that just talks to the database and the REST interface is an
API for people outside of your control.

> What about a url to return a unique (increasing) number each time it is
> accessed - could that be RESTful?

I'm not sure what you mean by 'accessed'

> [1] http://www.xfront.com/REST-Web-Services.html
> 
> TIA
> 
> -- 
> Gllug mailing list  -  Gllug at gllug.org.uk
> http://lists.gllug.org.uk/mailman/listinfo/gllug

have fun,

SteveC steve at asklater.com http://www.asklater.com/steve/
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list