Added more API endpoints and a helper function to build queries.#