Add questions to 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

Adds up to 15 questions to a test in a course lesson. The path formId is the test's form UUID from List Course Tests.

Endpoint

post https://{TrainerCentral-API-Domain}/tc/api/v1/trainer/session/{sessionId}/form/{formUuid}/fields.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 (sessionId) that holds the test.

Example
21603000000354002
formUuidstring(Required)

Form UUID of the test (the part of tests[].formId before the underscore), not the test id.

Example
7305cb9e-3913-49d7-8cb9-eebd159f5281

Query Parameters

typestring(Required)

Form type. Allowed: 3=Test.

Example
3

Request Body

application/json
fieldJSON Array(Required)

Questions to add, 1-15 items.

Hide Sub-Attributes
JSON Object
Show Sub-Attributes
labelstring(Required)

Question text. Supports rich text.

fieldTypeinteger(Required)

Question type. Allowed: 2=Choice, 7=True or false, 8=Fill in the blank, 16=Essay. Send the matching multipleChoice, fillInBlank or essay object.

scoreinteger(Optional)

Marks for a correct answer (1-50); 0 when not sent.

isMandatoryboolean(Optional)

true when the learner must answer the question. Default false.

multipleChoiceJSON Object(Optional)

Options of a Choice or True or false question (fieldType 2, 7).

Show Sub-Attributes
selectionTypeinteger(Required)

Allowed: 0=Single answer, 1=Multiple answers (Choice only). Send 0 for True or false.

fieldOptionsJSON Array(Required)

Answer options, 1-25 items (two for True or false).

Show Sub-Attributes
JSON Object
Show Sub-Attributes
orderIndexinteger(Required)

Position of the option or blank, from 0.

optionTypeinteger(Optional)

Choice only. Content type of optionText. Allowed: 0=Text, 1=Image. Default 0.

optionTextstring(Required)

Option text, accepted blank answer, or essay reference answer.

correctAnswerboolean(Optional)

true marks a correct option (Choice, True or false). Default false.

fillInBlankJSON Object(Optional)

Accepted answers of a Fill in the blank question (fieldType 8).

Show Sub-Attributes
fieldOptionsJSON Array(Required)

Accepted answer of each blank, 1-25 items, in blank order.

Show Sub-Attributes
JSON Object
Show Sub-Attributes
orderIndexinteger(Required)

Position of the option or blank, from 0.

optionTypeinteger(Optional)

Choice only. Content type of optionText. Allowed: 0=Text, 1=Image. Default 0.

optionTextstring(Required)

Option text, accepted blank answer, or essay reference answer.

correctAnswerboolean(Optional)

true marks a correct option (Choice, True or false). Default false.

essayJSON Object(Optional)

Essay settings (fieldType 16); send at least an empty object.

Show Sub-Attributes
fieldOptionsJSON Array(Optional)

Optional reference answers for the evaluating trainer.

Show Sub-Attributes
JSON Object
Show Sub-Attributes
orderIndexinteger(Required)

Position of the option or blank, from 0.

optionTypeinteger(Optional)

Choice only. Content type of optionText. Allowed: 0=Text, 1=Image. Default 0.

optionTextstring(Required)

Option text, accepted blank answer, or essay reference answer.

correctAnswerboolean(Optional)

true marks a correct option (Choice, True or false). Default false.

isCaseSensitiveboolean(Optional)

Fill in the blank only. true makes answers case sensitive. Default false.

textLengthinteger(Optional)

Essay only. Maximum answer length (1-10000). Default 5000.

textCountTypeinteger(Optional)

Essay only. Unit of textLength. Allowed: 0=Characters, 1=Words. Default 0.

enableFeedbackboolean(Optional)

true shows feedback to the learner. Default false.

feedbackJSON Object(Optional)

Feedback texts; required when enableFeedback is true.

Show Sub-Attributes
typeinteger(Optional)

Feedback mode. Allowed: 0=Same for any answer, 1=Correct and incorrect (dataList[0], dataList[1]), 2=Per option.

