Add a group from a description
limesurvey_add_group_from_specInsert one new group with its questions into an inactive survey, described as a group spec (the format limesurvey_get_survey_spec returns at level group; every text is one string for all survey languages or a map per language).
Instructions
Insert one new group with its questions into an inactive survey, described as a group spec (the format limesurvey_get_survey_spec returns at level group; every text is one string for all survey languages or a map per language). position is the 1-based place among the groups, { before: group_id } or { after: group_id }; without it the group goes to the end. The spec is checked against the survey first (its languages; every question code must be free in the whole survey, case ignored, because the import would rename it silently): SPEC_INVALID, CODE_CONFLICT, SURVEY_ACTIVE and POSITION_INVALID write nothing. The group is imported (import_group) with exactly the survey languages and only the new group is moved to its place; no other group is changed. It is then read back and compared with the spec. Returns { survey_id, group_id, position { index }, questions [{ code, question_id }], verification { ok, differences, differences_total, truncated }, side_effects, warnings }; a difference is a finding, not an error. If a step after the import fails, the new group is deleted again (nothing else) and ADD_GROUP_FAILED reports failed_step, rolled_back, manual_cleanup and cause_code. If the outcome of the import itself is unknown (lost answer, an unexpected answer), nothing is deleted: created is "unknown" and candidates and cleanup_hint say what to check. The .lsg import fills no translation gaps. An active survey is refused. A single question goes with limesurvey_add_question_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 | Yes | The new group as a group spec { title, description, relevance, randomization_group, questions }. | |
| position | No | 1-based place among the groups, { before: group_id } or { after: group_id }; default: the end. | |
| survey_id | Yes | Numeric LimeSurvey survey ID. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes | ||
| workflow | Yes |