Added code to simulate failure in api endpoints