dataListarray(Optional)

Feedback texts in the order type needs. Supports rich text.

Request Example

cURL
cURL
Java
Python
Deluge
Copied!
curl --request POST \
  --url 'https://trainercentral.zoho.com/tc/api/v1/trainer/session/21603000000354002/form/7305cb9e-3913-49d7-8cb9-eebd159f5281/fields.json?type=3' \
  --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' \
  --header 'content-type: application/json' \
  --header 'tc-orgId: 51517414' \
  --data '{"field":[{"label":"Which metric best measures recurring revenue growth for a SaaS business?","fieldType":2,"score":5,"isMandatory":true,"multipleChoice":{"selectionType":0,"fieldOptions":[{"orderIndex":0,"optionType":0,"optionText":"Customer acquisition cost (CAC)","correctAnswer":false},{"orderIndex":1,"optionType":0,"optionText":"Monthly recurring revenue (MRR)","correctAnswer":true},{"orderIndex":2,"optionType":0,"optionText":"Employee headcount","correctAnswer":false},{"orderIndex":3,"optionType":0,"optionText":"Office lease cost","correctAnswer":false}]},"enableFeedback":true,"feedback":{"type":1,"dataList":["<p>Correct. MRR tracks predictable recurring revenue over time.</p>","<p>Incorrect. MRR is the standard SaaS growth measure.</p>"]}}]}'

Body Parameters

Single-answer Choice question with feedback.

Single-answer Choice question with feedback.

Multiple-answer Choice question.

True or false question.

Fill in the blank question with two blanks.

Essay question limited to 300 words.

Copied!
  {
    "field": [
      {
        "label": "Which metric best measures recurring revenue growth for a SaaS business?",
        "fieldType": 2,
        "score": 5,
        "isMandatory": true,
        "multipleChoice": {
          "selectionType": 0,
          "fieldOptions": [
            {
              "orderIndex": 0,
              "optionType": 0,
              "optionText": "Customer acquisition cost (CAC)",
              "correctAnswer": false
            },
            {
              "orderIndex": 1,
              "optionType": 0,
              "optionText": "Monthly recurring revenue (MRR)",
              "correctAnswer": true
            },
            {
              "orderIndex": 2,
              "optionType": 0,
              "optionText": "Employee headcount",
              "correctAnswer": false
            },
            {
              "orderIndex": 3,
              "optionType": 0,
              "optionText": "Office lease cost",
              "correctAnswer": false
            }
          ]
        },
        "enableFeedback": true,
        "feedback": {
          "type": 1,
          "dataList": [
            "<p>Correct. MRR tracks predictable recurring revenue over time.</p>",
            "<p>Incorrect. MRR is the standard SaaS growth measure.</p>"
          ]
        }
      }
    ]
  }
                
  {
    "field": [
      {
        "label": "Which of the following are key parts of a business plan? Select all that apply.",
        "fieldType": 2,
        "score": 5,
        "isMandatory": true,
        "multipleChoice": {
          "selectionType": 1,
          "fieldOptions": [
            {
              "orderIndex": 0,
              "optionType": 0,
              "optionText": "Executive summary",
              "correctAnswer": true
            },
            {
              "orderIndex": 1,
              "optionType": 0,
              "optionText": "Market analysis",
              "correctAnswer": true
            },
            {
              "orderIndex": 2,
              "optionType": 0,
              "optionText": "Office furniture inventory",
              "correctAnswer": false
            },
            {
              "orderIndex": 3,
              "optionType": 0,
              "optionText": "Financial projections",
              "correctAnswer": true
            }
          ]
        }
      }
    ]
  }
                
  {
    "field": [
      {
        "label": "A break-even analysis shows when total revenue equals total costs.",
        "fieldType": 7,
        "score": 2,
        "isMandatory": true,
        "multipleChoice": {
          "selectionType": 0,
          "fieldOptions": [
            {
              "orderIndex": 0,
              "optionText": "True",
              "correctAnswer": true
            },
            {
              "orderIndex": 1,
              "optionText": "False",
              "correctAnswer": false
            }
          ]
        }
      }
    ]
  }
                
  {
    "field": [
      {
        "label": "The [A] statement summarizes revenue and expenses over a period, while the [B] sheet shows assets and liabilities at a point in time.",
        "fieldType": 8,
        "score": 4,
        "isMandatory": true,
        "isCaseSensitive": false,
        "fillInBlank": {
          "fieldOptions": [
            {
              "orderIndex": 0,
              "optionText": "income"
            },
            {
              "orderIndex": 1,
              "optionText": "balance"
            }
          ]
        },
        "enableFeedback": true,
        "feedback": {
          "type": 0,
          "dataList": [
            "<p>Income statement = performance over a period; balance sheet = position at a point in time.</p>"
          ]
        }
      }
    ]
  }
                
  {
    "field": [
      {
        "label": "Explain why cash flow management is critical for small businesses in their first year.",
        "fieldType": 16,
        "score": 10,
        "isMandatory": true,
        "textLength": 300,
        "textCountType": 1,
        "essay": {
          "fieldOptions": [
            {
              "orderIndex": 0,
              "optionText": "Positive cash flow lets the business pay suppliers, salaries and running costs on time even when profits look healthy on paper."
            }
          ]
        }
      }
    ]
  }
                
