Box Developer Documentation

Lists all tasks for a file

Guides Tasks Lists all tasks for a file
Edit this page

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 -i -X GET "https://api.box.com/2.0/files/12345/tasks" \
     -H "authorization: Bearer <ACCESS_TOKEN>"
TypeScript Gen
await client.tasks.getFileTasks(file.id);
Python Gen
client.tasks.get_file_tasks(file.id)
.NET Gen
await client.Tasks.GetFileTasksAsync(fileId: file.Id);
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(f'Task ID is {task.id} and the type is {task.type}')
.NET
BoxCollection<BoxTask> tasks = await client.FilesManager.FilesManager.GetFileTasks("11111");
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
let iterator = client.files.listTasks(forFile: "11111")
iterator.next { results in
    switch results {
    case let .success(page):
        for task in page.entries {
            print("Task messsage: \(task.message)")
        }

    case let .failure(error):
        print(error)
    }
}