Forms

Introduction

The Form is the base component which needs to be configured to provide Forms to an User.
It keeps general information about the Form behaviour and settings.

Usually there is at least one FormField attached to a Form.

Model & Relations

Namespace

Modules\Forms\Entities\Form

Relations

Relation Key Type Relation Field(s)
User user Belongs to user_id
Icon icon Belongs to icon_id
FormFields formFields Has many form_fields.form_id
FormMessages formMessages Has many form_messages.form_id

Computed Properties

  • hash - The hashed id of the Form

Traits

  • Sortable
  • Restrictable
  • HasFolder

List

Get a list of all Forms the current authenticated User is allowed to view.

Definition

GET /api/forms

Example Request

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

Example Response

[
  {
    "id": 1,
    "user_id": 6,
    "icon_id": 27,
    "folder_id": null,
    "name": "Form-1",
    "slug": "form-1",
    "subject": "\"{{FORMULARNAME}}\" wurde von {{BENUTZERNAME}} \u00fcbertragen",
    "recipient": ["info@intratool.de"],
    "always_send_to_recipient": false,
    "has_personal_info": false,
    "user_confirmation_required": true,
    "request_receipt": false,
    "request_confirmation": false,
    "email_template": "{{ALLE_FELDER}}",
    "active": true,
    "sort_number": 1,
    "created_at": "2019-01-22 10:44:18",
    "updated_at": "2019-01-24 14:04:48",
    "grade_scale": null,
    "send_empty_fields": false,
    "send_description_fields": false,
    "hash": "zn7m24owk63qolxryge8pj05"
  },
  {
    "id": 2,
    "user_id": 2,
    "icon_id": 70,
    "folder_id": null,
    "name": "Form-2",
    "slug": "form-2",
    "subject": "\"{{FORMULARNAME}}\" wurde von {{BENUTZERNAME}} \u00fcbertragen",
    "recipient": ["info@intratool.de"],
    "always_send_to_recipient": false,
    "has_personal_info": false,
    "user_confirmation_required": true,
    "request_receipt": false,
    "request_confirmation": false,
    "email_template": "{{ALLE_FELDER}}",
    "active": true,
    "sort_number": 2,
    "created_at": "2019-01-25 11:30:43",
    "updated_at": "2019-01-25 11:34:42",
    "grade_scale": null,
    "send_empty_fields": false,
    "send_description_fields": false,
    "hash": "6o8m0kz5yw10x1pr9e4vxj27"
  }
]

Get

Get a single Form by id.

Definition

GET /api/forms/{id}

Example Request

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

Example Response

{
  "id": 1,
  "user_id": 6,
  "icon_id": 27,
  "folder_id": null,
  "name": "Form-1",
  "slug": "form-1",
  "subject": "\"{{FORMULARNAME}}\" wurde von {{BENUTZERNAME}} \u00fcbertragen",
  "recipient": ["info@intratool.de"],
  "always_send_to_recipient": false,
  "has_personal_info": false,
  "user_confirmation_required": true,
  "request_receipt": false,
  "request_confirmation": false,
  "email_template": "{{ALLE_FELDER}}",
  "active": true,
  "sort_number": 1,
  "created_at": "2019-01-22 10:44:18",
  "updated_at": "2019-01-24 14:04:48",
  "grade_scale": null,
  "send_empty_fields": false,
  "send_description_fields": false,
  "hash": "zn7m24owk63qolxryge8pj05"
}

Send

Send an existing Form by id.

By sending a Form, the FormFieldValidations are triggered. These FormFieldValidations ensure that the input of the FormMessageFields match the expected input for the used FormFields.

Definition

POST /api/forms/{id}/send

Request Keys

Key Type Default Description
user_id * integer - The related User
form_id ** integer - The related Form

Keys with * are required.
Keys with ** are normalized to the information given by the route.

Example Request

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

Example Response

