Added a apiSuccess and apiError reply functions