Skip to main content

postFormsData

Creating an object of form data saving information.

FormData?.postFormsData( body?, langCode? );

Methods with a post request accept as the request body an object with the form data field, which corresponds to the type of information being sent. The following are examples of form data objects for different data types.

Minimal example

const body = {
"formIdentifier": "contact_us",?
"formData": [?
{
"marker": "last_name",?
"type": "string"?
"value": "Andrey"?
}
]
};

const value = await FormData.postFormsData(body)

Schema (body)

body(required): object
Request body
example:

{
"formIdentifier": "form",
"formData": [
{
"marker": "name",
"type": "string",
"value": "Array"
}
]
}

langCode: string
Language code. Default: "en_US"
example: "en_US"

body.formIdentifier: string
The identifier of the form
example: "contact-form"

body.formData: string
**
example:

[
{
"marker": "name",
"type": "string",
"value": "Array"
}
]

body.formData.marker: string
Form attribute marker
example: "name"

body.formData.type: string
Form attribute type
example: "string"

body.formData.value: string
Form attribute value
example: "Array"

This method Returns a created FormDataEntity object. If you want to change the language, just pass it with the second argument

Example return:

{
"formData": {
"formIdentifier": "test-form",
"time": "2025-07-21T09:40:06.587Z",
"formData": [
{
"marker": "name",
"type": "string",
"value": "Test"
}
],
"id": 286
},
"actionMessage": ""
}
Schema

formIdentifier: string
The identifier of the page.
example: "contact_form"

time: Date | string
The identifier of the form.
example:

"2023-10-01T12:00:00Z"

formData: FormDataType[]
Form data.
example:

[
{
"marker": "name",
"type": "string",
"value": "Test"
}
]

id: number
The unique identifier of the form page.
example: 12345

actionMessage: string | null
Action message for the form data.
example: "Form submitted successfully"

attributeSetIdentifier: string | null
Text identifier (marker) of the used attribute set.
example: "product_attributes"


Example with a simple type attribute "string", "number", "float"

{
"marker": "last_name",
"type": "string",
"value": "Username"
}

Example with a simple type attribute "date", "dateTime", "time"

{
"marker": "birthday",
"type": "date",
"value": {
"fullDate": "2024-05-07T21:02:00.000Z",
"formattedValue": "08-05-2024 00:02",
"formatString": "DD-MM-YYYY HH:mm"
}
}

Example with a simple type attribute "text"

{
"marker": "about",
"type": "text",
"value": {
"htmlValue": "<p>Hello world</p>",
"plainValue": "",
"params": {
"isEditorDisabled": false,
"isImageCompressed": true
}
}
}

Example with a simple type attribute "textWithHeader"

{
"marker": "about",
"type": "textWithHeader",
"value": {
"header": "Headline",
"htmlValue": "<p>Hello World</p>",
"plainValue": "",
"params": {
"isEditorDisabled": false,
"isImageCompressed": true
}
}
}

Example with a simple type attribute "image" or "groupOfImages"

{
"marker": "avatar",
"type": "image",
"value": [
{
"filename": "files/project/page/10/image/Screenshot-from-2024-05-02-15-23-14.png",
"downloadLink": "http://my-site.com/cloud-static/files/project/page/10/image/Screenshot-from-2024-05-02-15-23-14.png",
"size": 392585,
"previewLink": "",
"params": {
"isImageCompressed": true
}
}
]
}

Example with a simple type attribute "files"

{
"marker": "picture",
"type": "file",
"value": [
{
"filename": "files/project/page/10/image/Screenshot-from-2024-05-02-15-23-14.png",
"downloadLink": "http://my-site.com/cloud-static/files/project/page/10/image/Screenshot-from-2024-05-02-15-23-14.png",
"size": 392585
}
]
}

Example with a simple type attribute "radioButton" or "list"

{
"marker": "selector",
"type": "list",
"value": [
{
"title": "red",
"value": "1",
"extended": {
"value": "red",
"type": "string"
}
}
]
}

Example with attribute type "entity" (nested list)

{
"formIdentifier": "entity_form",
"formData": {
"en_US": [
{
"marker": "entity-marker",
"type": "entity",
"value": [25, 32, 24]
}
]
}
}

Value - numerical identifiers for pages and string identifiers for products. Identifiers for products should include the prefix 'p-', for example, 'p-1-', 'p-2-', etc. p-[parentId]-[productId]


Example with attribute type "timeInterval"

{
"formIdentifier": "reg",
"formData": {
"en_US": [
{
"marker": "interval",
"type": "timeInterval",
"value": [
[
"2025-02-11T16:00:00:000Z",
"2025-02-13T16:00:00:000Z",
]
]
}
]
}
}

value — array of interval arrays in ISO 8601 format. for example 2025-02-11T16:00:00:000Z

2025 — year; 02 — month; 11 — day of the month; T — separator between date and time; 16:00:00 — time in hours:minutes:seconds format; 000Z — milliseconds and time zone indication. Z means that the time is specified in UTC format.