[api] fix code api code that is only covered by webui test suite