Function apiResponse