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:-

  1. Title: Max limit is 120 characters
  2. Start Date: Default value is Current Timestamp. The date can be in the future but not in past. The time should be in UTC
  3. Due Date: The date cannot be in past. The time should be in UTC
  4. Priority: Default value is NONE. Other values are URGENT or HIGH or LOW.
  5. Status: Value has to be set as DRAFT.
  6. 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.
  7. 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:-

  1. Description: Max 2000 characters.
  2. expiryLimitInDays: Default is 90 days. Value can be from 1 to 90 days.
  3. attachments: Array of file metadata using fileHash. The file upload is done through a FILE UPLOAD API
  4. tags:Add specific tags to a to-do
  5. startDateNotSet : ToDo Start Date

Permission Required:

  1. task-creation
  2. task-creation-checklist
  3. 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

PropertyTypeRequiredDescription
titlestringNoTitle for task
descriptionstringNoDescription for task
startDatestring (date-time)Nostart date for task
dueDatestring (date-time)Nodue date for task
prioritystringNopriority for task
tagsarrayNoList of tags
statusstringNostatus of task
expiryLimitInDaysinteger (int32)Nono of days that will be used to calculate expireDate for a Task by adding it to dueDate
repeatobjectNo
attributesarrayNo
attachmentsarrayNo
recipientsarrayNo
{
  "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

PropertyTypeRequiredDescription
messagestringNoresponse message
statusstringNoresponse status
statusCodeinteger (int32)Noresponse status code
debugErrorMessagestringNoerror message
messageCodestringNomessage codes
messageParamsarrayNomessage Parameters
dataobjectNo
taskIdinteger (int32)Noidentifier 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"
    }
  }
}