Add success, error callback in API on HTTP requests