I've only implemented the features specifically outlined in the requirements. There are more features which could be added that are likely needed by the scenario (ability to unsubscribe from todos, deleting todos, authorisation in request headers, etc) but have been omitted due to time constraints.
- PHP7 + MySQLi extension.
- Access to the API is controlled outside of the tool.
- The server the tool runs on is configured for sending e-mails through the PHP mail function.
- A MySQL database exists with details that match with the db.ini file.
- In said MySQL database the following three table should exist:
- The users table is populated external to the tool.
- The example request URIs below assume the API is run on the localhost under a todos directory.
GET | http://localhost/todos/ListIncompleteTodos.php
POST | http://localhost/todos/CreateTodo.php
{
"description": "Buy milk"
}
PUT | http://localhost/todos/CompleteTodo.php
{
"todo_id": 3
}
POST | http://localhost/todos/SubscribeToTodo.php
{
"user_id": 1,
"todo_id": 2
}