Skip to main content

Frontend

request-submit-token

Method: POST
Endpoint: /api/v1/frontend/request-submit-token
Content-Type: application/x-www-form-urlencoded (normal POST request)

Returns a new submit token to the browser.

Authentication

No authentication is required. Each request must contain the public key of a project to identify the project.

Request

Arguments

NameTypeRequiredDescription
publicKeyStringRequiredThe public key of the project.
pageTitleStringRequiredThe title of the page on which the form is visible.
pageUrlStringRequiredThe URL of the page on which the form is visible.

Response

Example

{
"submitToken":"_wc0MPl5EQuwuJeTMq8uoF7WFpFdoZZf35ctawmasmc",
"messages":{
"label":"Ich akzeptiere, dass die Formulareingaben auf Spam \u00fcberpr\u00fcft und f\u00fcr 14 Tage verschl\u00fcsselt gespeichert werden.",
"accessibilityCheckingData":"Wir \u00fcberpr\u00fcfen Ihre Daten. Bitte warten Sie.",
"accessibilityDataValid":"Ihre Daten enthalten kein Spam. Sie k\u00f6nnen das Formular absenden.",
"errorGotNoToken":"mosparo hat keinen Absende-Token ausgestellt.",
"errorInternalError":"Es trat ein Fehler auf. Bitte wiederholen Sie den Vorgang.",
"errorNoSubmitTokenAvailable":"Kein Absende-Token verf\u00fcgbar. Die Validierung Ihrer Daten ist nicht m\u00f6glich.",
"errorSpamDetected":"In Ihren Daten ist Spam enthalten.",
"errorLockedOut":"Sie wurden tempor\u00e4r gesperrt. Bitte versuchen Sie es nach %datetime% erneut.",
"errorDelay":"Ihre Anfrage wurde verz\u00f6gert. Bitte warten Sie %seconds% Sekunden.",
"hpLeaveEmpty":"Dieses Feld leer lassen"
}
}

Properties

NameTypeDescription
submitTokenStringThe submit token is needed for the validation and verification.
messagesObjectThe translations for the different texts.
honeypotFieldNameStringThe name of the honeypot field if this function is active.

check-form-data

Method: POST
Endpoint: /api/v1/frontend/check-form-data
Content-Type: application/x-www-form-urlencoded (normal POST request)

Validates the form data and returns a validation token if the data does not contain spam.

Authentication

No authentication is required. Each request must contain the public key of a project to identify the project.

Request

Arguments

NameTypeRequiredDescription
publicKeyStringRequiredThe public key of the project.
submitTokenStringRequiredThe submit token requested with the method request-submit-token.
formDataArrayRequiredAn array with all the form data, see Structure of formData.

Structure of formData

The form data is an object containing two properties:

NameTypeDescription
fieldsArrayAn array of objects with the fields' data that should be processed, see Structure of field data.
ignoredFieldsArrayAn array with the names (HTML attribute name of a ignored field) of the fields that were ignored from the frontend, see Ignored fields.

Structure of field data

Every object needs the following properties:

NameTypeDescription
nameStringName of the field (name attribute of the HTML field)
valueStringThe value of the field
fieldPathStringThe path of the field, see Field path

Field path

The field path combines the HTML element tag and the field's name.

Examples

textarea.message
select.country

The HTML type must be added to the field path if it is an input element.

Examples

input[text].name
input[email].email-address

Example formData

{
"fields": [
{
"name": "username",
"value": "example",
"fieldPath": "input[text].username"
}
],
"ignoredFields": [
"password"
]
}

Response

Example

{
"valid":true,
"validationToken":"VXihNRK84O55IzHQD_G7aumyzDHOIiEZGnh1v2XyZJw"
}

Properties

NameTypeDescription
validBooleanThe form data does not contain spam if true.
validationTokenStringThe token needs to be sent to mosparo for verification.