▼ Show full

Response Parameters

fieldsJSON Array

Questions added (Add), or the renumbered questions after the deleted one (Delete).

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.

multipleChoiceJSON Array

Type objects of the returned Choice and True or false questions.

Hide Sub-Attributes
JSON Object
Show Sub-Attributes
idstring

ID of the type object.

fieldstring

ID of the question (fields[].id).

formIdstring

Test form id (formUuid_sessionId); the part before the underscore is the form UUID.

selectionTypestring

Choice and True or false only. Allowed: 0=Single answer, 1=Multiple answers.

fillInBlankJSON Array

Type objects of the returned Fill in the blank questions.

Hide Sub-Attributes
JSON Object
Show Sub-Attributes
idstring

ID of the type object.

fieldstring

ID of the question (fields[].id).

formIdstring

Test form id (formUuid_sessionId); the part before the underscore is the form UUID.

selectionTypestring

Choice and True or false only. Allowed: 0=Single answer, 1=Multiple answers.

essayJSON Array

Type objects of the returned Essay questions.

Hide Sub-Attributes
JSON Object
Show Sub-Attributes
idstring

ID of the type object.

fieldstring

ID of the question (fields[].id).

formIdstring

Test form id (formUuid_sessionId); the part before the underscore is the form UUID.

selectionTypestring

Choice and True or false only. Allowed: 0=Single answer, 1=Multiple answers.

fieldOptionJSON Array

Options of all returned questions; match each to its question by fieldId.

Hide Sub-Attributes
JSON Object
Show Sub-Attributes
idstring

ID of the option.

fieldOptionIdstring

Same as id.

fieldIdstring

ID of the question (fields[].id).

formIdstring

Test form id (formUuid_sessionId).

optionTextstring

Option text, accepted blank answer, or essay reference answer.

optionTypestring

Choice only. Content type of optionText. Allowed: 0=Text, 1=Image.

orderIndexstring

Position of the option or blank, from 0.

correctAnswerstring

true when this option is correct (Choice, True or false).

multipleChoicestring

ID of the parent multipleChoice object.

fillInBlankstring

ID of the parent fillInBlank object.

essaystring

ID of the parent essay object.

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, or type is not 3. Use an academy owner, admin, course trainer or lesson owner and type=3; do not retry unchanged.

ST_406

FEATURE_NOT_AVAILABLE - The free plan cannot add test questions, or field or type is missing. Upgrade the plan, or send field and type=3; do not retry unchanged.

ST_559

