Update assigned To-Do status

PUT /api/sync/v1/todos/assignments/status

Operation id: updateAssignmentStatus

Description

The API can be used to update a particular assignment's status. The API takes in assignment id which can be obtained from the GET ASSIGNMENT LIST APIs. It also take in the status ENUM value which are applicable to the assignments.

Assignment ID and status are mandatory and undo parameter is optional. The undo parameter is used when the status of the Assignment needs to be reverted if the assignment has been completed. It can be undone within the 10 second of the status being marked as COMPLETE.

The valid values for status are READ or COMPLETE. By default,when assignments are created during the LAUNCH of to-do, they are assigned a status with value NEW.

Only the users/roles/department within a site to whom the assignment is assigned to or the users who have task-view-all permission within that site can change the status of the assignment.

Permissions Required: 2) For Assignment status update: - Assignee of the assignment or have task-view-all within that site where the assignment is created.

Tags: To-Do Execution APIs

Security

  • Bearer (http / bearer)
    • enter the client service token value.

Responses

200 — Assignment status updated Successfully

Content type: application/json

400 — Bad Request

401 — Unauthorized Access

412 — Precondition Failed

422 — Unprocessable Entity

500 — Internal Server Error

Request body

Required: Yes

application/json

Schema

PropertyTypeRequiredDescription
assignmentIdinteger (int32)Yesassignment id of task on which status is to be updated.
statusstringYesstatus of task
undobooleanNoundo the status
offlineActionTimestampstring (date-time)NoThe time when the user acted on the task while the device was offline
{
  "type": "object",
  "required": [
    "status",
    "assignmentId"
  ],
  "properties": {
    "assignmentId": {
      "type": "integer",
      "format": "int32",
      "description": "assignment id of task on which status is to be updated."
    },
    "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": "READ"
    },
    "undo": {
      "type": "boolean",
      "description": "undo the status"
    },
    "offlineActionTimestamp": {
      "type": "string",
      "format": "date-time",
      "description": "The time when the user acted on the task while the device was offline"
    }
  }
}

Response models

200 — Assignment status updated Successfully

Content type: application/json

Schema

PropertyTypeRequiredDescription
messagestringNo
statusstringNo
statusCodeinteger (int32)No
debugErrorMessagestringNo
messageCodestringNomessage codes
messageParamsarrayNo
dataobjectNo
{
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "SUCCESS",
        "FAIL",
        "BAD_REQUEST",
        "NO_CONTENT",
        "UNAUTHORIZED",
        "FORBIDDEN",
        "NOT_FOUND",
        "INTERNAL_SERVER_ERROR",
        "UNSUPPORTED_MEDIA_TYPE"
      ]
    },
    "statusCode": {
      "type": "integer",
      "format": "int32"
    },
    "debugErrorMessage": {
      "type": "string"
    },
    "messageCode": {
      "type": "string",
      "description": "message codes",
      "items": {
        "type": "string",
        "example": [
          "ERROR12-To-Do has expired.",
          "ERROR13-To-Do has been recalled.",
          "ERROR14-Complete all checklist items.",
          "ERROR15-Error updating status.",
          "ERROR16-Error fetching assignment.",
          "ERROR55-Error updating status.",
          "ERROR59-To-do is already completed by {name}",
          "ERROR75-To-Do has been Recalled.",
          "ERROR17-To-Do can not be reassigned as it has been completed.",
          "ERROR18-This To-Do is confidential and can not be reassigned.",
          "ERROR19-Error while reassigning.",
          "ERROR36-Current assignee's site id doesn't match",
          "ERROR20-This To-Do can not be recalled as it has not been launched.",
          "ERROR21-Error while recalling To-Do.",
          "ERROR35-Please select a reason type while recalling a task",
          "ERROR58-To-do can not be recalled."
        ]
      }
    },
    "messageParams": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "data": {
      "type": "object"
    }
  }
}