add wait time logic in rest api