ERROR_WHILE_CREATING_CUSTOM_FIELD_FOR_SESSION - No test with this form UUID in the lesson, or a question misses its type object or feedback. Fix formId or the question; do not retry unchanged.

Response Example

One Choice question added.

200
200
400
500
Copied!
  {
    "fields": [
      {
        "id": "d4ebb48b-fea8-4260-8879-da6e839e25ba",
        "formId": "7305cb9e-3913-49d7-8cb9-eebd159f5281_21603000000354002",
        "form": "7305cb9e-3913-49d7-8cb9-eebd159f5281_21603000000354002",
        "label": "Which metric best measures recurring revenue growth for a SaaS business?",
        "fieldType": "2",
        "score": "5",
        "isMandatory": "true",
        "isUnique": "false",
        "orderIndex": "2",
        "preDefinedFieldId": "0",
        "evaluationType": "0",
        "evaluationData": "",
        "enableFeedback": "true",
        "feedback": {
          "type": "1",
          "dataList": [
            "<p>Correct. MRR tracks predictable recurring revenue over time.</p>",
            "<p>Incorrect. MRR is the standard SaaS growth measure.</p>"
          ]
        }
      }
    ],
    "multipleChoice": [
      {
        "id": "5b7d2c1e-8f3a-4d6b-9c2e-1a4f6e8b0c3d",
        "field": "d4ebb48b-fea8-4260-8879-da6e839e25ba",
        "formId": "7305cb9e-3913-49d7-8cb9-eebd159f5281_21603000000354002",
        "selectionType": "0"
      }
    ],
    "fieldOption": [
      {
        "id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c50",
        "fieldOptionId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c50",
        "fieldId": "d4ebb48b-fea8-4260-8879-da6e839e25ba",
        "formId": "7305cb9e-3913-49d7-8cb9-eebd159f5281_21603000000354002",
        "multipleChoice": "5b7d2c1e-8f3a-4d6b-9c2e-1a4f6e8b0c3d",
        "optionText": "Customer acquisition cost (CAC)",
        "optionType": "0",
        "orderIndex": "0",
        "correctAnswer": "false"
      },
      {
        "id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c51",
        "fieldOptionId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c51",
        "fieldId": "d4ebb48b-fea8-4260-8879-da6e839e25ba",
        "formId": "7305cb9e-3913-49d7-8cb9-eebd159f5281_21603000000354002",
        "multipleChoice": "5b7d2c1e-8f3a-4d6b-9c2e-1a4f6e8b0c3d",
        "optionText": "Monthly recurring revenue (MRR)",
        "optionType": "0",
        "orderIndex": "1",
        "correctAnswer": "true"
      },
      {
        "id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c52",
        "fieldOptionId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c52",
        "fieldId": "d4ebb48b-fea8-4260-8879-da6e839e25ba",
        "formId": "7305cb9e-3913-49d7-8cb9-eebd159f5281_21603000000354002",
        "multipleChoice": "5b7d2c1e-8f3a-4d6b-9c2e-1a4f6e8b0c3d",
        "optionText": "Employee headcount",
        "optionType": "0",
        "orderIndex": "2",
        "correctAnswer": "false"
      },
      {
        "id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c53",
        "fieldOptionId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c53",
        "fieldId": "d4ebb48b-fea8-4260-8879-da6e839e25ba",
        "formId": "7305cb9e-3913-49d7-8cb9-eebd159f5281_21603000000354002",
        "multipleChoice": "5b7d2c1e-8f3a-4d6b-9c2e-1a4f6e8b0c3d",
        "optionText": "Office lease cost",
        "optionType": "0",
        "orderIndex": "3",
        "correctAnswer": "false"
      }
    ]
  }
                
  {
    "error": {
      "code": "string",
      "codeStr": "string",
      "message": "string"
    }
  }
                
500 Request failed; see the error code.
▼ Show full

Rate Limits

Duration1 minute
Threshold30

Duration - Time window for the threshold.
Threshold - Number of API calls allowed within the specified duration.
Lock Period - Wait time before consecutive API requests.