Content format

Survey uses JSON as a format for the content. It should be set in the tag "JsonContent". See examples below.


Input parameters

Message

Name

Description

Type

M/O

Description

Description shown for the survey

Text

M

RespondentType

If the survey should be non anonymous, anonymous or open for everybody. Available options:

  • NonAnonymous
  • Anonymous
  • ExternAnonymous

String

O (Default: NonAnonymous)

Questions

List of questions for the survey

List<Question>

O

 Question

Name

Description

Type

M/O

Text

The question text

Text

M

Type

Type of the question. Available options:

  • MultipleChoice
  • Matrix
  • Open
  • YesNo

String

M

MaxAlternativesToSelect

Maximum number of alternatives to select. 0 means any number is allowed

Number

O (Default: 1)

Alternatives

List of alternatives for the question

List<AlternativeOrMatrixRow>

O

MatrixRows

List of matrix rows for Matrix question

List<AlternativeOrMatrixRow>

O

 AlternativeOrMatrixRow

Name

Description

Type

M/O

Text

The text

Text

M

Content example

Create Extension Instance content
<JsonContent>
{
"Description": "This is survey description",
"RespondentType": "NonAnonymous",
"Questions": [
{
"Text": "My open question",
"Type": "Open"
},
{
"Text": "My yes/no question",
"Type": "YesNo"
},
{
"Text": "My multi-choice question with single answer",
"Type": "MultipleChoice",
"MaxAlternativesToSelect": 1,
"Alternatives": [{"Text": "First"}, {"Text": "Second"}, {"Text": "Third"}]
},
{
"Text": "My multi-choice question with multiple answers",
"Type": "MultipleChoice",
"MaxAlternativesToSelect": 0,
"Alternatives": [{"Text": "First"},{"Text": "Second"},{"Text": "Third"}]
},
{
"Text": "My matrix question",
"Type": "Matrix",
"Alternatives": [{"Text": "First column"}, {"Text": "Second column"}, {"Text": "Third column"}],
"MatrixRows": [{"Text": "First row"}, {"Text": "Second row"}, {"Text": "Third row"}]
}
]
}
</JsonContent>


Full request example

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tem="http://tempuri.org/"
xmlns:its="http://schemas.datacontract.org/2004/07/Itslearning.Integration.ContentImport.Services.Entities">
<soapenv:Header/>
<soapenv:Body>
<tem:AddMessage>
<!--Optional:-->
<tem:dataMessage>
<!--Optional:-->
<its:Data><![CDATA[<?xml version="1.0" encoding="utf-8"?>
<Message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:message-schema">
<CreateExtensionInstance>
<Location>Course</Location>
<ExtensionId>5050</ExtensionId>
<CourseId>9</CourseId>
<UserId>1</UserId>
<Title>This is a survey</Title>
<Content>
<JsonContent>
{
"Description": "This is survey description",
"RespondentType": "NonAnonymous",
"Questions": [
{
"Text": "My open question",
"Type": "Open"
},
{
"Text": "My yes/no question",
"Type": "YesNo"
},
{
"Text": "My multi-choice question with single answer",
"Type": "MultipleChoice",
"MaxAlternativesToSelect": 1,
"Alternatives": [{"Text": "First"}, {"Text": "Second"}, {"Text": "Third"}]
},
{
"Text": "My multi-choice question with multiple answers",
"Type": "MultipleChoice",
"MaxAlternativesToSelect": 0,
"Alternatives": [{"Text": "First"},{"Text": "Second"},{"Text": "Third"}]
},
{
"Text": "My matrix question",
"Type": "Matrix",
"Alternatives": [{"Text": "First column"}, {"Text": "Second column"}, {"Text": "Third column"}],
"MatrixRows": [{"Text": "First row"}, {"Text": "Second row"}, {"Text": "Third row"}]
}
]
}
</JsonContent>
</Content>
<ElementProperties>
<Active>true</Active>
</ElementProperties>
</CreateExtensionInstance>
</Message>
]]></its:Data>
<!--Optional:-->
<its:Type>37</its:Type>
</tem:dataMessage>
</tem:AddMessage>
</soapenv:Body>
</soapenv:Envelope>


Errors

  • Invalid content: Description is not defined
  • Invalid content: question text is not defined
  • Invalid content: question type is not defined
  • Invalid content: alternative text is not defined
  • Invalid content: matrix row text is not defined