Change task assignment state

Guides Tasks Assigning tasks Change task assignment state
Edit this page

Change task assignment state

To update a task assignment's state call the PUT /tasks/:task_id/assignments API and include a resolution_state, such as completed, incomplete, approved, or rejected.

cURL
curl -i -X PUT "https://api.box.com/2.0/task_assignments/12345" \
     -H "authorization: Bearer <ACCESS_TOKEN>" \
     -H "content-type: application/json" \
     -d '{
       "message": "New message",
       "resolution_state": "completed"
     }'
TypeScript Gen
await client.taskAssignments.updateTaskAssignmentById(taskAssignment.id!, {
  requestBody: {
    message: 'updated message',
    resolutionState:
      'approved' as UpdateTaskAssignmentByIdRequestBodyResolutionStateField,
  } satisfies UpdateTaskAssignmentByIdRequestBody,
} satisfies UpdateTaskAssignmentByIdOptionalsInput);
Python Gen
client.task_assignments.update_task_assignment_by_id(
    task_assignment.id,
    message="updated message",
    resolution_state=UpdateTaskAssignmentByIdResolutionState.APPROVED,
)
.NET Gen
await client.TaskAssignments.UpdateTaskAssignmentByIdAsync(taskAssignmentId: NullableUtils.Unwrap(taskAssignment.Id), requestBody: new UpdateTaskAssignmentByIdRequestBody() { Message = "updated message", ResolutionState = UpdateTaskAssignmentByIdRequestBodyResolutionStateField.Approved });
Swift Gen (Beta)
try await client.taskAssignments.updateTaskAssignmentById(taskAssignmentId: taskAssignment.id!, requestBody: UpdateTaskAssignmentByIdRequestBody(message: "updated message", resolutionState: UpdateTaskAssignmentByIdRequestBodyResolutionStateField.approved))
Java
String assignmentID = "12345";
BoxTaskAssignment taskAssignment = new BoxTaskAssignment(api, assignmentID);
BoxTaskAssignment.Info info = taskAssignment.getInfo();
info.setResolutionState(BoxTaskAssignment.ResolutionState.APPROVED);
taskAssignment.updateInfo(info);
Python
from boxsdk.object.task_assignment import ResolutionState
updated_task = {'resolution_state': ResolutionState.APPROVED}
updated_assignment = client.task_assignment(assignment_id='12345').update_info(data=updated_task)
print(f'Assignment ID is {updated_assignment.id} and resolution state is {updated_assignment.resolution_state}')
.NET
var requestParams = new BoxTaskAssignmentUpdateRequest()
{
    Id = "12345",
    ResolutionState = ResolutionStateType.approved
};
BoxTaskAssignment updatedAssignment = await client.TasksManager.UpdateTaskAssignmentAsync(requestParams);
Node
// Complete a task
client.tasks.updateAssignment(
	'12345',
	{
		message: 'Done!',
		resolution_state: client.tasks.resolutionStates.COMPLETE
	})
	.then(assignment => {
		/* assignment -> {
			type: 'task_assignment',
			id: '12345',
			item: 
			{ type: 'file',
				id: '33333',
				sequence_id: '0',
				etag: '0',
				sha1: '7840095ee096ee8297676a138d4e316eabb3ec96',
				name: 'script.js' },
			assigned_to: 
			{ type: 'user',
				id: '22222',
				name: 'Sample Assignee',
				login: 'assignee@exmaple.com' },
			message: 'Done!',
			completed_at: null,
			assigned_at: '2013-05-10T11:43:41-07:00',
			reminded_at: null,
			resolution_state: 'complete',
			assigned_by: 
			{ type: 'user',
				id: '33333',
				name: 'Example User',
				login: 'user@example.com' } }
		*/
	});

Resolution states

Box currently supports two types of tasks defined by the action value: review tasks and complete tasks.

The type of task determines the possible resolution states a task can be in and the interface shown to a user in the web and mobile apps.

Task actionPossible resolution states
reviewincomplete, approved, rejected
completeincomplete, complete

A review task starts out in an incomplete state and can be marked as incomplete, approved, or rejected. In the user interface a user is provided with a text box and an pair of buttons to approve or reject the task.

A complete task starts out in an incomplete state and can be marked incomplete or completed. Once a this task is marked completed, no further changes can be made to the task's state. In the user interface a user is provided with a text box and an button to mark the task as completed.