{
  "status": "success",
  "data": {
    "form_id": 4,
    "user_id": 2,
    "department_id": 1,
    "body": "",
    "subject": "\"Form-4\" wurde von intratool Service (intratool) \u00fcbertragen",
    "updated_at": "2019-01-25 13:17:15",
    "created_at": "2019-01-25 13:17:15",
    "id": 2,
    "sent_at": "2019-01-25 13:17:15",
    "hash": "6o8m0kz5yw10x1pr9e4vxj27",
    "form": {
      "id": 4,
      "user_id": 2,
      "icon_id": 70,
      "folder_id": null,
      "name": "Form-4",
      "slug": "form-4",
      "subject": "\"{{FORMULARNAME}}\" wurde von {{BENUTZERNAME}} \u00fcbertragen",
      "recipient": ["info@intratool.de"],
      "always_send_to_recipient": false,
      "has_personal_info": false,
      "user_confirmation_required": true,
      "request_receipt": false,
      "request_confirmation": false,
      "email_template": "{{ALLE_FELDER}}",
      "active": true,
      "sort_number": 3,
      "created_at": "2019-01-25 13:16:09",
      "updated_at": "2019-01-25 13:16:11",
      "grade_scale": null,
      "send_empty_fields": false,
      "send_description_fields": false,
      "hash": "2w54q7xmvk1drl8ygeo96jrd",
      "form_fields": [
        {
          "id": 10,
          "form_id": 4,
          "form_column_id": null,
          "form_type": "form",
          "form_field_type_id": "text",
          "name": "Field-1",
          "key": "field-1",
          "default_value": "",
          "placeholder": null,
          "description": null,
          "config": {},
          "sort_number": 1,
          "created_at": "2019-01-25 13:16:09",
          "updated_at": "2019-01-25 13:16:09",
          "field_validation_string": "",
          "field_type": {
            "id": "text",
            "icon_id": 72,
            "name": "Eingabefeld",
            "default_config": {},
            "unique": false,
            "relevant": true,
            "sort_number": 1,
            "created_at": "2019-01-21 00:00:00",
            "updated_at": "2019-01-21 00:00:00"
          },
          "form": {
            "id": 4,
            "user_id": 2,
            "icon_id": 70,
            "folder_id": null,
            "name": "Form-4",
            "slug": "form-4",
            "subject": "\"{{FORMULARNAME}}\" wurde von {{BENUTZERNAME}} \u00fcbertragen",
            "recipient": ["info@intratool.de"],
            "always_send_to_recipient": false,
            "has_personal_info": false,
            "user_confirmation_required": true,
            "request_receipt": false,
            "request_confirmation": false,
            "email_template": "{{ALLE_FELDER}}",
            "active": true,
            "sort_number": 3,
            "created_at": "2019-01-25 13:16:09",
            "updated_at": "2019-01-25 13:16:11",
            "grade_scale": null,
            "send_empty_fields": false,
            "send_description_fields": false,
            "hash": "2w54q7xmvk1drl8ygeo96jrd"
          },
          "field_validations": []
        }
      ]
    },
    "form_message_fields": [
      {
        "form_message_id": 2,
        "form_field_id": 10,
        "value": "--",
        "request_value": null,
        "updated_at": "2019-01-25 13:17:15",
        "created_at": "2019-01-25 13:17:15",
        "id": 4,
        "form_field": {
          "id": 10,
          "form_id": 4,
          "form_column_id": null,
          "form_type": "form",
          "form_field_type_id": "text",
          "name": "Field-1",
          "key": "field-1",
          "default_value": "",
          "placeholder": null,
          "description": null,
          "config": {},
          "sort_number": 1,
          "created_at": "2019-01-25 13:16:09",
          "updated_at": "2019-01-25 13:16:09",
          "field_validation_string": "",
          "field_type": {
            "id": "text",
            "icon_id": 72,
            "name": "Eingabefeld",
            "default_config": {},
            "unique": false,
            "relevant": true,
            "sort_number": 1,
            "created_at": "2019-01-21 00:00:00",
            "updated_at": "2019-01-21 00:00:00"
          },
          "form": {
            "id": 4,
            "user_id": 2,
            "icon_id": 70,
            "folder_id": null,
            "name": "Form-4",
            "slug": "form-4",
            "subject": "\"{{FORMULARNAME}}\" wurde von {{BENUTZERNAME}} \u00fcbertragen",
            "recipient": ["info@intratool.de"],
            "always_send_to_recipient": false,
            "has_personal_info": false,
            "user_confirmation_required": true,
            "request_receipt": false,
            "request_confirmation": false,
            "email_template": "{{ALLE_FELDER}}",
            "active": true,
            "sort_number": 3,
            "created_at": "2019-01-25 13:16:09",
            "updated_at": "2019-01-25 13:16:11",
            "grade_scale": null,
            "send_empty_fields": false,
            "send_description_fields": false,
            "hash": "2w54q7xmvk1drl8ygeo96jrd"
          },
          "field_validations": []
        }
      }
    ],
    "user": {
      "id": 2,
      "username": "intratool",
      "first_name": "intratool",
      "last_name": "Service",
      "active": 1,
      "group_account": 0,
      "role_id": 1,
      "profile_picture": "/assets/images/profile-pictures/profile-picture-intratool.png",
      "street": null,
      "zipcode": null,
      "city": null,
      "email": null,
      "phone": null,
      "birthdate": null,
      "gender": null,
      "entering_date": null,
      "leaving_date": null,
      "staff_number": null,
      "wants_email_notifications": 1,
      "created_at": "2019-01-21 00:00:00",
      "updated_at": "2019-01-21 00:00:00",
      "password_updated_at": null,
      "deleted_at": null,
      "default_route": null,
      "full_name": "intratool Service",
      "online": 1
    }
  }
}

