Generalize API querying