Working With Tasks
Simple Tasks - Overview
Simple Tasks are tasks created using the POST /api/simple-tasks route. This API supports creating normal tasks (not review tasks) for a project and replicates the functionality of the "New Simple Task" button in the UI.
Supported Fields
| Field | Required | Default Value | Description |
|---|---|---|---|
| ProjectId | Yes | N/A | ID of the project for the task. |
| Title | No | "New Task" | Name of the task. |
| Description | No | null | Description of the task. |
| Begin Date | Yes (2/3)* | Project timezone date 9:00 AM | Start date/time (YYYY-MM-DDThh:mm:ss). |
| End Date | Yes (2/3)* | Project timezone date 5:00 PM | End date/time (YYYY-MM-DDThh:mm:ss). |
| Estimated Duration | Yes (2/3)* | 1 day | Duration between begin and end dates. |
| Start Type | No | ASAP | Task start type (e.g., FixedBegin, FixedEnd). |
| Task Status | No | Projected | Status of the task (e.g., Draft, Assigned). |
| Work Schedule | No | Default Calendar | Work schedule for the task. |
| Auto Close | No | No | Automatically close the task. |
| Allow Remove | No | Yes | Allow removing the task. |
| Allow Delegate | No | No | Determines if the task is allowed to be delegated to other people. |
| Assignee | Yes | N/A | User or role assigned to the task. |
At least two of the following fields must be provided: Begin Date, End Date, or Estimated Duration.
Additional Details
Required Fields
- Fields not marked as required will default to their respective values if not specified.
- Invalid or missing required fields will result in errors.
Limitations
- The predecessor task is always set to "start".
- Attributes like "insert before" or "insert after" are not supported.
Domain Rights
To use this API, users must have one of the following:
- Project Rights: Edit, Task Insert, View, and Activity Edit Access.
- Integration Rights: Edit, Task Insert, View, and API Access.
- System Administration Access.
Field-Specific Details
Task Status
- Field Name:
workFlowTaskStatus. - Default Value: Projected.
- Values:
- Draft (1), Projected (2), Pending (3), Assigned (4), InProcess (5), Closed (7), Cancelled (8).
- Status restrictions depend on the project status.
- For example, Draft projects only allow task statuses Draft, Cancelled, or Removed.
Begin Date / End Date
- Field Names:
beginDate/endDate. - Default:
- Begin: Project timezone date 9:00 AM.
- End: Project timezone date 5:00 PM.
- Validation:
- At least two fields (Begin Date, End Date, or Duration) must be specified.
- Invalid date formats or
endDate < beginDatewill result in errors.
Estimated Duration
- Field Name:
EstimatedDuration. - Default Value: 1 day (8 hours).
- Formats Supported:
- Total minutes (e.g.,
"EstimatedDuration": 1200). - Days, hours, and minutes (e.g.,
"enteredEstimatedDurationDay": 1, "enteredEstimatedDurationHour": 2).
- Total minutes (e.g.,
Example Errors
- Missing
ProjectId:"ProjectId cannot be null". - Negative duration:
"EnteredEstimatedDurationMinute contains an invalid value". - Mismatch in
BeginDate,EndDate, andEstimatedDuration:"The input BeginDate, EndDate, and EstimatedDuration do not match!".
Example Request
{
"ProjectId": 12345,
"Title": "New Task",
"description": "Task description",
"beginDate": "2023-07-10T09:00:00",
"endDate": "2023-07-10T17:00:00",
"EstimatedDuration": 480,
"startType": 1,
"workFlowTaskStatus": 2,
"Assignee": {
"UserId": 67890,
"EstimatedWork": "1:0:0"
}
}
If the request contains a negative estimated Duration, the route will throw an exception. For example, the following data would result in the response containing an error that reads “EnteredEstimatedDurationMinute contains an invalid value. Only positive numbers are allowed”:
{
"enteredEstimatedDurationHour": 5,
"enteredEstimatedDurationMinute": -2,
"enteredEstimatedDurationDay": 2
}
Task Configuration Fields
Work Schedule (Default: Default Calendar)
- Field Name:
workScheduleId - Description: The calendar ID used for the task.
- Details:
- Default:
Default Calendar(ID = 1). - Custom calendar IDs can be created in the Aprimo UI under Work Schedules.
- If an invalid calendar ID is provided, the API will return:
"The 'WorkScheduleID(xxxx)' specified does not exist."
- Default:
Auto Close (Default: No)
- Field Name:
autoClose - Description: Determines if a task automatically closes upon assignment.
- Values:
autoClose: 0→ Auto Close = NoautoClose: 1→ Auto Close = Yes
- Details:
- If
autoClose = 1, the fieldsWorkgroup Action,Auto Accept,Allow Delegation, andAssigneesare ignored. - Valid values: 0 or 1. Invalid values return:
"AutoClose contains an invalid value. Only 'No' (0) and 'Yes' (1) are allowed."
- If
Workgroup Action (Default: Any May Close)
- Field Name:
workGroupActionID - Description: Defines the close pattern for the task.
- Values:
1→ One Must Close2→ Any May Close3→ All Must Close
- Details:
- If
workGroupAction = One Must Close,Auto Acceptshould not be specified. - If
workGroupAction = Any May CloseorAll Must Close,Auto Acceptcan be specified.
- If
Auto Accept (Default: No)
- Field Name:
autoAccept - Description: Determines if the task is automatically accepted by the assignee.
- Values:
autoAccept: 0→ Auto Accept = NoautoAccept: 1→ Auto Accept = Yes
- Details:
- Valid values: 0 or 1. Invalid values return:
"AutoAccept contains an invalid value. Only 'No' (0) and 'Yes' (1) are allowed."
- Valid values: 0 or 1. Invalid values return:
Allow Delegation (Default: No)
- Field Name:
canDelegate - Description: Specifies if the task can be delegated to others.
- Values:
true→ Delegation Allowedfalse→ Delegation Not Allowed
- Details:
- If
canDelegate: false, the response always returnscanDelegate: false. - If
canDelegate: true, it will return true only if the user is an assignee and the task is in Assigned or In Process status.
- If
Allow Remove (Default: Yes)
- Details:
- Read-only field.
- Always returns
1(Allow Remove).
Assignee (Required)
- Field Name:
Assignee - Description: A collection specifying the users, groups, or roles assigned to the task.
- Details:
- Supported formats:
"taskRoles": []→ SupportsroleIDanduserID."assignees": []→ Supports onlyuserID.
- Only one format can be used per request. If both are specified, the API will return:
"Only one of the following Task fields is allowed: Assignees and TaskRoles." - Each assignee must include:
Estimated Work(Default: 0 days, 0 hours, 0 minutes).userIDorroleID.
- Supported formats:
Estimated Work Formats
- Total Minutes:
"estimatedWork": 630
- Days, Hours, Minutes
"enteredEstWorkDay": 1,
"enteredEstWorkHour": 2,
"enteredEstWorkMin": 30
Invalid values (e.g., negative durations) will result in errors: "EnteredEstimatedDurationMinute contains an invalid value. Only positive numbers are allowed."
Simple Tasks - Sample JSON
Below is an example of a request body to create a task with all fields specified:
{
"name": "NAMESimple-NonDefault-AssignedTask",
"description": "DESSimple-NonDefault-AssignedTask",
"ProjectId": "{{InProcessProjectId}}",
"startType": "{{startTypeASAP}}",
"workFlowTaskStatus": "{{taskStatusAssigned}}",
"workScheduleId": 1,
"autoClose": 1,
"workGroupActionId": 1,
"autoAccept": 0,
"canDelegate": false,
"canSkip": 0,
"taskRoles": [
{
"userId": "{{userId}}",
"enteredEstWorkDay": "{{enteredEstWorkDay1}}",
"enteredEstWorkHour": "{{enteredEstWorkHour1}}",
"enteredEstWorkMin": "{{enteredEstWorkMin1}}"
},
{
"userId": "{{groupId}}",
"enteredEstWorkDay": "{{enteredEstWorkDay2}}",
"enteredEstWorkHour": "{{enteredEstWorkHour2}}",
"enteredEstWorkMin": "{{enteredEstWorkMin2}}"
}
],
"beginDate": "2018-07-10T09:00:00",
"enteredEstimatedDurationHour": 2,
"enteredEstimatedDurationMinute": 2,
"enteredEstimatedDurationDay": 2
}
Key Details:
ProjectId: ID of the project for which the task is created.startType: Specifies when the task starts (e.g., ASAP).workFlowTaskStatus: Task status (e.g., Assigned, Projected).workScheduleId: ID of the work schedule (default = 1 for Default Calendar).autoClose: Automatically close the task upon assignment (1 = Yes, 0 = No).taskRoles: Collection of assignees with estimated work specified as days, hours, and minutes.beginDate: Start date of the task (YYYY-MM-DDThh:mm:ss format).enteredEstimatedDurationDay/Hour/Minute: Duration of the task in days, hours, and minutes.
Task Delegation
To delegate a task, use the POST /api/tasks/{taskid}/delegate route.
A task can not be delegated to the user making the delegation request.
Request Body Format
{
"taskAssigneeId": "{{original_task_assignee_id}}",
"newUserId": "{{user_id}}"
}
Key Details:
taskAssigneeId: The ID of the original task assignee.- This can be retrieved via the
GET /api/tasks/{taskid}route.
- This can be retrieved via the
newUserId: The ID of the user to whom the task is being delegated.
Task Uploads - Attachments
Uploading attachments to a task involves multiple steps. These steps assume the task is in In Process status and has an open upload slot.
Steps to Upload an Attachment
Step 1: Get the documentId for the Upload Slot
- When a task has an open upload slot, it is represented by a
documentId. - Perform a
GET /api/tasks/{taskId}/document-uploadsto retrieve thedocumentIdrequired for the upload.
Step 2: Upload the File to Aprimo
- Follow the File Upload Process instructions up to the Combining File Chunks step.
- Note the
fileIdandfilenameused in the upload.
Step 3: Create the Attachment
- Use the
POST /api/tasks/{taskId}/document-uploads/{documentId}/attachmentsroute to create the attachment.- This route automatically sets information such as
activityId, simplifying the data required.
- This route automatically sets information such as
- Request Body:
{
"title": "Task Document Upload - Example",
"description": "Optional description for the task attachment"
}
- Do not include
objectIdorobjectTypeIdin the request body; these are set automatically by the API. - Additional attachment fields can be found at
/api/attachments/metadata.
Step 4: Create the Attachment Version
Instead of using the /api/attachments/{id}/versions route, create the attachment version by calling:
POST /api/tasks/{taskId}/document-uploads/{documentId}/attachments/{attachmentId}/versions
Request Body Example
{
"FileName": "blue-earphones-equipment-164880.jpg",
"FileId": "d4669d44-4335-4d77-acca-67ed4d3142fb",
"isDefaultVersion": true,
"versionType": 3
}
Ensure you use the attachmentId retrieved after creating the attachment in Step 3.
Key Details
FileName: The name of the file used in Step 2.FileId: The unique identifier for the file from Step 2.isDefaultVersion: Marks the version as the default (true or false).versionType: Indicates the version type (e.g., 3).
Step 5: Associate the Attachment Version to the Upload Slot
Use the PUT /api/tasks/{taskId}/document-uploads/{documentId}/upload-document route to associate the uploaded document version with the task.
Request Body Example
{
"versionId": "{{attachmentVersionId}}"
}
This call links the document upload slot to the task, completing the attachment process.
Key Details
versionId: The version ID obtained from the response in Step 4.