Tasks
Create, update, delete, and query the available Tasks in Box.
Table Specific Information
Tasks are jobs that are waiting to be assigned to someone. These tasks are related to an item, which generally is a File.
Select
To select from the Tasks table you need to specify an Id or an ItemId.
SELECT * FROM Tasks WHERE Id = '123'
If you're authenticated as an administrator with user impersonation permissions, you can query tasks from multiple user accounts:
SELECT * FROM Tasks WHERE AsUserId IN (SELECT Id FROM Users)
Note: User impersonation has the following limitations:
- The authenticated user cannot be impersonated unless that user is a service account.
- If the authenticated user is a standard user account, they can only query tasks associated with their account.
- Tasks shared with multiple users are only returned for one of the users.
Insert
ItemId is required to insert into Tasks table.Currently Box API supports only file as type of the item the task is for.
INSERT INTO Tasks (ItemId, ItemType, Action, Message) VALUES (1001, 'file', 'review', 'message')
Update
The Message is required to perform an UPDATE to a specific task. Also, the Action and DueAt columns can be updated as well. The Action column is only able to take a 'review' value.
UPDATE Tasks SET Message = 'updated message', Action = 'review', DueAt = '2016-05-14' WHERE ID = '100'
Delete
You can only delete a Task by providing an Id.
DELETE FROM Tasks WHERE Id = '100'
Columns
Name | Type | ReadOnly | Description |
Id [KEY] | String | True |
The Id of the task. |
DueAt | Datetime | False |
The date due of this task. |
ItemId | String | False |
The Id of the item the task is targeted to. |
ItemType | String | False |
The type of the item the task is targeted to. |
Action | String | False |
The action the task assignee will be prompted to do. |
Message | String | False |
An optional message to include with the task. |
CreatedAt | Datetime | True |
The date that the task was created at. |
CreatedById | String | True |
The id of user that created the task. |
CreatedByName | String | True |
The name of the user that created the task. |
CreatedByLogin | String | True |
The login of the user that created the task. |
IsCompleted | Boolean | False |
If the task has been completed or not. |
AsUserId | String | False |
The Id of the user you want to impersonate. Only works with Admin, Co-Admin and Service Accounts. |