Create a To-Do
POST /api/sync/v1/todos
Operation id: CreateTodoV2
Description
This API will create a to-do in DRAFT state. This API will provide a id value for the to-do created. 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 create 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. 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
Security
- Bearer (http / bearer)
- enter the client service token value.
Responses
200 — Task Created Successfully
Content type: application/json
400 — Bad Request
401 — Unauthorized Access
403 — Forbidden
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 — Task Created 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 |
{
"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": [
"ERROR01- Start date can not be in the past.",
"ERROR02-Due date can not be in the past.",
"ERROR03-Due date should be after the start date.",
"ERROR04-Please add an assignee before [launching/submitting] To-Do",
"ERROR05-Visible date can not be in the past.",
"ERROR06-Title can not exceed 120 characters.",
"ERROR07-File name can not exceed 120 characters.",
"ERROR08-Please select a priority.",
"ERROR09-Please select a due date.",
"ERROR403_02-You do not have permission to perform this action.",
"ERROR403_05-You do not have permission to perform this action.",
"ERROR403_06-You do not have permission to perform this action.",
"ERROR40-Error creating To-Do."
]
}
},
"messageParams": {
"type": "array",
"description": "message Parameters",
"items": {
"type": "string"
}
},
"data": {
"type": "object"
},
"taskId": {
"type": "integer",
"format": "int32",
"description": "identifier of task"
}
}
}