タスクを割り当て

post
https://api.box.com/2.0
/task_assignments

ユーザーにタスクを割り当てます。

複数の割り当てを作成することで、1つのタスクを複数のユーザーに割り当てることができます。

リクエスト

bearer [ACCESS_TOKEN]
application/json

リクエスト本文

object本文内

タスクを割り当てるユーザー。

string本文内必須
"3242343"

タスクに割り当てるユーザーのID。

メールアドレスでユーザーを指定するには、loginパラメータを使用します。

string本文内必須
"john@example.com"

タスクに割り当てるユーザーのメールアドレス。ユーザーIDを使用してユーザーを指定するには、idパラメータを使用します。

object本文内

ユーザーに割り当てるタスク。

string本文内必須
"11446498"

タスクのID

string本文内必須
"task"

割り当てる項目の種類。

次の値に固定: task

レスポンス

application/jsonタスク割り当て

新しいタスク割り当てオブジェクトを返します。

完了したタスクに対して変更が試行された場合、または指定されたタスク割り当てのタスクにリンクされた項目にユーザーがアクセスできない場合に、エラーを返します。

タスクが見つからない場合はエラーを返します。

このリクエストのIDのいずれかが無効である場合、またはターゲットユーザーがファイルにアクセスできない場合はエラーを返します。

予期しないクライアントエラー。

post
タスクを割り当て
このドキュメント内で一部のAPIを試せるようになりました。
ログイン

リクエストの例

cURL
curl -i -X POST "https://api.box.com/2.0/task_assignments" \
     -H "authorization: Bearer <ACCESS_TOKEN>" \
     -H "content-type: application/json" \
     -d '{
       "task": {
         "id": "11446498",
         "type": "task"
       },
       "assign_to": {
         "id": "4823213"
       }
     }'
.NET
// Assign task 11111 to user 22222
var assignmentParams = new BoxTaskAssignmentRequest()
{
    Task = new BoxTaskRequest()
    {
        Id = "11111"
    },
    AssignTo = new BoxAssignmentRequest()
    {
        Id = "22222"
    }
};
BoxTaskAssignment assignment = await client.TasksManager.CreateTaskAssignmentAsync(assignmentParams);
Java
BoxUser user = new BoxUser(api, "user-id")
BoxTask task = new BoxTask(api, "id");
task.addAssignment(user);
Python
user = client.user(user_id='11111')
assignment = client.task(task_id='12345').assign(user)
print(f'Assignment ID is {assignment.id} and is assigned to user {assignment.assigned_to.name}')
Node
// Assign task 11111 to user 22222
var taskID = '11111';
var userID = '22222';
client.tasks.assignByUserID(taskID, userID)
	.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: null,
			completed_at: null,
			assigned_at: '2013-05-10T11:43:41-07:00',
			reminded_at: null,
			resolution_state: 'incomplete',
			assigned_by: 
			{ type: 'user',
				id: '33333',
				name: 'Example User',
				login: 'user@example.com' } }
		*/
	});

レスポンスの例

{
  "id": "11446498",
  "type": "task_assignment",
  "assigned_at": "2012-12-12T10:53:43-08:00",
  "assigned_by": {
    "id": "11446498",
    "type": "user",
    "login": "ceo@example.com",
    "name": "Aaron Levie"
  },
  "assigned_to": {
    "id": "11446498",
    "type": "user",
    "login": "ceo@example.com",
    "name": "Aaron Levie"
  },
  "completed_at": "2012-12-12T10:53:43-08:00",
  "item": {
    "id": "12345",
    "type": "file",
    "etag": "1",
    "file_version": {
      "id": "12345",
      "type": "file_version",
      "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc"
    },
    "name": "Contract.pdf",
    "sequence_id": "3",
    "sha1": "85136C79CBF9FE36BB9D05D0639C70C265C18D37"
  },
  "message": "Please review",
  "reminded_at": "2012-12-12T10:53:43-08:00",
  "resolution_state": "incomplete"
}