moved _call_api out of inner method