added API to query by activity and API to list activities (re #325)