Validate data in rest api

Hi How i can validate post/put data in rest api?

Hi, You can validate your data via forms



8.9k
edited Nov '14

i use angularjs, all data send in json format

how check and validate it?



5.6k

you can decode your json into php array.

for example if here is your validation code

$validation->add('name', new PresenceOf(array(
    'message' => 'The name is required'
)));

then your array must be formatted like this

[
    "email" => "[email protected]"]
]


8.9k
edited Nov '14

How i can use many filters for one json value in controller?

example: $phone = " 123<a>456</a>789";

need use filters: striptags, trim

Use validation component