This REST API allows management of users and tasks with role-based permissions. Admins can view all tasks they created, while users see only their own tasks.
POST /adduser.php
| Parameter | Type | Description |
|---|---|---|
| name | string | Full name of the user |
| username | string | Unique username (no spaces allowed) |
| password | string | Password (will be stored securely) |
| string | Email address | |
| role | enum('admin','user') | User role type |
| created_by | string | Username of the creator |
{
"name": "John Doe",
"username": "johnd",
"password": "123456",
"email": "john@example.com",
"role": "user",
"created_by": "admin"
}
POST /authuser.php
| Parameter | Type | Description |
|---|---|---|
| username | string | User login name |
| password | string | User password |
{
"username": "johnd",
"password": "123456"
}
GET /getuser.php/{created_by}/userlist
Returns a list of all users created by the specified creator.
GET https://test.myfuntopia.com/restapi/getuser.php/admin/userlist
POST /addtask.php
| Parameter | Type | Description |
|---|---|---|
| user_id | int | ID of the user assigned to the task |
| title | string | Task title |
| status | string | Task status |
| created_by | string | Username of the creator |
{
"user_id": 2,
"title": "Complete project documentation",
"status":"Pending"
"created_by": "admin"
}
GET /gettask.php/{created_by}/{user_id}/tasklist
{created_by}.{user_id}.
GET https://test.myfuntopia.com/restapi/gettask.php/admin/3/tasklist
{
"status": true,
"data": [
{ "task_id": 1, "title": "Fix API Bug", "status": "Pending", "assigned_to": "John Doe" }
]
}
PUT /updatetask.php/{task_id}/update
| Parameter | Type | Description |
|---|---|---|
| status | enum('Pending','Approved','Rejected','Done') | Updated task status |
{
"status": "Approved"
}
PUT https://test.myfuntopia.com/restapi/updatetask.php/5/update
PUT /updateuser.php/{user_id}/updateuser
| Parameter | Type | Description |
|---|---|---|
| name | string | Updated user name |
| string | Updated email address | |
| role | enum('admin','user') | User role |
Note: Username cannot be changed.
{
"name": "John Doe Updated",
"email": "john.new@example.com",
"role": "user"
}
PUT https://test.myfuntopia.com/restapi/updateuser.php/2/updateuser
| Purpose | Method | URL Example |
|---|---|---|
| Login | POST | https://test.myfuntopia.com/restapi/authuser.php |
| Add User | POST | https://test.myfuntopia.com/restapi/adduser.php |
| List Users | GET | https://test.myfuntopia.com/restapi/getuser.php/admin/userlist |
| Add Task | POST | https://test.myfuntopia.com/restapi/addtask.php |
| Get Tasks (Admin/User) | GET | https://test.myfuntopia.com/restapi/gettask.php/admin/3/tasklist |
| Update Task | PUT | https://test.myfuntopia.com/restapi/updatetask.php/5/update |
| Update User | PUT | https://test.myfuntopia.com/restapi/updateuser.php/3/updateuser |