New user rest APIs

Refactored and correct the code.