SurveyAnswerOptions

Introduction

SurveyAnswerOptions represent the selectable answer choices for a Survey. Answer options can be sorted and are protected from modification if the survey already has SurveyVotes.

Model Definition

Alias

surveyAnswerOption

Relations

Key
Relation
Type
Relation Field(s)

user

Belongs to

user_id

survey

Belongs to

survey_id

List by Survey

Get a list of all SurveyAnswerOptions for a given Survey and the authenticated user.

Definition

GET /api/surveys/{survey}/answer-options

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/surveys/1/answer-options', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

[
  {
    "id": 1,
    "user_id": 2,
    "survey_id": 1,
    "lang_id": "en-US",
    "title": "Very satisfied",
    "sort_number": 1,
    "created_at": "2024-07-15 12:00:00",
    "updated_at": "2024-07-15 12:00:00",
    "deleted_at": null
  },
  {
    "id": 2,
    "user_id": 2,
    "survey_id": 1,
    "lang_id": "en-US",
    "title": "Satisfied",
    "sort_number": 2,
    "created_at": "2024-07-15 12:00:000",
    "updated_at": "2024-07-15 12:00:00",
    "deleted_at": null
  }
]

Show

Show a single SurveyAnswerOption by id.

Definition

GET /api/administration/surveys/{survey}/answer-options/{id}

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/administration/surveys/1/answer-options/1', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

{
  "id": 1,
  "user_id": 2,
  "survey_id": 1,
  "lang_id": "en-US",
  "title": "Very satisfied",
  "sort_number": 1,
  "created_at": "2024-07-15 12:00:00",
  "updated_at": "2024-07-15 12:00:00",
  "deleted_at": null
}

[Adm.] List by Survey

Get a list of all SurveyAnswerOptions for a given Survey.

Definition

GET /api/administration/surveys/{survey}/answer-options

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/administration/surveys/1/answer-options', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

[
  {
    "id": 1,
    "user_id": 2,
    "survey_id": 1,
    "lang_id": "en-US",
    "title": "Very satisfied",
    "sort_number": 1,
    "created_at": "2024-07-15 12:00:00",
    "updated_at": "2024-07-15 12:00:00",
    "deleted_at": null
  },
  {
    "id": 2,
    "user_id": 2,
    "survey_id": 1,
    "lang_id": "en-US",
    "title": "Satisfied",
    "sort_number": 2,
    "created_at": "2024-07-15 12:00:000",
    "updated_at": "2024-07-15 12:00:00",
    "deleted_at": null
  }
]

[Adm.] Show

Show a single SurveyAnswerOption by id.

Definition

GET /api/administration/surveys/{survey}/answer-options/{id}

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/administration/surveys/1/answer-options/1', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

{
  "id": 1,
  "user_id": 2,
  "survey_id": 1,
  "lang_id": "en-US",
  "title": "Very satisfied",
  "sort_number": 1,
  "created_at": "2024-07-15 12:00:00",
  "updated_at": "2024-07-15 12:00:00",
  "deleted_at": null
}

Create

Create a new SurveyAnswerOption for a survey.

Definition

POST /api/administration/surveys/{survey}/answer-options

Request Keys

Key
Type
Default
Description

title *

string

-

The answer option text.

sort_number

integer

Current highest +1

The index of the SurveyAnswerOption related to the Survey.

Keys with * are required.

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/administration/surveys/1/answer-options', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'title' => 'Neutral'
    ]
]);

Example Response

{
  "status": "success",
  "data": {
    "id": 3,
    "user_id": 2,
    "survey_id": 1,
    "lang_id": "en-US",
    "title": "Neutral",
    "sort_number": 3,
    "created_at": "2024-07-15 12:15:00",
    "updated_at": "2024-07-15 12:15:00",
    "deleted_at": null
  }
}

[Adm.] Update

Update an existing SurveyAnswerOption by id.

Definition

PUT /api/administration/surveys/{survey}/answer-options/{id}

Request Keys

Key
Type
Description

title

string

The answer option text.

sort_number

integer

The index of the SurveyAnswerOption related to the Survey.

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('PUT', '/api/administration/surveys/1/answer-options/3', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'sort_number' => 1
    ]
]);

Example Response

{
  "status": "success",
  "data": {
    "id": 3,
    "user_id": 2,
    "survey_id": 1,
    "lang_id": "en-US",
    "title": "Neutral",
    "sort_number": 1,
    "created_at": "2024-07-15 12:15:00",
    "updated_at": "2024-07-15 12:30:00",
    "deleted_at": null
  }
}

Delete

Delete an existing SurveyAnswerOption by id.

Definition

DELETE /api/administration/surveys/{survey}/answer-options/{id}

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('DELETE', '/api/administration/surveys/1/answer-options/3', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

{
  "status": "success",
  "data": null
}

Last updated