corporateacademy-survey

Methods

(static) addOrUpdateSurveyRandomGroupQuestionsLimit(surveyId, groupsQuestionLimit, token) → {boolean}

Creates or updates the attributes which control the number of questions that will be selected from each survey group, every time a user starts a randomized survey

Parameters:
Name Type Description
surveyId string

Required: Id of the survey to which the group structures are linked

groupsQuestionLimit Array.<KeyValue.<number>>

Required: Array of key-value object where the key is the group's surveyStructureId and the value is the number of questions to select when creating a randomized survey

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/add-or-update-survey-random-group-questions-limit
Returns:

Returns true if no errors were thrown

Type
boolean

(static) createSurveyItem(title, subTitle, description, externalLinks, itemType, draftOnly, token) → {string}

Function that create

Parameters:
Name Type Description
title string

Required by the action: The name in Kaltura

subTitle string

Optional by the action: The subtitle of the item

description string

Optional by the action: The description of the item

externalLinks Array.<string>

Optional by the action: The list of the external Link

itemType string

Optional for the action: The item type

draftOnly boolean

Optional for the action: If true the document is saved as draft and it will not be active

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/create-survey-item
Returns:

The attachmentId of the attachment

Type
string

(static) createSurveyTemplateFromMultipleTemplates(surveyTemplateIds, surveyTemplates, questionsPerGroupsOfOriginalTemplates, newTemplateQuestionsPerPage, titles, pageTitles, groupTitles, referenceType, referenceId, token) → {Survey}

Create a new survey template starting from multiple templates passed. The new survey could be limited in questions per each original template. The resulting template will be created with a fixed structure: one group per page with the defined number of questions, the number of pages is calculated upon the number of questions inserted. The title of pages and goups are the text passed followed by a number. WARNING: this service behave correctly regarding the passed/not passed (minimum score) only if all questions in all templates are idempotent (e.g.: all non-open question with one single correct answer that score 1), because the minimum score is correlated with the number of question taken in account. WARNING: Same id passed more than once will be considered to be present one time only WARNING: Survey awards is skipped

Parameters:
Name Type Description
surveyTemplateIds Array.<string>

Required by the action: The id of survey templates to merge (alternative for surveyTemplates)

surveyTemplates Array.<Survey>

Required by the action: The survey templates to merge (alternative for surveyTemplateIds)

questionsPerGroupsOfOriginalTemplates number

Required by the action: The number of questions to take from every group of every template

newTemplateQuestionsPerPage number

Required by the action: The number of questions to insert in every page (one group per page) of the new tamplate

titles Array.<SurveyLang>

Required by the action: The title of the survey in all languages required

pageTitles Array.<SurveyStructureLang>

Required by the action: The title of the page in all languages required

groupTitles Array.<SurveyStructureLang>

Required by the action: The title of the group in all languages required

referenceType string

Optional for the action: Pass it if this new survey is related to another object

referenceId string

Optional for the action: Pass it if this new survey is related to another object

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/create-survey-template-from-multiple-templates
Returns:

The new survey template object

Type
Survey

(static) deleteSurveyTemplate(referenceId, token)

Logically delete a template of a survey

Parameters:
Name Type Description
referenceId string

Required by the action: Id object that it is attached to the template

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP DELETE /rest-api/corporateacademy-mediator/delete-survey-template
Returns:

null

(static) getFlatSurveyBySurveyid(surveyId) → {Array.<Survey>}

Get the survey as flat data by its id

Parameters:
Name Type Description
surveyId string

Required by the action: The survey template id

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/get-flat-survey-by-surveyId/:surveyId
Returns:

The modified survey object

Type
Array.<Survey>

(static) getSurveyBySurveyid(surveyId) → {Survey}

Get the survey data by its id

Parameters:
Name Type Description
surveyId string

Required by the action: The survey template id

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/get-survey-by-surveyId/:surveyId
Returns:

The modified survey object

Type
Survey

(static) getSurveys(referenceId, userId, startIfNotStarted, token) → {Array.<Survey>}

Get user's surveys by its referecnced object id

Parameters:
Name Type Description
referenceId string

Required by the action: referenceId of the linked Survey

userId string

Required: Id of the user who wants to confirm his participation to an edition

startIfNotStarted boolean

Optional by the action: if true and if the Survey is 'VALID', it starts the Survey

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/get-surveys/:referenceId
Returns:

The modified survey object

Type
Array.<Survey>

(static) getSurveysTemplateByReferenceId(surveyId, referenceId, token) → {Survey}

Get the survey template

Parameters:
Name Type Description
surveyId string

Required by the action: The survey id

referenceId string

Required by the action: referenceId dell'oggetto collegato

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP GET /rest-api/corporateacademy-mediator/get-surveys-template-by-reference-id/:referenceId
Returns:

The modified survey object

Type
Survey

(static) updateSurvey(survey, closeSurvey, itemId) → {Survey}

Get the survey as flat data by its id

Parameters:
Name Type Description
survey Survey

Required by the action: The survey object with alla relevant data set

closeSurvey boolean

Optional by the action: If true, it closes the Survey after the upload

itemId string

Required for the action: The item id of the linked Survey

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/update-survey
Returns:

The modified created survey object

Type
Survey

(static) uploadSurveyTemplate(form, referenceType, referenceId, surveyType, useCustomGroups, token) → {Upload}

Retrieve file data and send it to core for upload

Parameters:
Name Type Description
form Form

form data with file data

referenceType string

Required by the action

referenceId string

Required by the action

surveyType string

Required by the action: The type of the survey

useCustomGroups boolean

Optional: If true, the survey will be generated using the custom groups names defined in the file

token string

Required: the Authorization Bearer token passed in the Header of the request

Listens to Events:
  • event:HTTP POST /rest-api/corporateacademy-mediator/upload-survey-template
Returns:

Retrieved file's information with URL

Type
Upload