SurveyVotes

Introduction

SurveyVotes represent the votes cast by Users for a specific Survey.

Each SurveyVote is associated with a User, the Department and one or more SurveyVoteSelectedAnswerOptions. Survey are subject to Survey-specific rules such as "one vote per department" or user confirmation requirements.

Model Definition

Alias

surveyVote

Relations

Key
Relation
Type
Relation Field(s)

user

Belongs to

user_id

groupAccountUser

Belongs to

group_account_user_id

department

Belongs to

department_id

survey

Belongs to

survey_id

selectedAnswerOptions

Has many

survey_vote_selected_answer_options.survey_vote_id

List by Survey

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

Definition

GET /api/surveys/{survey}/votes

Example Request

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

Example Response

[
  {
    "id": 1,
    "user_id": 2,
    "group_account_user_id": null,
    "department_id": 1,
    "survey_id": 1,
    "created_at": "2024-07-15 12:00:00",
    "updated_at": "2024-07-15 12:00:00",
    "deleted_at": null
  },
  {
    "id": 2,
    "user_id": 3,
    "group_account_user_id": null,
    "department_id": 2,
    "survey_id": 1,
    "created_at": "2024-07-15 13:00:00",
    "updated_at": "2024-07-15 13:00:00",
    "deleted_at": null
  }
]

Show

Show a single SurveyVote by id.

Definition

GET /api/surveys/{survey}/votes/{id}

Example Request

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

Example Response

{
  "id": 1,
  "user_id": 2,
  "group_account_user_id": null,
  "department_id": 1,
  "survey_id": 1,
  "created_at": "2024-07-15 12:00:00",
  "updated_at": "2024-07-15 12:00:00",
  "deleted_at": null
}

Show Current

Show the current SurveyVote for a given survey and authenticated user.

Definition

GET /api/surveys/{survey}/votes/current

Example Request

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

Example Response

{
  "id": 1,
  "user_id": 2,
  "group_account_user_id": null,
  "department_id": 1,
  "survey_id": 1,
  "created_at": "2024-07-15 12:00:00",
  "updated_at": "2024-07-15 12:00:00",
  "deleted_at": null
}

[Adm.] List

Get a list of all SurveyVotes for a given survey (administration).

Definition

GET /api/administration/surveys/{survey}/votes

Example Request

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

Example Response

[
  {
    "id": 1,
    "user_id": 2,
    "group_account_user_id": null,
    "department_id": 1,
    "survey_id": 1,
    "created_at": "2024-07-15 12:00:00",
    "updated_at": "2024-07-15 12:00:00",
    "deleted_at": null
  },
  {
    "id": 2,
    "user_id": 3,
    "group_account_user_id": null,
    "department_id": 2,
    "survey_id": 1,
    "created_at": "2024-07-15 13:00:00",
    "updated_at": "2024-07-15 13:00:00",
    "deleted_at": null
  }
]

[Adm.] Show

Show a single SurveyVote by id (administration).

Definition

GET /api/administration/surveys/{survey}/votes/{id}

Example Request

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

Example Response

{
  "id": 1,
  "user_id": 2,
  "group_account_user_id": null,
  "department_id": 1,
  "survey_id": 1,
  "created_at": "2024-07-15 12:00:00",
  "updated_at": "2024-07-15 12:00:00",
  "deleted_at": null
}

Create

Create a new SurveyVote for a survey.

Definition

POST /api/surveys/{survey}/votes

Request Keys

Key
Type
Default
Description

survey_answer_option_ids *

array

-

Array of SurveyAnswerOption IDs selected.

Keys with * are required.

Example Request

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

Example Response

{
  "status": "success",
  "data": {
    "id": 3,
    "user_id": 4,
    "group_account_user_id": null,
    "department_id": 2,
    "survey_id": 1,
    "created_at": "2024-07-15 14:00:00",
    "updated_at": "2024-07-15 14:00:00",
    "deleted_at": null
  }
}

Delete

Delete an existing SurveyVote by id.

Definition

DELETE /api/surveys/{survey}/votes/{id}

Example Request

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

Example Response

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

Last updated