Added rescue_from Apipie::ParamInvalid. Refactored UnauthorizedController. Added ApiController tests.