Rest Api creation with error handling