[Adm.] List

Get a list of all Forms.

Definition

GET /api/administration/forms

Example Request

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

Example Response

[
  {
    "id": 1,
    "user_id": 6,
    "icon_id": 27,
    "folder_id": null,
    "name": "Form-1",
    "slug": "form-1",
    "subject": "\"{{FORMULARNAME}}\" wurde von {{BENUTZERNAME}} \u00fcbertragen",
    "recipient": ["info@intratool.de"],
    "always_send_to_recipient": false,
    "has_personal_info": false,
    "user_confirmation_required": true,
    "request_receipt": false,
    "request_confirmation": false,
    "email_template": "{{ALLE_FELDER}}",
    "active": true,
    "sort_number": 1,
    "created_at": "2019-01-22 10:44:18",
    "updated_at": "2019-01-24 14:04:48",
    "grade_scale": null,
    "send_empty_fields": false,
    "send_description_fields": false,
    "hash": "zn7m24owk63qolxryge8pj05"
  },
  {
    "id": 2,
    "user_id": 2,
    "icon_id": 70,
    "folder_id": null,
    "name": "Form-2",
    "slug": "form-2",
    "subject": "\"{{FORMULARNAME}}\" wurde von {{BENUTZERNAME}} \u00fcbertragen",
    "recipient": ["info@intratool.de"],
    "always_send_to_recipient": false,
    "has_personal_info": false,
    "user_confirmation_required": true,
    "request_receipt": false,
    "request_confirmation": false,
    "email_template": "{{ALLE_FELDER}}",
    "active": true,
    "sort_number": 2,
    "created_at": "2019-01-25 11:30:43",
    "updated_at": "2019-01-25 11:34:42",
    "grade_scale": null,
    "send_empty_fields": false,
    "send_description_fields": false,
    "hash": "6o8m0kz5yw10x1pr9e4vxj27"
  }
]

[Adm.] Create

Create a new Form.

Definition

POST /api/administration/forms

Request Keys

Key Type Default Description
user_id * integer - The related User
icon_id integer 70 The related Icon
name * string - The name of the Form (unique by all Forms)
slug string Slugged name The slugged name of the Form (unique by all Forms)
recipient * email - Array of the email adress(es) to recieve the FormMessage (seperated by comma)
subject string Default value The subject of the Form
email_template string Default value The template used to generate the FormMessage body
always_send_to_recipient boolean false Whether to send the FormMessage also to the recipient when a recipient-select FormField is present in the Form
send_empty_fields boolean false Whether empty FormMessageFields should be present in the FormMessage body
send_description_fields boolean false Whether description FormFields should be present in the FormMessage body
has_personal_information boolean false Whether the FormMessage is shown to Group Accounts
user_confirmation_required boolean true Whether a confirmation of a specific User is required in Group Accounts
request_receipt boolean false Wether the recipients of the FormMessage should confirm the reciept
request_confirmation boolean false Wether the recipients of the FormMessage should accept or decline the content
sort_number integer Current highest +1 The index of the Form

