add json api function to get tasks