Filtering and returning records through the API