Welcome Guest, Not a member yet? Register   Sign In
REST API Atribute Validation
#1

Hy,

I am creating a web page with API functionalites. For that I use this library: https://github.com/chriskacerguis/codeig...restserver

For now it works fine, but I am searching for a good and fast vay fro validating the call atributes. Someone suggested to me to use the form_validation for the validation and that also works but I can not get the error_message if the validation fails. It just returns a emty string. And the form_validation works only on the post calls. If I try to use it on a PUT call the validation fails.

Does someon know a good practice for validating atributes in REST_Controll-s?
Reply
#2

To use data from a PUT call, pass the data to $this->form_validation->set_data($data).

Since you probably don't have much use for the form helper's form_error() function in a REST environment, you can use the form_validation library's error() method, which takes the same parameters as form_error().
Reply




Theme © iAndrew 2016 - Forum software by © MyBB