generalize queryapi by removing write to implicit file