Skip to content

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

RelationKeyTypeRelation Field(s)
UseruserBelongs touser_id
IconiconBelongs toicon_id
FormFieldsformFieldsHas manyform_fields.form_id
FormMessagesformMessagesHas manyform_messages.form_id
LayoutslayoutsHas manylayouts.layoutable_type, layouts.layoutable_id

Computed Properties

  • hash - The hashed id of the Form

Traits

  • Sortable
  • Restrictable
  • HasFolder
  • Layoutable

List

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

Definition

GET /api/forms

Example Request

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

Example Response

json
[
  {
    "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

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

Example Response

json
{
  "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

KeyTypeDefaultDescription
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

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

Example Response

json
{
  "status": "success",
  "data": {
    "form_id": 4,
    "user_id": 2,
    "department_id": 1,
    "body": "",
    "subject": "\"Form-4\" wurde von intratool Service (intratool) übertragen",
    "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}} übertragen",
      "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_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}} übertragen",
            "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_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}} übertragen",
            "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

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

Example Response

json
[
  {
    "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

KeyTypeDefaultDescription
user_id *integer-The related User
icon_idinteger70The related Icon
name *string-The name of the Form (unique by all Forms)
slugstringSlugged nameThe slugged name of the Form (unique by all Forms)
recipient *email-Array of the email adress(es) to recieve the FormMessage (seperated by comma)
subjectstringDefault valueThe subject of the Form
email_templatestringDefault valueThe template used to generate the FormMessage body
always_send_to_recipientbooleanfalseWhether to send the FormMessage also to the recipient when a recipient-select FormField is present in the Form
send_empty_fieldsbooleanfalseWhether empty FormMessageFields should be present in the FormMessage body
send_description_fieldsbooleanfalseWhether description FormFields should be present in the FormMessage body
has_personal_informationbooleanfalseWhether the FormMessage is shown to Group Accounts
user_confirmation_requiredbooleantrueWhether a confirmation of a specific User is required in Group Accounts
request_receiptbooleanfalseWether the recipients of the FormMessage should confirm the reciept
request_confirmationbooleanfalseWether the recipients of the FormMessage should accept or decline the content
sort_numberintegerCurrent highest +1The index of the Form

Keys with * are required.

Example Request

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

Example Response

json

[Adm.] Update

Update an existing Form by id.

Definition

PUT /api/administration/forms/{id}

Request Keys

KeyTypeDescription
user_id *integerThe related User
icon_idintegerThe related Icon
name *stringThe name of the Form (unique by all Forms)
slugstringThe slugged name of the Form (unique by all Forms)
recipient *emailArray of the email adress(es) to recieve the FormMessage (seperated by comma)
subjectstringThe subject of the Form
email_templatestringThe template used to generate the FormMessage body
always_send_to_recipientbooleanWhether to send the FormMessage also to the recipient when a recipient-select FormField is present in the Form
send_empty_fieldsbooleanWhether empty FormMessageFields should be present in the FormMessage body
send_description_fieldsbooleanWhether description FormFields should be present in the FormMessage body
has_personal_informationbooleanWhether the FormMessage is shown to Group Accounts
user_confirmation_requiredbooleanWhether a confirmation of a specific User is required in Group Accounts
request_receiptbooleanWether the recipients of the FormMessage should confirm the reciept
request_confirmationbooleanWether the recipients of the FormMessage should accept or decline the content
sort_numberintegerThe index of the Form

Example Request

php
$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

json
{
  "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

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

Example Response

json
{
  "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"
    }
  }
}