Skip to content
Joel Edström edited this page Oct 1, 2015 · 5 revisions

Info

Preliminary API docs for the JSON based REST API.

Index

Menu System

Order System (Not fully implemented yet)

Menu System

Item Resource

/api/item                     GET      Get all items.
/api/item?excludeMenuId=X     GET      Get all items not on the menu with id = X
/api/item                     POST     Create a new item from POST JSON formatted data. See (1)
/api/item/X                   GET      Get item with id = X
/api/item/X                   DELETE   Delete item with id = X
/api/item/X                   PUT      Update item with id = X (NOT IMPLEMENTED)

(1) Format of JSON POST request for creating a new item:

{
    "name": "Kaka",
    "description": "god",
    "price": 15
}

Menu Resource

/api/menu                     GET      Get all menus.
/api/menu/X                   GET      Get menu with id = X
/api/menu/X                   *        NOT IMPLEMENTED

Menu / Item Resource

/api/menu/X/item              GET      Gets all items on this menu (id = X).
/api/menu/X/item              POST     Adds an item as a menu item. See (2)
/api/menu/X/item/Y            DELETE   Removes menu item (id = Y) from this menu.

(2) Format of JSON POST request for adding a item from the Item Resource to a Menu

{
    "item_id": 3
}

Order System

Order Resource

/api/order					GET 	Get all orders   (TODO: add filter based on status)
/api/order/<id>				GET		Get order
/api/order				    POST	Create new order. See (3)

(3) Format of JSON POST request for adding an order. Notice that all data should be collected on the client before POSTing it all as one request. Fetching an order using GET gives similar output.

{
    "groups": 
	[
        {
            "status": "ready",
            "items": 
			[
                {
                    "id": 3
                },
                {
                    "id": 1,
                    "note": { "text": "extra allt" }
                }    
            ]
        },
        {
            "status": "initial",
            "items": 
			[
                {
                    "id": 2,
                    "note": { "text": "medium rare" }
                },
                {
                    "id": 4
                }    
            ]
        }
    ]
}

==== Nothing below this line works yet

Order / Group Resource

/api/order/<id>/group/<id>			PUT		Change group status (initial, ready, done)

###Order / Group / Item Resource

/api/order/<id>/group/<id>/item			POST	Add new item
/api/order/<id>/group/<id>/item/<id>	DELETE 	Remove item
/api/order/<id>/group/<id>/item/<id>	PUT		Change item or add/change note

Clone this wiki locally