refact api about tasks.