Update a To-Do
PUT /api/sync/v1/todos/{todoId}
Operation id: UpdateTodoV4
Description
This API will update an to-do in DRAFT state. This API will provide a id value for the to-do updated. This id value can be used to either update the details for to-do or use the Launch API to launch the to-do.
- This version allows a task creator to assign it to a recipient at any site within their line of sight.
- This API uses fileHash for attachments instead of fileuri. Hash will be output of the File Upload API.
The following parameters are mandatory to update a to-do:-
- Title: Max limit is 120 characters
- Start Date: Default value is Current Timestamp. The date can be in the future but not in past. The time should be in UTC
- Due Date: The date cannot be in past. The time should be in UTC
- Priority: Default value is NONE. Other values are URGENT or HIGH or LOW.
- Status: Value has to be set as DRAFT.
- Recipients: It allows the user to pass in the platform userid , or the platform role id, platform department id to be marked as recipients of the to-do. The platform siteid should be passed along with each of the parameters.
- Repeat: This parameter is used to set a repeating to-do and create occurrences based on a set schedule.
- DEFAULT is DO_NOT_REPEAT. If this value is passed: rest of the params for repeat key are not required.
- But if WEEKLY, DAILY, MONTHLY are passed, then the scheduleEndDate should be passed.
- If WEEKLY is passed, additional scheduleDayofWeek should be passed which have the values as [MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY]
- If MONTHLY is passed, additional scheduleDayofMonth should be passed which have the values as days of the month (1-31). For scheduling last day of the month, put 31 as the value in every case.
- Also, the start date's value should match the scheduleDayofWeek value or ScheduleDayofMonth value.
The other optional parameters are:-
- Description: Max 2000 characters.
- expiryLimitInDays: Default is 90 days. Value can be from 1 to 90 days.
- attachments: Array of file metadata using fileHash (V2 format). The file upload is done through a FILE UPLOAD API
- tags:Add specific tags to a to-do
- startDateNotSet : ToDo Start Date
Permission Required:
- task-creation
- task-creation-checklist
- task-creation-instore
Tags: To-Do APIs
Parameters
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
todoId | integer (int32) | Yes | Identifier of a To-Do |
Security
- Bearer (http / bearer)
- enter the client service token value.
Responses
200 — To-Do Updated Successfully
Content type: application/json
400 — Bad Request
401 — Unauthorized Access
404 — Task Not Found
422 — Unprocessable Entity
500 — Internal Server Error
Request body
Required: Yes
application/json
Schema
| Property | Type | Required | Description |
|---|---|---|---|
title | string | No | Title for task |
description | string | No | Description for task |
startDate | string (date-time) | No | start date for task |
dueDate | string (date-time) | No | due date for task |
priority | string | No | priority for task |
tags | array | No | List of tags |
status | string | No | status of task |
expiryLimitInDays | integer (int32) | No | no of days that will be used to calculate expireDate for a Task by adding it to dueDate |
repeat | object | No | |
attributes | array | No | |
attachments | array | No | |
recipients | array | No |
{
"type": "object",
"properties": {
"title": {
"type": "string",
"description": "Title for task",
"example": "Create Purchase Orders"
},
"description": {
"type": "string",
"description": "Description for task",
"example": "Create Purchase Orders"
},
"startDate": {
"type": "string",
"format": "date-time",
"description": "start date for task"
},
"dueDate": {
"type": "string",
"format": "date-time",
"description": "due date for task"
},
"priority": {
"type": "string",
"description": "priority for task",
"enum": [
"NONE",
"URGENT",
"HIGH",
"MEDIUM",
"LOW",
"IMPORTANT",
"STANDARD"
]
},
"tags": {
"type": "array",
"description": "List of tags",
"items": {
"type": "object",
"description": "list of tags",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"description": "name of tag"
}
}
}
},
"status": {
"type": "string",
"description": "status of task",
"enum": [
"DRAFT",
"PENDING_APPROVAL",
"REJECTED",
"LAUNCHED",
"APPROVED",
"NEW",
"READ",
"COMPLETED",
"OVERDUE",
"EXPIRED",
"RECALLED",
"PENDING_LAUNCH",
"COMPLETED_LATE",
"ONGOING",
"DISCARDED",
"APPLIED"
],
"example": "DRAFT"
},
"expiryLimitInDays": {
"type": "integer",
"format": "int32",
"description": "no of days that will be used to calculate expireDate for a Task by adding it to dueDate",
"example": 10
},
"repeat": {
"type": "object",
"required": [
"scheduleType"
],
"properties": {
"scheduleType": {
"type": "string",
"description": "cron expression for the schedule",
"enum": [
"DO_NOT_REPEAT",
"DAILY",
"WEEKLY",
"MONTHLY"
],
"example": "WEEKLY, DO_NOT_REPEAT, MONTHLY, DAILY"
},
"scheduleEndDate": {
"type": "string",
"format": "date-time",
"description": "end date for the schedule"
},
"scheduleDayOfWeek": {
"type": "string",
"description": "day of the week for weekly schedules",
"enum": [
"MONDAY",
"TUESDAY",
"WEDNESDAY",
"THURSDAY",
"FRIDAY",
"SATURDAY",
"SUNDAY"
],
"example": "MONDAY"
},
"scheduleDateOfMonth": {
"type": "integer",
"format": "int32",
"description": "date of the month for monthly schedules",
"example": 15
}
}
},
"attributes": {
"type": "array",
"items": {
"type": "object",
"required": [
"attribute",
"value"
],
"properties": {
"attribute": {
"type": "string",
"description": "attribute Name",
"enum": [
"SCHEDULE_CRON",
"SCHEDULE_START_DATE",
"SCHEDULE_END_DATE",
"SCHEDULE_EVENT_ID",
"TIME_SENSITIVE",
"TIME_END",
"APPROVE_IN_ORDER",
"APPROVALS_REQUIRED",
"CONFIDENTIAL",
"ORIGINATION_TEMPLATE_TASK_ID",
"RESET_AFTER_EDIT",
"TASK_EXPIRE_DAYS"
],
"example": "CONFIDENTIAL"
},
"value": {
"type": "string",
"description": "based on the attribute, type for value could be text,boolean,date or integer",
"example": "true"
}
}
}
},
"attachments": {
"type": "array",
"items": {
"type": "object",
"description": "attachments assigned to entities (V3/V4 format with fileHash)",
"properties": {
"fileHash": {
"type": "string",
"description": "hash of the file (obtained from file upload API)",
"example": "abc123def456"
}
}
}
},
"recipients": {
"type": "array",
"items": {
"type": "object",
"properties": {
"platformUserId": {
"type": "string",
"description": "user Id"
},
"platformRoleId": {
"type": "string",
"description": "role Id"
},
"platformSiteId": {
"type": "string",
"description": "site Id"
},
"platformDepartmentId": {
"type": "string",
"description": "department Id"
},
"platformRegionId": {
"type": "string",
"description": "region Id"
}
}
}
}
}
}
Response models
200 — To-Do Updated Successfully
Content type: application/json
Schema
| Property | Type | Required | Description |
|---|---|---|---|
message | string | No | response message |
status | string | No | response status |
statusCode | integer (int32) | No | response status code |
debugErrorMessage | string | No | error message |
messageCode | string | No | message codes |
messageParams | array | No | message parameters |
data | object | No | |
taskId | integer (int32) | No | identifier of task |
clonedTask | object | No | details of cloned task |
{
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "response message"
},
"status": {
"type": "string",
"description": "response status",
"enum": [
"SUCCESS",
"FAIL",
"BAD_REQUEST",
"NO_CONTENT",
"UNAUTHORIZED",
"FORBIDDEN",
"NOT_FOUND",
"INTERNAL_SERVER_ERROR",
"UNSUPPORTED_MEDIA_TYPE"
]
},
"statusCode": {
"type": "integer",
"format": "int32",
"description": "response status code"
},
"debugErrorMessage": {
"type": "string",
"description": "error message"
},
"messageCode": {
"type": "string",
"description": "message codes",
"items": {
"type": "string",
"example": [
"ERROR60- Error updating To-Do.",
"ERROR403_03-You do not have permission to perform this action.",
"ERROR71-To-Do launched, cannot be updated.",
"ERROR72-To-Do deleted, cannot be updated.",
"ERROR78-Error while creating task, assignee site should belong to creator current site."
]
}
},
"messageParams": {
"type": "array",
"description": "message parameters",
"items": {
"type": "string"
}
},
"data": {
"type": "object"
},
"taskId": {
"type": "integer",
"format": "int32",
"description": "identifier of task"
},
"clonedTask": {
"type": "object",
"description": "details of cloned task",
"properties": {
"id": {
"type": "integer",
"format": "int32",
"description": "identifier of task"
},
"title": {
"type": "string",
"description": "title for task"
},
"description": {
"type": "string",
"description": "description for task"
},
"overdue": {
"type": "boolean",
"description": "flag to indicate if task is overdue"
},
"customerId": {
"type": "integer",
"format": "int32",
"description": "customer Id"
},
"surveyId": {
"type": "integer",
"format": "int32",
"description": "survey Id"
},
"taskTypeId": {
"type": "integer",
"format": "int32",
"description": "task Type Id"
},
"taskType": {
"type": "string",
"description": "task Type",
"enum": [
"TASK",
"PLAIN_TEXT",
"WALK",
"CHECKLIST",
"SURVEY",
"ANNOUNCEMENT"
]
},
"priorityId": {
"type": "integer",
"format": "int32",
"description": "priority Id for task"
},
"priority": {
"type": "string",
"description": "priority for task"
},
"status": {
"type": "string",
"description": "status for Task"
},
"template": {
"type": "boolean",
"description": "task template"
},
"createdBy": {
"type": "integer",
"format": "int32",
"description": "task created by user Id"
},
"startDate": {
"type": "string",
"format": "date-time",
"description": "start Date for task"
},
"dueDate": {
"type": "string",
"format": "date-time",
"description": "due date for task"
},
"visibleDate": {
"type": "string",
"format": "date-time",
"description": "visible date for task"
},
"expireDate": {
"type": "string",
"format": "date-time",
"description": "expiry Date for task"
},
"expireDays": {
"type": "integer",
"format": "int64",
"description": "no of days that will be used to calculate expireDate for an todo by adding it to dueDate"
},
"totalAssignments": {
"type": "integer",
"format": "int32",
"description": "total number of assignements for task"
},
"completedAssignments": {
"type": "integer",
"format": "int32",
"description": "number of completed assignments for task"
},
"creatorDetails": {
"type": "object",
"description": "details of task creator",
"properties": {
"userId": {
"type": "integer",
"format": "int32"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"employeeId": {
"type": "string"
},
"profilePhoto": {
"type": "string"
},
"presence": {
"type": "object",
"properties": {
"state": {
"type": "integer",
"format": "int32",
"description": "state for user"
},
"status": {
"type": "string",
"description": "status for user"
},
"updatedAt": {
"type": "string",
"format": "date-time",
"description": "date and time when user information is updated"
}
}
},
"roleId": {
"type": "integer",
"format": "int32"
},
"siteId": {
"type": "integer",
"format": "int32"
},
"roleName": {
"type": "string"
},
"alias": {
"type": "string"
},
"name": {
"type": "string"
},
"siteName": {
"type": "string"
},
"roles": {
"type": "array",
"items": {
"type": "object"
}
}
}
},
"editedStatus": {
"type": "boolean",
"description": "status of edited task"
},
"displayDate": {
"type": "object",
"description": "display date of task",
"properties": {
"naturalDay": {
"type": "string"
},
"weekDay": {
"type": "string"
},
"overdueTime": {
"type": "string"
},
"date": {
"type": "string"
},
"time": {
"type": "string"
}
}
},
"isWatching": {
"type": "boolean",
"description": "flag to indicate if current user is watching the task"
}
}
}
}
}