GuidesTasksLists all tasks for a file
Edit this page

Lists all tasks for a file

Lists all tasks for a file

To list all of the tasks for a specific file, call the GET /files/:id/tasks with the id of the file.

cURL
curl -X GET https://api.box.com/2.0/files/12345/tasks \
     -H 'Authorization: Bearer <ACCESS_TOKEN>'
.NET
BoxCollection<BoxTask> tasks = await client.FilesManager.FilesManager.GetFileTasks("11111");
Java
BoxFile file = new BoxFile(api, "id");
List<BoxTask.Info> tasks = file.getTasks();
Python
tasks = client.file(file_id='11111').get_tasks()
for task in tasks:
    print('Task ID is {0} and the type is {1}'.format(task.id, task.type))
Node
client.files.getTasks('11111')
	.then(tasks => {
		/* tasks -> {
			total_count: 1,
			entries: 
			[ { type: 'task',
				id: '22222',
				item: 
					{ type: 'file',
					id: '11111',
					sequence_id: '6',
					etag: '6',
					sha1: '81cc829fb8366fcfc108aa6c5a9bde01a6a10c16',
					name: 'box-logo.png' },
				due_at: null } ] }
		*/
	});
iOS
client.files.listTasks(forFile: "11111") { results in
    switch results {
    case let .success(iterator):
        for i in 1 ... 10 {
            iterator.next { result in
                switch result {
                case let .success(item):
                    print("Task messsage: \(task.message)")
                case let .failure(error):
                    print(error)
                }
            }
        }
    case let .failure(error):
        print(error)
    }
}