allow filtering the api/tasks json result by state

like is possible on the /tasks web view