Surveys

Introduction

Surveys are used to collect feedback, opinions, or information from Users and Departments.

The possible answer options for a survey are defined in the SurveyAnswerOptions, while the SurveyVotes represent the votes submitted by users.

Surveys can either be targeted to specific Users or Departments or to a targetable entity

Model Definition

Alias

survey

Relations

Key
Relation
Type
Relation Field(s)

user

Belongs to

user_id

folder

Belongs to

folder_id

targetable

Morph to

targetable_id, targetable_type

departments

Belongs to many

department_survey

users

Belongs to many

survey_user

surveyAnswerOptions

Has many

survey_answer_option.survey_id

surveyVotes

Has many

survey_votes.survey_id

currentVote

Has one

survey_votes.survey_id, survey_votes.department_id, survey_votes.user_id

sharedItems

Has many

Computed Properties

  • hash - The hashed id of the Survey.

  • url - The URL to view the Survey.

Traits

Targetable Types

  • chatMessage - A Survey targeted to a ChatMessage.

  • infoboardPost - A Survey targeted to a InfoboardPost.

  • manualEntry - A Survey targeted to a ManualEntry.

Survey Types

Show Votes Types

The show_votes_type specifies when the user can view the results of the Survey.

  • none – Never.

  • always – Always.

  • after_vote – After submitting their vote.

  • after_survey_end – After the Survey has ended.

Appends

The following appends can be applied to all Surveys:

answer_options_summary

Adds a node answer_options_summary to the response, which shows the total number of SurveyVotes for each SurveyAnswerOption of the Survey.

Example Response

List

Get a list of all Surveys for the authenticated user.

Definition

GET /api/surveys

Example Request

Example Response

Show

Show a single Survey by id.

Definition

GET /api/surveys/{id}

Example Request

Example Response

[Adm.] List

Get a list of all Surveys.

Definition

GET /api/administration/surveys

Example Request

Example Response

[Adm.] Show

Show a single Survey by id.

Definition

GET /api/administration/surveys/{id}

Example Request

Example Response

Create

Create a new Survey.

Definition

POST /api/administration/surveys

Request Keys

Key
Type
Default
Description

title *

string

-

The title of the Survey.

description

string

-

The description of the Survey.

type *

string

-

The Type of the Survey.

folder_id

integer

-

The ID of the folder in which the Survey should be organized in the administration.

active

boolean

false

Controls the visibility of the survey for participants.

show_votes_type

string

none

The Show Votes Type of the Survey.

assign_mode

string

-

The assign mode of the Survey.

user_ids

array

-

Users who can participate in the survey.

department_ids

array

-

Departments who can participate in the survey.

user_confirmation_required

boolean

false

The user must confirm if logged in with a group account. Voting with group accounts is then no longer possible.

one_vote_per_department

boolean

false

Only one vote can be cast per Department.

anonymous

boolean

false

Whether SurveyVotes are shown to other participants.

start_date

datetime

-

The start date of the Survey.

end_date

datetime

-

The end day of the Survey.

sort_number

integer

Current highest +1

The index of the Survey related to the Folder.

Keys with * are required.

Example Request

Example Response

Update

Update an existing Survey by id.

circle-info

If a survey contains SurveyVotes, editing is restricted to only those fields that are still allowed to be changed. Further editing is only possible after a reset of the Survey.

Definition

PUT /api/administration/surveys/{id}

Request Keys

Key
Type
Description

title *

string

The title of the Survey.

description *

string

The description of the Survey.

type *

string

The Type of the Survey.

folder_id

integer

The ID of the folder in which the Survey should be organized in the administration.

active

boolean

Controls the visibility of the survey for participants.

show_votes_type

string

The Show Votes Type of the Survey.

assign_mode

string

The assign mode of the Survey.

user_ids

array

Users who can participate in the survey.

department_ids

array

Departments who can participate in the survey.

user_confirmation_required *

boolean

The user must confirm if logged in with a group account. Voting with group accounts is then no longer possible.

one_vote_per_department *

boolean

Only one vote can be cast per Department.

anonymous *

boolean

Whether SurveyVotes are shown to other participants.

start_date *

datetime

The start date of the Survey.

end_date

datetime

The end day of the Survey.

sort_number

integer

The index of the Survey related to the Folder.

  • Keys with * can no longer be edited after at least one vote has been submitted.

Example Request

Example Response

Reset

Reset an existing Survey by id.

circle-exclamation

Definition

PUT /api/administration/surveys/{id}

Example Request

Example Response

Delete

Delete an existing Survey by id.

Definition

DELETE /api/administration/surveys/{id}

Example Request

Example Response

Last updated