Skip to content
wurfkeks edited this page Aug 10, 2012 · 9 revisions

Table of Contents

General

There are some general responses of all calls:

  • Status Code 501: the appropriate app isn't installed on the device
  • Status Code 405: the method isn't supported
  • Status Code 401: authentication is enabled but the user isn't logged in

/

 * Method: GET
 * Redirects to /index.html
 * Status Code 301
 * "Location" header contains new url

/login

 * Method: POST
 * POST parameter: password - the SHA-256 hash of the password with the appended salt
 * sets a "session" cookie

/logout

 * Method: GET
 * invalidates the cookie and sets 
 * Status Code 200

Notepad

/notes/get

 Exaple: [{"title":"Test2","_id":2,"created":1339242756956,"note":"Test Note 2","modified":1339242756956},{"title":"Test1","_id":1,"created":1339242751357,"note":"Test Note 1","modified":1339242751357}]

/notes/get?id=

 Example: {"title":"Test1","_id":1,"created":1339242751357,"note":"Test Note 1","modified":1339242751357}

/notes/new

 * Method: POST
 * Form parameters:
   * title
   * note
   * tags (optional)
 * Creates and persists a new note
 * Status Code
   * 500: parameter parsing failed
   * 400: parameters are wrong, like missing parameter or empty value

/notes/delete

 * Method: GET
 * Deletes all notes 
 * Status Code 200

/notes/delete?id=

 * Method: GET
 * /notes/delete?id=1
 * Deletes the note with the given id
 * Status Code 200

/notes/update

 * Method: POST
 * Form parameters:
   * _id
   * title
   * note
   * tags (optional)
 * Creates and persists a new note
 * Status Code
   * 500: parameter parsing failed
   * 400: parameters are wrong, like missing parameter or empty value

Shoppinglist

/shoppinglist/list/get

 Example: [{"accessed":1342539277820,"_id":1,"created":1342539277820,"modified":1342539277820,"name":"My shopping list"},{"accessed":1342553022638,"_id":2,"created":1342553022638,"modified":1342553022638,"name":"Lidl"}]

/shoppinglist/list/get?id=

 Example: {"accessed":1342539277820,"_id":1,"created":1342539277820,"modified":1342539277820,"name":"My shopping list"}

/shoppinglist/list/delete

 * Method: GET
 * Deletes all lists
 * Status Code 200

/shoppinglist/list/delete?id=

 * Method: GET
 * /notes/delete?id=1
 * Deletes the list with the given id
 * Status Code 200

/shoppinglist/list/new?name=

 * Method: GET
 * /shoppinglist/list/new?name=Lidl
 * Creates and persists a new list
 * Status Code 400: name parameter is missing or empty

/shoppinglist/list/rename

 * Method: GET
 * /shoppinglist/list/rename?oldname=Lidl&newname=My%20Shoppinglist
 * /shoppinglist/list/rename?id=2&newname=My%20Shoppinglist
 * renames a list
 * Parameters:
   * newname: the new name of the list
   * oldname: the old name of the list
   * id: the of the list
 * note: oldname and id must not occure within the same call
 * Status Code 400: 
   * name parameters are missing or empty
   * oldname and id occure within the same call

/shoppinglist/item/get

 * Method: GET
 * /shoppinglist/item/get?id=3&list=2
 * /shoppinglist/item/get?id=3
 * /shoppinglist/item/get?list=2
 * returns all items which match the given parameters
 * Parameters:
   * id: specifies the item's id (optional)
   * list: specifies the list's id (optional)
 * List and item id may occure in any possible combination. If no item id is given the result will be a JSON Array containing JSON Objects which represent all found items. Otherwise a single item will be returned as JSON Object.

/shoppinglist/item/update

 * Method: POST
 * creates or updates an item respective an item-list-relationship.
 * POST-Parameters are: (see also documentation of class ShoppingContract in Shopping List Library)
   * item_name (string)
   * item_id (long)
   * item_tags (csv string)
   * item_price (double)
   * item_units (string)
   * list_id (long)
   * priority (long)
   * quantity (double)
   * status (long, [1..3])
 * If item_id is not present, a new item will be created or the old one will be retrieved from the database by name. Otherwise the id is used to identify the item and update its attributes.
 * Every present attribute will cause an update of the old one. If one should not change, leave it away or send it's old value.

/shoppinglist/item/delete

 * Method: GET
 * /shoppinglist/item/get?id=3&list=2
 * /shoppinglist/item/get?id=3
 * /shoppinglist/item/get?list=2
 * deletes all items which match the given parameters
 * Parameters:
   * id: specifies the item's id (optional)
   * list: specifies the list's id (optional)
 * List and item id may occure in any possible combination.