Update the settings of a course test.

Open in ChatGPT Open in ChatGPT to ask questions about this page
Open in Claude Open in Claude to ask questions about this page
Copy as MarkdownCopy this page as markdown to use with AI assistants
View as Markdown Open this page as markdown in a new tab

Updates grading, negative marking, time limit, shuffling, retake and result-display settings of a course test. Only the keys you send are changed; the path formId is the test id, not the form UUID.

Endpoint

put https://{TrainerCentral-API-Domain}/tc/api/v1/trainer/session/{sessionId}/tests/{testUuid}.json

OAuth Scope

TrainerCentral.sessionapi.UPDATECopied!

Headers

tc-orgIdstring(Required)

ID of the academy (orgId).

Example
51517414

Path Parameters

sessionIdlong(Required)

ID of the course lesson (sessionId) that holds the test.

Example
21603000000354002
testUuidstring(Required)

Test id of the test (tests[].id), not the form UUID.

Example
8a0904c5-bd29-4a9f-9d03-b5fd2dbe880f

Request Body

application/json
testJSON Object(Required)

Settings to change; only the keys you send are changed.

Hide Sub-Attributes
enableGradingboolean(Optional)

true grades each attempt pass or fail; needed for the 3 and 4 values of the *AllowType keys.

gradingPercentageinteger(Optional)

Pass mark as a percentage of the total score (0-100).

enableNegativeMarkboolean(Optional)

true deducts marks for wrong answers.

negativeMarkTypeinteger(Optional)

How negativeMark applies. Allowed: 0=Points, 1=Percentage of the question score.

negativeMarkinteger(Optional)

Marks or percent deducted per wrong answer (1-100).

enableTimedTestboolean(Optional)

true limits each attempt to duration minutes.

durationinteger(Optional)

Time limit per attempt in minutes (1-600).

enableShuffleQuestionboolean(Optional)

true shuffles the questions in each attempt.

shuffleLimitinteger(Optional)

Questions picked at random per attempt; at most the question count.

enableShuffleAnswerOptionboolean(Optional)

true shuffles the options of Choice questions.

enableRetakeboolean(Optional)

true lets learners retake the test.

attemptsCountinteger(Optional)

Retakes allowed after the first attempt.

allowRetakeAllowTypeinteger(Optional)

Who may retake when grading is on. Allowed: 1=All learners, 3=Passed only, 4=Failed only.

testResultAllowTypeinteger(Optional)

Who sees the result. Allowed: 0=Default (hidden), 1=All learners, 2=No one, 3=Passed only, 4=Failed only.

testScoreAllowTypeinteger(Optional)

Who sees the score. Allowed: 0=Default (hidden), 1=All learners, 2=No one, 3=Passed only, 4=Failed only.

learnersAnswerAllowTypeinteger(Optional)

Who sees their own answers. Allowed: 0=Default (hidden), 1=All learners, 2=No one, 3=Passed only, 4=Failed only.

correctOrIncorrectAllowTypeinteger(Optional)

Who sees whether each answer was correct. Allowed: 0=Default (hidden), 1=All learners, 2=No one, 3=Passed only, 4=Failed only.

correctAnswerAllowTypeinteger(Optional)

Who sees the correct answers. Allowed: 0=Default (hidden), 1=All learners, 2=No one, 3=Passed only, 4=Failed only.

answerFeedbackAllowTypeinteger(Optional)

Who sees the question feedback. Allowed: 0=Default (hidden), 1=All learners, 2=No one, 3=Passed only, 4=Failed only.

passGradeMessagestring(Optional)

Message displayed to learners when they pass the assessment. Supports rich text.

failGradeMessagestring(Optional)

Message displayed to learners when they fail the assessment. Supports rich text.

customEndMessagestring(Optional)

Message displayed when the assessment ends. Supports rich text.

allowLearnersToChangeAnswerOnceSubmittedboolean(Optional)

true lets learners change a submitted answer during the attempt.

showFeedbackForEachQuestionAfterAnsweringboolean(Optional)

true shows feedback right after each answer.

Request Example

