rewrite user api to restful api