Welcome Guest, Not a member yet? Register   Sign In
How to use form_validation with PUT data for use with RESTful API?
#1

[eluser]benners[/eluser]
I'm creating a RESTful API http://net.tutsplus.com/tutorials/php/wo...igniter-2/

I'm having problems displaying form_validation errors and I'm thinking the problem is that the data is PUT rather than POST. Can anyone assist?

Code:
To create a new user the API receives a PUT request.

public function create_put() {
if(!$this->put('email')) {  
  $this->response(array('status' => 'missing_data'), 400);  
} else {
  $this->load->library('form_validation');
  $this->form_validation->set_rules('email', 'Email address', 'trim|valid_email');
  if($this->form_validation->run() === FALSE)
  {
   $this->response( array( 'status' => validation_errors() ), 406);  
  }

}
}


Messages In This Thread
How to use form_validation with PUT data for use with RESTful API? - by El Forum - 07-12-2012, 04:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB