SurveyQuestionsFieldname
in package
implements
CommandInterface
Table of Contents
Interfaces
Properties
Methods
- __construct() : mixed
- Constructor
- run() : Response
- Run survey questions fieldname command.
Properties
$app
protected
LSYii_Application
$app
$permission
protected
Permission
$permission
$responseFactory
protected
ResponseFactory
$responseFactory
Methods
__construct()
Constructor
public
__construct(LSYii_Application $app, Permission $permission, ResponseFactory $responseFactory) : mixed
Parameters
- $app : LSYii_Application
- $permission : Permission
- $responseFactory : ResponseFactory
run()
Run survey questions fieldname command.
public
run(Request $request) : Response
Supports GET requests with the survey ID (sid) at the end of the endpoint,
looking like: rest/v1/survey-questions-fieldname/571271
This endpoint returns a structured mapping of fieldnames for all relevant questions in the survey.
Filtering rules:
- Only fields whose code starts with "Q" are included.
- Fields containing "comment" in their fieldname are excluded.
- Fields containing "filecount" in their fieldname are excluded.
Response structure: The response is a JSON object keyed by question ID, where each value is an array of field definitions containing:
-
fieldname(string) — The internal field name. -
sid(string|int) — Survey ID. -
gid(string|int) — Group ID. -
qid(string|int) — Question ID. -
sqid(string|int|null) — Subquestion ID (nullable). -
aid(string) — Answer ID. -
title(string) — Question title/code. -
scale_id(string|int|null) — Scale ID (nullable).
Example response: { "135": [ { "fieldname": "Q135", "sid": "571271", "gid": "1", "qid": "135", "sqid": null, "aid": null, "title": "Q033", "scale_id": null } ] }
Parameters
- $request : Request
-
Request object containing survey ID.
Return values
Response —JSON response with the structured fieldname mapping.