From 74b087fe6a467c94649253515aba80be6b4a9c2a Mon Sep 17 00:00:00 2001 From: Jocelyn Delalande Date: Thu, 18 Aug 2016 18:06:12 +0200 Subject: [PATCH 1/2] Mentions in API doc that the date is optional. --- docs/api.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api.rst b/docs/api.rst index ce5df71..56a4773 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -135,7 +135,7 @@ You can get the list of bills by doing a `GET` on `/api/projects//bills` :: Add a bill with a `POST` query on `/api/projects//bills`. you need the following params: -* `date`: the date of the bill. (yy-mm-dd) +* `date`: the date of the bill; defaults to current date if not provided. (yy-mm-dd) * `what`: what have been payed * `payer`: by who ? (id) * `payed_for`: list of ids From 338f735d46f1f58a049e6c9c85e7aa0d47aece7a Mon Sep 17 00:00:00 2001 From: Jocelyn Delalande Date: Thu, 18 Aug 2016 18:06:37 +0200 Subject: [PATCH 2/2] Explain better multi-valued `payed_for` in API doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … And use a multi-valued example, as it's IMHO the "standard" use-case with IHM. --- docs/api.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 56a4773..0f8d784 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -138,14 +138,14 @@ following params: * `date`: the date of the bill; defaults to current date if not provided. (yy-mm-dd) * `what`: what have been payed * `payer`: by who ? (id) -* `payed_for`: list of ids +* `payed_for`: for who ? (id, repeat the parameter to set multiple id) * `amount`: amount payed Returns the id of the created bill :: $ curl --basic -u demo:demo -X POST\ http://ihatemoney.notmyidea.org/api/projects/demo/bills\ - -d "date=2011-09-10&what=raclette&payer=31&payed_for=31&amount=200" + -d "date=2011-09-10&what=raclette&payer=31&payed_for=31&payed_for=35&amount=200" 80 You can also `PUT` a new version of the bill at @@ -153,7 +153,7 @@ You can also `PUT` a new version of the bill at $ curl --basic -u demo:demo -X PUT\ http://ihatemoney.notmyidea.org/api/projects/demo/bills/80\ - -d "date=2011-09-10&what=raclette&payer=31&payed_for=31&amount=250" + -d "date=2011-09-10&what=raclette&payer=31&payed_for=31&payed_for=35&amount=250" 80 And you can of course `DELETE` them at `/api/projects//bills/`::