This is a REST API for a simple ToDo List. This project is done using SLIM PHP Micro Framework+ Apache +PHP + MySQL
Database: "db_dmp/to_do_list.sql"
MySQL-PHP connection: "include/config.php"
Chrome: Advanced REST client extension Firefox: REST Easy extension
| URL | Method | Parameters | Description |
|---|---|---|---|
| /register | POST | name,email,password | User Registration |
| /login | POST | email,password | User Login |
| /tasks | POST | task | To Create a New Task |
| /tasks | GET | Fetching All Tasks | |
| /tasks/:id | GET | Fetching A Single Task | |
| /tasks/:id | PUT | Updating a Single Task | |
| /tasks/:id | DELETE | task,status | Delete a Single Task |
Upon the successful registration the following json response will be issued.
{
"error": false,
"message": "You are successfully registered"
}
If the request is missing mandatory parameters the following json will be issued.
{
"error": true,
"message": "Required field(s) email, password is missing or empty"
}
On successful login the following json will be issued.
{
"error": false,
"name": "Peru",
"email": "perakka@gmail.com",
"apiKey": "940bb12af8d7b040876f60f965c5be6d",
"createdAt": "2014-01-07 23:38:35"
}
If the credentials are wrong, you can expect the following json.
{
"error": true,
"message": "Login failed. Incorrect credentials"
}
On successful creation of new task following json will be issued. If you got this json, you can see new row inserted in tasks and user_tasks tables.
{
"error": false,
"message": "Task created successfully",
"task_id": 1
}
{
"error": false,
"tasks": [
{
"id": 1,
"task": "Buy A Book",
"status": 0,
"createdAt": "2014-01-08 23:35:45"
},
{
"id": 2,
"task": "Click the Play",
"status": 0,
"createdAt": "2014-01-08 23:56:52"
}
]
}