@sajankos welcome to the openmrs community, did you set the authentication credentials as advised here Visit object not created using REST api
And kindly make effort to paste error logs to pastebin.com so we have a cleaner link to the error in talk threads.