I am creating the REST API using codeigniter. I downloaded this library and installed in my application. It works great! https://github.com/chriskacerguis/codeigniter-restserver
But I have an doubt. As per this library. I have 4 functoins
- GET
- POST
- PUT
- DELETE
I understand the functionality of each POST method but what I concern is how to write the validation and other things in the REST API.
Example: I have created the controller User.php
class User extends REST_Controller {
public function __construct()
{
parent::__construct();
}
// Get multile / individual users records and perform search also.
public function index_get()
{
$this->response('get / search users', REST_Controller::HTTP_OK);
}
// User Registration / Login
public function index_post()
{
echo 'create';
}
// User Information Update
public function index_put()
{
echo 'update';
}
// User Delete
public function index_delete()
{
echo 'delete';
}
}
I tested in postman post method works fine.
Here is my question. I have the following functionality for user.
- Register
- Login
- Forgot Password
- Change Password
- Update Profile
I think except Register other functions are posted with PUT method? In the PUT / POST method do I have to write all validations and database operation buy identity the post method variable using action likes register, login, forgot-password etc.,
In admin I want to get active or inactive users, find by email or name. this kind of operations where we have to write?
Thanks to all.