[webui][api] moved field checks to controller, updated test functions and some more refactoring.
[webui][api] added required_fields to check for empty params/content