Keys with * are required.

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);

Example Response


[Adm.] Update

Update an existing Form by id.

Definition

PUT /api/administration/forms/{id}

Request Keys

Key Type Description
user_id * integer The related User
icon_id integer The related Icon
name * string The name of the Form (unique by all Forms)
slug string The slugged name of the Form (unique by all Forms)
recipient * email Array of the email adress(es) to recieve the FormMessage (seperated by comma)
subject string The subject of the Form
email_template string The template used to generate the FormMessage body
always_send_to_recipient boolean Whether to send the FormMessage also to the recipient when a recipient-select FormField is present in the Form
send_empty_fields boolean Whether empty FormMessageFields should be present in the FormMessage body
send_description_fields boolean Whether description FormFields should be present in the FormMessage body
has_personal_information boolean Whether the FormMessage is shown to Group Accounts
user_confirmation_required boolean Whether a confirmation of a specific User is required in Group Accounts
request_receipt boolean Wether the recipients of the FormMessage should confirm the reciept
request_confirmation boolean Wether the recipients of the FormMessage should accept or decline the content
sort_number integer The index of the Form

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('PUT', '/api/administration/forms/1', [
     'headers' => ['Authorization' => "Bearer {accessToken}"],
     'json' => [
         'user_id' => '3',
         'name' => 'Form-1-changed',
         'recipient' => ['service@intratool.de']
     ]
 ]);

Example Response

{
  "status": "success",
  "data": {
    "id": 1,
    "user_id": 6,
    "icon_id": 27,
    "folder_id": null,
    "name": "Form-1-changed",
    "slug": "form-1-changed",
    "subject": "\"{{FORMULARNAME}}\" wurde von {{BENUTZERNAME}} \u00fcbertragen",
    "recipient": "service@intratool.de",
    "always_send_to_recipient": false,
    "has_personal_info": false,
    "user_confirmation_required": true,
    "request_receipt": false,
    "request_confirmation": false,
    "email_template": "{{ALLE_FELDER}}",
    "active": true,
    "sort_number": 1,
    "created_at": "2019-01-22 10:44:18",
    "updated_at": "2019-01-25 11:52:43",
    "grade_scale": null,
    "send_empty_fields": false,
    "send_description_fields": false,
    "hash": "zn7m24owk63qolxryge8pj05",
    "icon": {
      "id": 27,
      "identifier": "nc-box",
      "title": "Box"
    }
  }
}

[Adm.] Delete

Delete an existing Form by id.

Definition

DELETE /api/administration/forms/{id}

Example Request

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

Example Response

{
  "status": "success",
  "data": {
    "id": 3,
    "user_id": 2,
    "icon_id": 70,
    "folder_id": null,
    "name": "Form-3",
    "slug": "form-3",
    "subject": "\"{{FORMULARNAME}}\" wurde von {{BENUTZERNAME}} \u00fcbertragen",
    "recipient": ["info@intratool.de"],
    "always_send_to_recipient": false,
    "has_personal_info": false,
    "user_confirmation_required": true,
    "request_receipt": false,
    "request_confirmation": false,
    "email_template": "{{ALLE_FELDER}}",
    "active": true,
    "sort_number": 3,
    "created_at": "2019-01-25 11:53:56",
    "updated_at": "2019-01-25 11:54:00",
    "grade_scale": null,
    "send_empty_fields": false,
    "send_description_fields": false,
    "hash": "d54q7g6wnj1eylm8k9e0xpz2",
    "icon": {
      "id": 70,
      "identifier": "nc-list",
      "title": "Liste"
    }
  }
}
Last Updated: 10/14/2019