In the previous articles on the StreetCart project:
In this article, I will describe the APIs that we plan to implement. These are the APIs that app developers use to create the different StreetCart apps. To implement these APIs, we will create API proxies on Edge,and then group them into API products.
Before we identified the APIs, we first identified the client apps. We plan on building three client apps:
Each client app uses APIs from different API products. For example, the Admin app uses all of the available APIs, while the Member app does not use any of the Vendor or Admin APIs.
To group APIs by product, we defined four API products:
The following table lists the APIs that we plan for the first phase of the StreetCarts app. Notice that these APIs do not yet let the user purchase a food item. Those APIs are part of Phase 2.
For each API, the table lists:
API Path | Verb | Use | Input | Returns | P | M | V | A |
/users
query param: role |
GET | Get all users | Array of user IDs, first/last name, role | x | ||||
POST | Add new user | User info object, including username/pw | User info object and user ID | x | ||||
/users/{userID} | GET | Get user info | User ID | User info object | x | |||
PUT | Update user info | User info object | User info object | x | ||||
DEL | Delete user and all user info, such as reviews | User ID | x | |||||
/token | POST | Get OAuth token to access protected APIs | User email/pw | OAuth token, including user role | x | |||
/foodcarts
query param: cuisine, city |
GET | Get all carts | Array of cart IDs, short descriptions | x | ||||
POST | Add new cart | Cart info object | Cart info object with cart ID | x | ||||
/foodcarts/{cartID} | GET | Get cart info | Cart ID | Cart info object with menu IDs. | x | |||
PUT | Update cart info | Cart info object | Cart info object | x | ||||
DEL | Delete cart and all cart info, such as menus, menu items. | Cart ID | x | |||||
/foodcarts/{cartID}/menuItems | GET | Get all cart menu items | Cart ID | Array of all menu item IDs, names, and short descriptions | x | |||
/foodcarts/{cartID}/menus | GET | Get all menus for a cart | Cart ID | Array of menu IDs, names, short descriptions | x | |||
POST | Add empty menu | Cart ID, menu info object | Menu info object with menu ID | x | ||||
/menus
query param: menutype, cuisine |
Get |
Get all menus for all carts
menuType=breakfast, lunch, dinner, late night cuisine=Italian, Mexican, Indian, etc. |
Array of cart IDs, cart names, menu IDs, short menu descriptions | x | ||||
/menus/{menuID} | GET | Get menu items, menu info | Cart/Menu ID | Menu info object, Array of menu items | x | |||
PUT | Update menu info | Cart ID, menu info object | Menu info object | x | ||||
DEL | Del menu | x | ||||||
/menus/{menuID}/menuItems | GET | Get menu items | Cart/menu ID | Array of all menu item IDs, names, and short descriptions | x | |||
menus/{menuID}/menuItems/{itemID} | POST | Add menu item to menu | Cart/Menu/Item ID | Menu object | x | |||
DEL | Del menu item from menu | Cart/Menu/Item ID | x | |||||
/menuItems
query param: cuisine, truck ID |
GET |
Get all menu items
cuisine=Italian, Mexican, Indian, etc. |
Array of all menu item IDs, cart IDs, item names, short descriptions | x | ||||
POST | Create new menu item | Object describing menu item, including cartID | Menu item info object with item ID | x | ||||
/menuItems/{itemID} | GET | Get menu item | Menu item ID | Menu item info object | x | |||
PUT | Update menu item | Menu item ID, item info | Menu item info object | x | ||||
DEL | Delete menu item, and delete it from all menus | Menu item ID | x | |||||
/reviews
query param: cartID, userID |
GET | Get all reviews for all carts | Array of review IDs, cart IDs, cart name, review object | x | ||||
/reviews/{reviewID} | Get | Get a specific review | x | |||||
/reviews/users/{userID} | GET | Get all reviews for a user | Cart ID | Array of review IDs, review object | x | |||
POST | Add a review | Cart ID, user ID, review object | Review object with ID | x | ||||
PUT | Update review | Cart ID, user ID, review object | Review object | x | ||||
DEL | Delete review | Review ID | x |