converting single item queries to a generic api