cURL
cURL
Java
Python
Deluge
Copied!
curl --request PUT \
  --url https://trainercentral.zoho.com/tc/api/v1/trainer/session/21603000000354002/tests/8a0904c5-bd29-4a9f-9d03-b5fd2dbe880f.json \
  --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' \
  --header 'content-type: application/json' \
  --header 'tc-orgId: 51517414' \
  --data '{"test":{"enableGrading":true,"gradingPercentage":50,"enableNegativeMark":true,"negativeMarkType":0,"negativeMark":1,"enableTimedTest":true,"duration":83,"enableShuffleQuestion":true,"shuffleLimit":3,"enableShuffleAnswerOption":true,"enableRetake":true,"attemptsCount":1,"allowRetakeAllowType":4,"testResultAllowType":1,"testScoreAllowType":1,"learnersAnswerAllowType":1,"correctOrIncorrectAllowType":1,"correctAnswerAllowType":1,"answerFeedbackAllowType":1,"passGradeMessage":"Congratulations! You have shown strong business fundamentals knowledge.","failGradeMessage":"Keep learning. Review business metrics, planning and financial statements, then try again."}}'

Body Parameters

Graded, timed test with negative marking, shuffling and one retake for learners who fail.

Graded, timed test with negative marking, shuffling and one retake for learners who fail.

Turn off the time limit and retakes.

Show answers only to learners who passed.

Copied!
  {
    "test": {
      "enableGrading": true,
      "gradingPercentage": 50,
      "enableNegativeMark": true,
      "negativeMarkType": 0,
      "negativeMark": 1,
      "enableTimedTest": true,
      "duration": 83,
      "enableShuffleQuestion": true,
      "shuffleLimit": 3,
      "enableShuffleAnswerOption": true,
      "enableRetake": true,
      "attemptsCount": 1,
      "allowRetakeAllowType": 4,
      "testResultAllowType": 1,
      "testScoreAllowType": 1,
      "learnersAnswerAllowType": 1,
      "correctOrIncorrectAllowType": 1,
      "correctAnswerAllowType": 1,
      "answerFeedbackAllowType": 1,
      "passGradeMessage": "Congratulations! You have shown strong business fundamentals knowledge.",
      "failGradeMessage": "Keep learning. Review business metrics, planning and financial statements, then try again."
    }
  }
                
  {
    "test": {
      "enableTimedTest": false,
      "enableRetake": false
    }
  }
                
  {
    "test": {
      "testResultAllowType": 1,
      "learnersAnswerAllowType": 3,
      "correctAnswerAllowType": 3
    }
  }
                
▼ Show full

Response Parameters

testJSON Object

The test with all its settings; same keys as tests[] in List Course Tests.

Hide Sub-Attributes
idstring

Test ID. Not the form UUID.

formIdstring

Test form ID (formUuid_sessionId).

formstring

Same as formId.

sessionIdstring

ID of the lesson that holds the test.

sessionstring

Same as sessionId.

namestring

Name of the test.

descriptionstring

Test instructions. Supports rich text.

totalQuestionsstring

Number of questions.

enableGradingstring

true when grading is on.

enableRetakestring

true when retakes are allowed.

attemptsCountstring

Number of retakes allowed after the first attempt.

gradingPercentagestring

Pass percentage.

enableTimedTeststring

true when the test has a time limit.

durationstring

Time limit in minutes.

enableShuffleQuestionstring

true when questions are shuffled.

enableShuffleAnswerOptionstring

true when answer options are shuffled.

enableNegativeMarkstring

true when negative marking is on.

testResultAllowTypestring

Who sees the result. Allowed: 0=Default, 1=All, 2=No one, 3=Passed only, 4=Failed only.

testScoreAllowTypestring

Who sees the score. Allowed: 0=Default, 1=All, 2=No one, 3=Passed only, 4=Failed only.

allowRetakeAllowTypestring

Who can retake. Allowed: 1=All, 3=Passed only, 4=Failed only.

learnersAnswerAllowTypestring

Who sees their answers. Allowed: 0=Default, 1=All, 2=No one, 3=Passed only, 4=Failed only.

correctAnswerAllowTypestring

