Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

/workorder/pcr/answer

This action sets the answer for one or more questions in a PCR form associated with a work order.

Request

FieldDescriptionRequired
report_idUnique identifier for the work orderYes
pcr_form_idUnique identifier for the PCR formYes
questionsAnswers to PCR form questionsYes

questions must be an array of PCR question objects. Each PCR question object must contain two fields — pcr_question_id and answer.

The pcr_question_id uniquely identifies a question in the PCR form; use the /workorder/pcr/get action to find the pcr_question_id for a PCR question.

The answer field should specify the answer for the PCR question. The answer’s type and value depends on the PCR question type. Use the table below to figure out the answer’s type and value.

PCR question typeAnswer typeAnswer valueExample
textboxstringAny valid UTF-8 string value"Briar Mount"
textareastringAny valid UTF-8 string value"Lorem ipsum something"
numericnumberAny valid number88.82
dropdownnumberMust be $.questions[i].items[j].value from the PCR form object7517
radionumberMust be $.questions[i].items[j].value from the PCR form object8381
checkboxarrayEach answer value in the array must be $.questions[i].items[j].value from the PCR form object[7518, 7519, 7520]
datestringMust be a date string in YYYY/MM/DD format"2021/03/18"

Example:

{
  "report_id": 18851,
  "pcr_form_id": 28,
  "questions": [{
    "pcr_question_id": 3801,
    "answer": 7517
  }, {
    "pcr_question_id": 3802,
    "answer": [7518, 7519, 7520]
  }, {
    "pcr_question_id": 3807,
    "answer": 7535
  }, {
    "pcr_question_id": 3804,
    "answer": "Briar Mount"
  }, {
    "pcr_question_id": 3870,
    "answer": "Lorem ipsum something"
  }, {
    "pcr_question_id": 3819,
    "answer": "2021/03/18"
  }]
}
curl -H 'Content-Type: application/json' \
     -H 'Authorization: Bearer ACCESS_TOKEN' \
     -d '{"report_id":18851,"pcr_form_id":28,"questions":[{"pcr_question_id":3801,"answer":7517},{"pcr_question_id":3802,"answer":[7518,7519,7520]},{"pcr_question_id":3807,"answer":7535},{"pcr_question_id":3804,"answer":"Briar Mount"},{"pcr_question_id":3870,"answer":"Lorem ipsum something"},{"pcr_question_id":3819,"answer":"2021/03/18"}]}' \
     https://ppw.web/svc/workorder/pcr/answer

Response

FieldDescriptionType
resultsArray of PCR question result objectsarray

Example successful response:

{
  "results": [{
    "id": 0,
    "pcr_question_id": 3801,
    "saved": false,
    "msg": "Answer did not change; not saving"
  }, {
    "id": 1,
    "pcr_question_id": 3802,
    "saved": true,
    "msg": "Answer saved"
  }, {
    "id": 2,
    "pcr_question_id": 3807,
    "saved": true,
    "msg": "Answer saved"
  }, {
    "id": 3,
    "pcr_question_id": 3804,
    "saved": true,
    "msg": "Answer saved"
  }, {
    "id": 4,
    "pcr_question_id": 3870,
    "saved": false,
    "msg": "Answer did not change; not saving"
  }, {
    "id": 5,
    "pcr_question_id": 3819,
    "saved": true,
    "msg": "Answer saved"
  }]
}

Errors

Error TypeDescriptionStatus Code
access_deniedAccess token is invalid or expired401
scope_invalidClient app does not have the required OAuth scope403
wo_invalidWork order invalid400
pcr_form_id_invalidPCR Form Id invalid400
questions_invalidQuestions is invalid400
questions_emptyQuestions is empty400
pcr_not_attachedPCR form not attached to the work order400