Add a question from a description
limesurvey_add_question_from_specInsert one new question into a group of an inactive survey, described as a question spec (the format limesurvey_get_survey_spec returns at level question; every text is one string for all survey languages or a map per language).
Instructions
Insert one new question into a group of an inactive survey, described as a question spec (the format limesurvey_get_survey_spec returns at level question; every text is one string for all survey languages or a map per language). position is the 1-based place in the group, { before: code } or { after: code }; without it the question goes to the end. The spec is checked against the survey first (its languages; the code must be free in the whole survey, case ignored): SPEC_INVALID, CODE_CONFLICT, SURVEY_ACTIVE, GROUP_SURVEY_MISMATCH and POSITION_INVALID write nothing. The question is imported (import_question) and only the new question is moved to its place; no other question is changed. It is then read back and compared with the spec. Returns { survey_id, group_id, question_id, code, position { index }, verification { ok, differences, differences_total, truncated }, side_effects, warnings }; a difference is a finding, not an error. import_question fills every text of the survey that has no row in an additional language with the base-language text, which cannot be undone: if the survey has such gaps, the tool answers TRANSLATION_GAPS (the gaps with path, language and question or group) and writes nothing, unless acknowledge contains fill_translation_gaps; side_effects then lists the filled gaps (paths as after the insertion). If a step after the import fails, the new question is deleted again (nothing else) and ADD_QUESTION_FAILED reports failed_step, rolled_back, manual_cleanup and cause_code. If the outcome of the import itself is unknown (lost answer, an error after the creation), nothing is deleted: created is "unknown" and candidates and cleanup_hint say what to check. An active survey is refused. A whole group goes with limesurvey_add_group_from_spec. A Ranking question makes the tool read the LimeSurvey generation once (entries as subquestions on 7, as answers on 6). Needs the write scope content.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| group_id | Yes | ID of the group of this survey that gets the question. | |
| position | No | 1-based place in the group, { before: code } or { after: code }; default: the end of the group. | |
| question | Yes | The new question as a question spec, for example the spec of limesurvey_get_survey_spec at level question with a new code. | |
| survey_id | Yes | Numeric LimeSurvey survey ID. | |
| acknowledge | No | Confirmed risks. fill_translation_gaps: the import may fill texts of the survey that have no row in an additional language with the base-language text (otherwise such gaps answer TRANSLATION_GAPS). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes | ||
| workflow | Yes |