Update checklist item

POST /api/sync/v1/surveys/answers

Operation id: updateChecklist

Description

This API allows the assigned user or the user with task-view-all permission within the same site to update the survey answers for a particular assignment of a to-do. The surveyType currently support is CHECKLIST. So, that value should be entered as a parameter. The entityId should be the assignmentId of the specific assignment of a to-do. The list of assignmentIds can be fetched using GET ASSIGNMENT LIST API.

Accepted values for reasonTypeId are 10 (Not Applicable) and 11 (Cannot Do) The displayType value should be CHECKLIST for checklist based survey which is currently supported. The numeric values for valueNum represent the checklist item status:

0 indicates that the item is not complete 1 indicates that the item is marked as complete 2 indicates that the item is marked as not applicable

The valueString should not be used for Checklist based survey

Permissions Required:

  1. Assignee of the todo or have task-view-all permission within the same site

Tags: Survey APIs

Parameters

Query parameters

NameTypeRequiredDescription
entityIdinteger (int32)YesEntity Id
surveyTypestringYesType of Survey

Security

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

Responses

200 — Answer Submitted successfully

Content type: application/json

400 — Bad Request

500 — Internal Server Error

Request body

Required: Yes

application/json

Schema

PropertyTypeRequiredDescription
idinteger (int32)No
questionIdinteger (int32)No
questionOptionIdinteger (int32)No
displayTypestringNo
dataTypestringNo
valueNumnumberNo
valueStringstringNo
valueDatestring (date-time)No
reasonstringNo
reasonTypeIdinteger (int32)No
answerAttachmentsarrayNo
offlineActionTimestampstring (date-time)No
{
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "format": "int32"
    },
    "questionId": {
      "type": "integer",
      "format": "int32"
    },
    "questionOptionId": {
      "type": "integer",
      "format": "int32"
    },
    "displayType": {
      "type": "string",
      "enum": [
        "INPUTBOX",
        "DATEPICKER",
        "NUMBER_SCROLLER",
        "DROPDOWN",
        "MULTISELECT",
        "CHECKBOX",
        "RADIO",
        "CONFIRM_WITH_PHOTO"
      ]
    },
    "dataType": {
      "type": "string",
      "enum": [
        "INTEGER",
        "DECIMAL",
        "STRING",
        "BOOLEAN",
        "JSON",
        "DATE",
        "TIMESTAMP"
      ]
    },
    "valueNum": {
      "type": "number"
    },
    "valueString": {
      "type": "string"
    },
    "valueDate": {
      "type": "string",
      "format": "date-time"
    },
    "reason": {
      "type": "string"
    },
    "reasonTypeId": {
      "type": "integer",
      "format": "int32"
    },
    "answerAttachments": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "fileHash"
        ],
        "properties": {
          "fileHash": {
            "type": "string",
            "description": "Hash of file",
            "example": "f5160b088f2650b1398b5d13e41a42ec6cc36521"
          },
          "id": {
            "type": "integer",
            "format": "int32"
          }
        }
      }
    },
    "offlineActionTimestamp": {
      "type": "string",
      "format": "date-time"
    }
  }
}

Response models

200 — Answer Submitted 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"
    }
  }
}