[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Web services revisited



On Tue, May 22, 2012 at 12:27 PM, John Locke <..hidden..> wrote:
> Hi, Chris,
>
> One forgotten method, on the object controllers, realized on IRC:
>
> ... We need an INDEX handler.
>
> GET would presumably get an individual resource, using an internal id
> guaranteed to be unique. Index would return a collection of resources,
> and would accept a variety of search parameters, presumably sent via GET
> parameters.

hmmmm  This would seem to make most sense if we break off subresources
into subclasses.

Also question:

should it be possible to PUT or POST a collection?  For example, an ar
batch?  If so how do we want to handle that?

It would be nice to be able to handle that because we could define
format handlers for things like CSV or Excel and then have apps that
upload spreadsheets......

>
> The Index handler should get called when a request comes in via GET,
> with no unique identifier in the URL.
>
> This would also apply to resourcetype sub-handlers...

Yeah.  One problem right now that I have spotted with the current
draft is that it is a fixed-length namespace.  I would like to figure
out how we want to do this.  My thinking is that we should treat
subresources proper as only possible where an id has been identified
above.  But this precludes a general request like:

ledgersmb/rest/1.4/mycompany/customer/aging.xml

One option would be to use the "all" keyword to mean that an id is not
supplied.  So that would become:

ledgersmb/rest/1.4/mycompany/customer/all/aging.xml

If we go that route, I don't see why we can't extend subclass handlers
etc as far as needed.

>
> e.g. possible GET handler:
> GET /rest/1.0/my_company/ar_transactions/43353
>
> Possible Index handler:
> GET /rest/1.0/my_company/ar_transactions/?invoice_id=N499216

Now, if only one invoice is found with that number (which it should)
would that return a document representing that single invoice or a
collection of one?  If none are found do we issue a 404 or a 200
accompanied by an empty collection document?

> GET
> /rest/1.0/my_company/ar_transactions/?status=open,closed&customer=customer1

This would be more obviously a collection of an arbitrary number.
Presumably 0 is a valid number of elements in a collection, I would
think.

Best Wishes,
Chris Travers