[api] simplify code of webui/requests controller