title: How to send a post request to the RESTserver api in php-Codeigniter?
body: <p>I've been trying to make a POST request in my CodeIgniter RestClient controller to insert data in my RestServer, but seems like my POST request is wrong.</p>
  
  <p><strong>Here is my RestClient POST request in controller:</strong></p>
  
  <pre><code>$method = 'post';
  $params = array('patient_id'      =&gt; '1',
                  'department_name' =&gt; 'a',
                  'patient_type'    =&gt; 'b');
  $uri = 'patient/visit';
  $this-&gt;rest-&gt;format('application/json');
  $result = $this-&gt;rest-&gt;{$method}($uri, $params);
  </code></pre>
  
  <p>This is my  RestServer's controller: <strong>patient</strong></p>
  
  <pre><code>function visit_post()
  {
      $insertdata=array('patient_id'      =&gt; $this-&gt;post('patient_id'),
                        'department_name' =&gt; $this-&gt;post('department_name'),
                        'patient_type'    =&gt; $this-&gt;post('patient_type') );
  
      $result = $this-&gt;user_model-&gt;insertVisit($insertdata);
  
      if($result === FALSE)
      {
          $this-&gt;response(array('status' =&gt; 'failed'));
      }
      else
      {
          $this-&gt;response(array('status' =&gt; 'success'));
      }
  }
  </code></pre>
  
  <p>This is <strong>user_model</strong></p>
  
  <pre><code>public function insertVisit($insertdata)
  {
     $this-&gt;db-&gt;insert('visit',$insertdata);
  }
  </code></pre>