Who sees the correct answers. Allowed: 0=Default, 1=All, 2=No one, 3=Passed only, 4=Failed only.

answerFeedbackAllowTypestring

Who sees answer feedback. Allowed: 0=Default, 1=All, 2=No one, 3=Passed only, 4=Failed only.

correctOrIncorrectAllowTypestring

Who sees whether each answer is correct. Allowed: 0=Default, 1=All, 2=No one, 3=Passed only, 4=Failed only.

allowLearnersToChangeAnswerOnceSubmittedstring

true when learners can change answers after submitting.

showFeedbackForEachQuestionAfterAnsweringstring

true when feedback shows after each question.

customEndMessagestring

Message displayed after submission. Supports rich text.

passGradeMessagestring

Message displayed to learners when they pass the assessment. Supports rich text.

failGradeMessagestring

Message displayed to learners when they fail the assessment. Supports rich text.

graceTimeForEndTeststring

Grace time in seconds after the time limit.

shuffleLimitstring

Number of questions picked per attempt when shuffling.

enableShowCorrectAnswerstring

Legacy flag.

enableShowResultstring

Legacy flag.

negativeMarkstring

Marks or percent deducted per wrong answer.

negativeMarkTypestring

Allowed: 0=Points, 1=Percentage.

errorJSON Object

Error details.

Hide Sub-Attributes
codestring

Deprecated numeric error code (for example ST_202). Prefer codeStr; omitted from doc samples.

codeStrstring

Error code name (ShowtimeErrorCode / err_code_str), for example MISSING_PARAMETER.

messagestring

Error message.

Possible Error Codes

HTTP CodeError CodeDescription
500ST_79

INVALID_SESSION - The sessionId is not a lesson in this academy. Use tests[].sessionId from List Course Tests; do not retry unchanged.

ST_401

SESSION_DELETED - The lesson (sessionId) is deleted. Use an existing lesson; do not retry unchanged.

ST_102

UNAUTHORISED_ACCESS - The user cannot edit this test. Use an academy owner, admin, course trainer or lesson owner; do not retry unchanged.

ST_819

TEST_FEATURE_UNAVAILABLE - The academy plan does not include graded tests. Upgrade the plan; do not retry until then.

Response Example

Test after the first request example.

200
200
400
500
Copied!
  {
    "test": {
      "id": "8a0904c5-bd29-4a9f-9d03-b5fd2dbe880f",
      "formId": "7305cb9e-3913-49d7-8cb9-eebd159f5281_21603000000354002",
      "form": "7305cb9e-3913-49d7-8cb9-eebd159f5281_21603000000354002",
      "sessionId": "21603000000354002",
      "session": "21603000000354002",
      "name": "Business Fundamentals Quiz",
      "description": "<p>Answer all questions.</p>",
      "totalQuestions": "5",
      "enableGrading": "true",
      "gradingPercentage": "50",
      "enableTimedTest": "true",
      "duration": "83",
      "graceTimeForEndTest": "10",
      "enableNegativeMark": "true",
      "negativeMark": "1",
      "negativeMarkType": "0",
      "enableShuffleQuestion": "true",
      "shuffleLimit": "3",
      "enableShuffleAnswerOption": "true",
      "enableRetake": "true",
      "attemptsCount": "1",
      "allowRetakeAllowType": "4",
      "testResultAllowType": "1",
      "testScoreAllowType": "1",
      "learnersAnswerAllowType": "1",
      "correctOrIncorrectAllowType": "1",
      "correctAnswerAllowType": "1",
      "answerFeedbackAllowType": "1",
      "enableShowResult": "true",
      "enableShowCorrectAnswer": "true",
      "allowLearnersToChangeAnswerOnceSubmitted": "true",
      "showFeedbackForEachQuestionAfterAnswering": "false",
      "customEndMessage": "",
      "passGradeMessage": "Congratulations! You have shown strong business fundamentals knowledge.",
      "failGradeMessage": "Keep learning. Review business metrics, planning and financial statements, then try again."
    }
  }
                
  {
    "error": {
      "code": "string",
      "codeStr": "string",
      "message": "string"
    }
  }
                
500 Request failed; see the error code.
▼ Show full