Overview
Surveys allow community administrators to collect feedback and opinions from residents. Each survey can contain multiple questions of different types.Question Types
Surveys support different question types:tipoPregunta = 0: Multiple choicetipoPregunta = 1: Text responsetipoPregunta = 2: Rating scale
Get All Surveys
Get Surveys by Community
communityId(guid, required): Community ID
Get Survey by ID
id(guid, required): Survey ID
404 Not Found: Survey not found
Create Survey
communityId(guid, required): Community IDtitulo(string, required): Survey titledescripcion(string, required): Survey descriptionfechaInicio(datetime, required): Survey start datefechaFin(datetime, required): Survey end dateisActive(boolean, optional): Default: truepreguntas(array, optional): List of questions to include
tipoPregunta(integer, required): Question type (0: multiple choice, 1: text, 2: rating)pregunta(string, required): Question textopciones(array of strings, optional): Available options for multiple choice questions
201 Created
Error Responses:
400 Bad Request: Invalid data or validation error
Update Survey
id(guid, required): Survey ID
404 Not Found: Survey not found400 Bad Request: Invalid data or validation error
Delete Survey
id(guid, required): Survey ID
204 No Content
Error Responses:
404 Not Found: Survey not found
Submit Survey Responses
id(guid, required): Survey ID
respuestas(array, required): List of responsespreguntaId(guid, required): Question ID from the surveyrespuesta(string, required): The resident’s answer
204 No Content
Error Responses:
400 Bad Request: Invalid data, survey not active, or user is not registered as a resident401 Unauthorized: User is not authenticated
- Each resident can only submit responses once per survey
- The survey must be active and within the date range (between
fechaInicioandfechaFin) - For multiple choice questions, the response should match one of the available options
- For text questions, any string response is accepted
- The resident ID is automatically extracted from the authenticated user’s JWT token
Survey Object Schema
| Field | Type | Description |
|---|---|---|
id | guid | Unique identifier for the survey |
communityId | guid | Community ID |
communityName | string | Name of the community (populated from community data) |
titulo | string | Survey title |
descripcion | string | Survey description |
fechaInicio | datetime | Survey start date |
fechaFin | datetime | Survey end date |
isActive | boolean | Whether the survey is active |
createdAt | string | ISO date string for creation time |
updatedAt | string | ISO date string for last update time (optional) |
preguntas | array | Array of question objects |
Question Object Schema
| Field | Type | Description |
|---|---|---|
id | guid | Unique identifier for the question |
tipoPregunta | integer | Question type (0: multiple choice, 1: text, 2: rating) |
pregunta | string | Question text |
opciones | array | Array of option strings (for multiple choice questions) |