refactor: convert queries to REST resources