|
| 1 | +# Potluck Planner API |
| 2 | + |
| 3 | +Hosted Backend URL: |
| 4 | + |
| 5 | +Endpoints with an (auth) require an authorization token like so: |
| 6 | + |
| 7 | +Headers: |
| 8 | +| Key | Value | |
| 9 | +| :-- | :-- | |
| 10 | +| Authorization | <AUTH_TOKEN> | |
| 11 | + |
| 12 | +## Authentication |
| 13 | + |
| 14 | +| Method | Endpoint | Requirements | | |
| 15 | +| ------ | -------------- | ------------------------ | -------------------------------- | |
| 16 | +| POST | /auth/register | name, username, password | Creates a new user object | |
| 17 | +| POST | /auth/login | username, password | Logs in users who already exists | |
| 18 | + |
| 19 | +## Users |
| 20 | + |
| 21 | +| Method | Endpoint | Requirements | | |
| 22 | +| ------ | -------------- | --------------------------------------- | ------------------------- | |
| 23 | +| GET | /api/users | | Returns all users | |
| 24 | +| GET | /api/users/:id | | Returns user object by id | |
| 25 | +| PUT | /api/users/:id | either name, username, password, or all | Updates the user by id | |
| 26 | +| DELETE | /api/users/:id | | Deletes the user by id | |
| 27 | + |
| 28 | +## Events |
| 29 | + |
| 30 | +| Method | Endpoint | Requirements | | |
| 31 | +| ------ | ---------------------- | ------------------------------------------------------- | --------------------------------------------------------------- | |
| 32 | +| GET | /api/events | | Returns all events | |
| 33 | +| GET | /api/events/users/:id | | Returns all events related to user id, returns data of event id | |
| 34 | +| GET | /api/events/:id | | Returns event by id | |
| 35 | +| GET | /api/events/:id/food | | Gets food for event id | |
| 36 | +| GET | /api/events/:id/guests | | Gets all guests by event id | |
| 37 | +| POST | /api/events | title, location, month, day, year, start_time, end_time | Creates new event | |
| 38 | +| POST | /api/events/:id/guests | userID (of the user being added) | Add guest to event by id | |
| 39 | +| PUT | /api/events/:id | title, location, month, day, year, start_time, end_time | Updates event by id | |
| 40 | +| DELETE | /api/events/:id | | Deletes event by id | |
| 41 | + |
| 42 | +## Food |
| 43 | + |
| 44 | +| Method | Endpoint | Requirements | | |
| 45 | +| ------ | -------------------- | --------------------------------------------------------------------- | -------------------------------- | |
| 46 | +| GET | /api/food | | Returns all food items | |
| 47 | +| GET | /api/events/:id/food | | Returns all the food by event id | |
| 48 | +| GET | /api/food/:id | | Returns food object by id | |
| 49 | +| POST | /api/food | eventId, userID(optional), category, quantity, name (must be unique) | Creates new food object | |
| 50 | +| PUT | /api/food/:id | eventId, userID(optional), category, quantity , name (must be unique) | Updates the food by id | |
| 51 | +| DELETE | /api/food/:id | | Deletes the food by id" | |
0 commit comments