Create a test in a course lesson.

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

Creates an empty test (quiz) in a course lesson or live session and attaches it as a session material. Send the query parameter type=3.

Endpoint

post https://{TrainerCentral-API-Domain}/tc/api/v1/trainer/session/{sessionId}/forms.json

OAuth Scope

TrainerCentral.sessionapi.CREATECopied!

Headers

tc-orgIdstring(Required)

ID of the academy (orgId).

Example
51517414

Path Parameters

sessionIdlong(Required)

ID of the course lesson or live session (sessionId).

Example
3000000000040

Query Parameters

typestring(Required)

Form type. Must be 3 (Test).

Example
3

Request Body

application/json
formJSON Object(Required)

The test to create.

Hide Sub-Attributes
namestring(Required)

Name of the test. Max 50 characters.

descriptionstring(Optional)

Instructions shown before the test starts. Supports rich text.

Request Example

cURL
cURL
Java
Python
Deluge
Copied!
curl --request POST \
  --url 'https://trainercentral.zoho.com/tc/api/v1/trainer/session/3000000000040/forms.json?type=3' \
  --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' \
  --header 'content-type: application/json' \
  --header 'tc-orgId: 51517414' \
  --data '{"form":{"name":"Python Basics Quiz","description":"<p>Answer all questions. You can attempt the quiz once.</p>"}}'

Body Parameters

Create a test with instructions.

Copied!
  {
    "form": {
      "name": "Python Basics Quiz",
      "description": "<p>Answer all questions. You can attempt the quiz once.</p>"
    }
  }
                
▼ Show full

Response Parameters

formJSON Object

The test form. Use form.formId in the course test APIs.

Hide Sub-Attributes
formIdstring

Test form ID (formUuid_sessionId). The part before the underscore is the form UUID.

formIdValuestring

Form UUID of the test. Returned only by Create Course Test.

idstring

Same as formId.

sessionIdstring

ID of the lesson that holds the test.

namestring

Name of the test.

descriptionstring

Test instructions. Supports rich text.

typestring

Form type. Always 3 (Test).

testJSON Object

Settings of the test, with defaults.

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.

sessionMaterialsJSON Array

The attachment of the test to the session.

Hide Sub-Attributes
JSON Object
Show Sub-Attributes
sessionMaterialIdstring

ID of the attachment that holds the test (sessionMaterialId).

idstring

Same as sessionMaterialId.

sessionIdstring

ID of the lesson or live session (sessionId).

sessionstring

Same value as sessionId.

resourceIdstring

UUID of the test form (form.formIdValue).

resourceTypestring

Type of the material. Always 20=Test.

viewTypestring

Placement of the material. 2=Assessment for tests.

topicstring

Name of the test.

sessionMaterialIndexstring

Zero-based position among the session materials.

timestring

Time attached, in epoch milliseconds.

fieldsJSON Array

Questions of the test. Empty on create.

Hide Sub-Attributes
JSON Object
Show Sub-Attributes
idstring

Question ID (fieldId).

formIdstring

Test form ID (formUuid_sessionId).

formstring

Same as formId.

labelstring

Question text.

fieldTypestring

Question type. Allowed: 2=Choice, 7=True or false, 8=Fill in the blank, 16=Essay.

scorestring

Marks for a correct answer.

isMandatorystring

true when the question must be answered.

isUniquestring

Not used. Always false.

orderIndexstring

Position of the question.

preDefinedFieldIdstring

Not used. Always 0.

evaluationTypestring

Allowed: 0=Default, 1=OCR.

evaluationDatastring

Evaluation data for OCR.

isCaseSensitivestring

Fill in the blank only. true when answers are case sensitive.

textLengthstring

Essay only. Maximum answer length.

textCountTypestring

Essay only. Allowed: 0=Characters, 1=Words.

enableFeedbackstring

true when feedback is on.

feedbackJSON Object

Feedback for the question.

Show Sub-Attributes
typestring

Feedback mode. Allowed: 0=Same for any answer, 1=Correct and incorrect, 2=Per option.

dataListarray

Feedback texts. Supports rich text.

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 does not match a session in this academy. Pass a valid sessionId. Do not retry unchanged.

ST_401

SESSION_DELETED - The session was deleted. Use a session that is not deleted. Do not retry unchanged.

ST_102

UNAUTHORISED_ACCESS - The user is not an academy owner or admin, the primary trainer, or a course admin or trainer. Call with one of these roles; do not retry unchanged.

Response Example

Response after creating a test.

200
200
400
500
Copied!
  {
    "sessionMaterials": [
      {
        "sessionMaterialId": "3000000000130",
        "id": "3000000000130",
        "sessionId": "3000000000040",
        "session": "3000000000040",
        "resourceId": "7c1dcd08-2ab8-49de-befa-0c5696f22b9d",
        "resourceType": "20",
        "viewType": "2",
        "topic": "Python Basics Quiz",
        "sessionMaterialIndex": "1",
        "time": "1782727715513"
      }
    ],
    "form": {
      "formId": "48224910-b860-478b-97ee-2fcb3b53c8e1_3000000000040",
      "formIdValue": "48224910-b860-478b-97ee-2fcb3b53c8e1",
      "sessionId": "3000000000040",
      "name": "Python Basics Quiz",
      "type": "3"
    },
    "test": {
      "formId": "48224910-b860-478b-97ee-2fcb3b53c8e1_3000000000040",
      "sessionId": "3000000000040",
      "name": "Python Basics Quiz",
      "totalQuestions": "0",
      "enableGrading": "false",
      "attemptsCount": "0"
    },
    "fields": []
  }
                
  {
    "error": {
      "code": "string",
      "codeStr": "string",
      "message": "string"
    }
  }
                
500 Request failed; see the error code.
▼ Show full