Check if `api_result` exists before accessing its values.