Create a new person template question.

Use a bare-bones client and the command you need to make an API call.

import { Apiv2Client, PutPearsonQuestionCommand } from "@codegrade/apiv2-client"; // ES Modules import
// const { Apiv2Client, PutPearsonQuestionCommand } = require("@codegrade/apiv2-client"); // CommonJS import
const client = new Apiv2Client(config);
const input = { // PutPearsonQuestionRequest
tenantId: "STRING_VALUE", // required
templateId: "STRING_VALUE", // required
questionId: "STRING_VALUE", // required
name: "STRING_VALUE", // required
source: { // PutPearsonQuestionSource Union: only one key present
coding: { // PutPearsonCodingQuestionSource
assignmentId: Number("int"), // required
},
multipleChoice: { // PearsonMultipleChoiceQuestionData
question: "STRING_VALUE", // required
answers: [ // PearsonMultipleChoiceQuestionAnswers // required
{ // PearsonMultipleChoiceQuestionAnswer
answer: "STRING_VALUE", // required
isCorrect: true || false,
hint: "STRING_VALUE",
},
],
answerOrder: "index-order" || "random-order",
},
selectAll: { // PearsonSelectAllQuestionData
question: "STRING_VALUE", // required
answers: [ // PearsonSelectAllQuestionAnswers // required
{ // PearsonSelectAllQuestionAnswer
answer: "STRING_VALUE", // required
isCorrect: true || false,
hints: { // PearsonSelectAllQuestionAnswerHints
correct: "STRING_VALUE",
incorrect: "STRING_VALUE",
},
},
],
answerOrder: "index-order" || "random-order",
},
},
};
const command = new PutPearsonQuestionCommand(input);
const response = await client.send(command);
// { // PutPearsonQuestionResponse
// questionId: "STRING_VALUE", // required
// };

PutPearsonQuestionCommandInput

InternalServerError (server fault) An internal failure at the fault of the server.

BadRequestError (client fault) An error at the fault of the client sending invalid input.

NotFoundError (client fault) An error due to the client attempting to access a missing resource.

NotAuthorizedError (client fault) An error due to the client not being authorized to access the resource.

NotAuthenticatedError (client fault) An error due to the client not being authenticated.

ValidationError (client fault) A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.

Apiv2ServiceException

Base exception class for all service exceptions from Apiv2 service.

//
const input = {
name: "The name of the MCQ step",
questionId: "question-id",
source: {
multipleChoice: {
answerOrder: "index-order",
answers: [
{
answer: "An option, text in markdown.",
hint: "Read the answer to find out which one is correct"
},
{
answer: "The correct answer, must be given exactly once.",
isCorrect: true
}
],
question: "The question text in markdown"
}
},
templateId: "template-id",
tenantId: "tenant-id"
};
const command = new PutPearsonQuestionCommand(input);
const response = await client.send(command);
/* response is
{ /* metadata only */ }
*/
//
const input = {
name: "The name of the Select All Question step",
questionId: "question-id",
source: {
selectAll: {
answerOrder: "random-order",
answers: [
{
answer: "Option 1, this one is correct",
isCorrect: true
},
{
answer: "Option 2, this one is wrong",
isCorrect: false
},
{
answer: "Option 3, this one is also correct",
isCorrect: true
}
],
question: "The question text in markdown"
}
},
templateId: "template-id",
tenantId: "tenant-id"
};
const command = new PutPearsonQuestionCommand(input);
const response = await client.send(command);
/* response is
{ /* metadata only */ }
*/

Hierarchy

Constructors

  • Returns PutPearsonQuestionCommand

  • Parameters

    Returns PutPearsonQuestionCommand

Properties

middlewareStack: MiddlewareStack<
    PutPearsonQuestionCommandInput,
    PutPearsonQuestionCommandOutput,
>
schema?: OperationSchema

This should be OperationSchema from @smithy/types, but would create problems with the client transform type adaptors.

__types: {
    api: {
        input: PutPearsonQuestionRequest;
        output: PutPearsonQuestionResponse;
    };
    sdk: {
        input: PutPearsonQuestionCommandInput;
        output: PutPearsonQuestionCommandOutput;
    };
}

type navigation helper, not in runtime.

Methods

  • Internal

    Parameters

    • clientStack: MiddlewareStack<any, any>
    • configuration: { logger: Logger; requestHandler: RequestHandler<any, any, any> }
    • options: any
    • __namedParameters: ResolveMiddlewareContextArgs

    Returns InitializeHandler<any, PutPearsonQuestionCommandOutput>

  • Returns EndpointParameterInstructions