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

Re: Proposal: Web Services API

On 25/10/2011 21:38, John Locke wrote:
What I'd like to see is basically an API that has a specific URI for
each resource. For example, an invoice #456 might be referenced at:


A simple GET on that address would check for authorized access, and then
retrieve the invoice in a form requested by the client. I generally set
up services to accept a content-type header to specify xml, json, html,
csv, etc -- and allow it to be overridden by a parameter in the query

A PUT on that address with an updated object in the body would update
the object, again based on authorization. (I'm thinking to add payment
to an invoice).

A DELETE on that address would delete (almost certainly dis-allowed on
this type of object).

POST is used to create new objects, or do particular data-changing
actions on an object or in the system.

GET would also accept a variety of parameters, providing a built-in
search to get a collection of objects --

GET http://myledgeraddress.com/store/invoice/?eca_id=334&open=any

For implementation, this should be pretty easy to provide some sort of
request handler and load up the new objects that Chris has created, do
the appropriate changes, and save. The old code is obviously much harder.

Perhaps we can start with the new entities, customers and vendors that
have already been done, and add more of the accounting objects as they
get rewritten?

This would be incredibly useful for me. I have a LedgerSMB - Oscommerce conduit that I use to transfer orders, inventory etc between our website and LedgerSMB. Such a RESTful API would be an excellent way to regularise this