Updated code with API connection for Register form

Updated code with API connection for Register form