title: php - Codeigniter Rest api simple CRUD
body: <p>I have this problem with inserting data to MySQL which require POST method by using postman.</p>
  
  <p>this function <code>data_post()</code> inserts data from database, but when I am trying to insert data raw data with postman </p>
  
  <pre><code>{"id":"2","name":"ropen","password":"pamela005"}
  </code></pre>
  
  <p>I am having this error on postman: </p>
  
  <blockquote>
    <p>405 Method not Allowed</p>
  </blockquote>
  
  <p><strong>This is my Controller</strong>
  <code>Users.php</code></p>
  
  <pre><code>public function data_post(){
      $params = [
          'id' =&gt; 1,
          'name' =&gt; 'John Doe',
          'password' =&gt; 'test'
      ];
      $resp = $this-&gt;user_model-&gt;data($params);
      $this-&gt;set_response($resp, REST_Controller::HTTP_CREATED);    
  }
  </code></pre>
  
  <p><strong>Model</strong>
  <code>User_model.php</code></p>
  
  <pre><code>public function data($data){   
        $this-&gt;db-&gt;insert('user',$data);
     }
  </code></pre>