Skip to main content

postFormsData

Send form data to OneEntry platform.

🎯 What does this method do?

This method submits form data to the OneEntry platform. Think of it like clicking "Submit" on a contact form - it sends all the user's input (name, email, message, files, etc.) to the server.

Use cases:

  • 📝 Contact forms
  • 📋 Registration forms
  • 💬 Feedback forms
  • 📤 File uploads
  • 🎫 Support tickets

📖 Simple Explanation

When a user fills out a form on your website, you need to send that data somewhere. This method does exactly that - it takes all the form fields (text, numbers, files, etc.) and sends them to OneEntry.

Think of it as:

User fills form → Your code calls postFormsData() → Data saved in OneEntry ✅

🚀 Super Simple Example (Start Here!)

Scenario: You have a contact form with just a name field.

// Step 1: User fills the form (e.g., enters "John Doe")
// Step 2: Send it to OneEntry

const response = await FormData.postFormsData({
formIdentifier: "contact_us", // 👈 Your form's name
formModuleConfigId: 2, // 👈 Form config ID (from OneEntry admin)
moduleEntityIdentifier: "blog", // 👈 Where to save it (from OneEntry)
replayTo: null, // 👈 Reply email (optional)
status: "sent", // 👈 "sent" or "draft"
formData: [ // 👈 The actual form data
{
marker: "name", // 👈 Field name
type: "string", // 👈 Field type
value: "John Doe" // 👈 User's input
}
]
});

// ✅ Done! Form submitted successfully
console.log("Form submitted, ID:", response.formData.id);

That's it! Now let's see how to handle different field types...


📋 What You Need to Know Before Using

Before calling this method, you need these 3 things from OneEntry admin panel:

  1. formIdentifier - Your form's unique name (e.g., "contact_us")
  2. formModuleConfigId - Form configuration ID (a number, e.g., 2)
  3. moduleEntityIdentifier - Where to store data (e.g., "blog", "contacts")

How to find these?

  • Login to OneEntry Admin
  • Go to Forms section
  • Copy the values from your form configuration

🔧 Method Signature

FormData.postFormsData(

body*,
body.formIdentifier*,
body.formModuleConfigId*,
body.moduleEntityIdentifier*,
body.replayTo*,
body.status*,
body.formData*,
body.fileQuery,
langCode

);

Parameters schema

Schema (body)

body(required): IBodyPostFormData
Request body
example:

{
"formIdentifier": "test-form",
"formModuleConfigId": 2,
"moduleEntityIdentifier": "blog",
"replayTo": null,
"status": "sent",
"formData": [
{
"marker": "name",
"type": "string",
"value": "Test"
}
]
}

body.formIdentifier(required): string
Text identifier (marker) of the form.
example: "form"

body.formModuleConfigId(required): number
The unique identifier of the form module configuration.
example: 2

body.moduleEntityIdentifier(required): string
Text identifier (marker) of the module entity.
example: "blog"

body.replayTo(required): string | null
Email to reply to.
example: "some@email.com"

body.status(required): string
Status of the form.
example: "sent"

body.formData(required): FormDataType[]
Array of form data objects.
example:

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

body.fileQuery: IUploadingQuery
Optional file query for uploading files.
example:

{
"type": "page",
"entity": "editor",
"id": 3787
}

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

Examples

Minimal example


const body = {
"formIdentifier": "contact_us",
"formModuleConfigId": 2,
"moduleEntityIdentifier": "blog",
"replayTo": null,
"status": "sent",
"formData": [
{
"marker": "last_name",
"type": "string"
"value": "Andrey"
}
]
};

const response = await FormData.postFormsData(body);

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


const body = {
"formIdentifier": "test-form",
"formModuleConfigId": 2,
"moduleEntityIdentifier": "blog",
"replayTo": null,
"status": "sent",
"formData": [
{
"marker": "string_marker",
"type": "string",
"value": "Username"
},
{
"marker": "number_marker",
"type": "number",
"value": 1
},
{
"marker": "float_marker",
"type": "float",
"value": 2.256
}
]
};

const response = await FormData.postFormsData(body);


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


const body = {
"formIdentifier": "contact_us",
"formModuleConfigId": 2,
"moduleEntityIdentifier": "blog",
"replayTo": null,
"status": "sent",
"formData": [
{
"marker": "date_marker",
"type": "date",
"value": {
"fullDate": "2024-05-07T21:02:00.000Z",
"formattedValue": "08-05-2024 00:02",
"formatString": "DD-MM-YYYY HH:mm"
}
}
]
};

const response = await FormData.postFormsData(body);


Example with a simple type attribute "text" (Only one of htmlValue, plainValue or mdValue can be provided)


const body = {
"formIdentifier": "contact_us",
"formModuleConfigId": 2,
"moduleEntityIdentifier": "blog",
"replayTo": null,
"status": "sent",
"formData": [
{
"marker": "about_marker",
"type": "text",
"value": [
{
"htmlValue": "<p>Hello world</p>",
"params": {
"isImageCompressed": true,
"editorMode": "html"
}
}
]
}
]
};

const response = await FormData.postFormsData(body);


Example with a simple type attribute "textWithHeader" (Only one of htmlValue, plainValue or mdValue can be provided)


const body = {
"formIdentifier": "contact_us",
"formModuleConfigId": 2,
"moduleEntityIdentifier": "blog",
"replayTo": null,
"status": "sent",
"formData": [
{
marker: "textwithheader_marker",
type: "textWithHeader",
value: [
{
"header": "Headline",
"htmlValue": "<p>Hello World</p>",
"params": {
"isImageCompressed": true,
"editorMode": "html"
}
}
]
}
]
};

const response = await FormData.postFormsData(body);


Example with attribute type "image"


const testImageUrl = 'https://your-project.oneentry.cloud/cloud-static/files/project/product/2954/image/7e0a6a70-a23d-410f-8b6a-f8b4f7483244.png';
const filename = 'test-image.png';

/* In real world scenario you should use File API to create file from URL but for the sake of simplicity we will use predefined file URL and use createFileFromUrl method for this example */
const file = await FileUploading.createFileFromUrl(testImageUrl, filename);

const body = {
"formIdentifier": "contact_us",
"formModuleConfigId": 2,
"moduleEntityIdentifier": "blog",
"replayTo": null,
"status": "sent",
"formData": [
{
marker: "image_marker",
type: "image",
value: [
file
]
}
]
};

const response = await FormData.postFormsData(body);


Example with attribute type "groupOfImages"


const testImageUrl = 'https://your-project.oneentry.cloud/cloud-static/files/project/product/2954/image/7e0a6a70-a23d-410f-8b6a-f8b4f7483244.png';
const filename = 'test-image.png';

/* In real world scenario you should use File API to create file from URL but for the sake of simplicity we will use predefined file URL and use createFileFromUrl method for this example */
const file = await FileUploading.createFileFromUrl(testImageUrl, filename);

const body = {
"formIdentifier": "contact_us",
"formModuleConfigId": 2,
"moduleEntityIdentifier": "blog",
"replayTo": null,
"status": "sent",
"formData": [
{
marker: "groupofimages_marker",
type: "groupOfImages",
value: [
file
]
}
]
};

const response = await FormData.postFormsData(body);


Example with attribute type "files"


const testImageUrl = 'https://your-project.oneentry.cloud/cloud-static/files/project/product/2954/image/7e0a6a70-a23d-410f-8b6a-f8b4f7483244.png';
const filename = 'test-image.png';

/* In real world scenario you should use File API to create file from URL but for the sake of simplicity we will use predefined file URL and use createFileFromUrl method for this example */
const file = await FileUploading.createFileFromUrl(testImageUrl, filename);

const body = {
"formIdentifier": "contact_us",
"formModuleConfigId": 2,
"moduleEntityIdentifier": "blog",
"replayTo": null,
"status": "sent",
"formData": [
{
"marker": "picture_marker",
"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
}
]
}
]
};

const response = await FormData.postFormsData(body);


Example with attribute type "radioButton" or "list"


const body = {
"formIdentifier": "contact_us",
"formModuleConfigId": 2,
"moduleEntityIdentifier": "blog",
"replayTo": null,
"status": "sent",
"formData": [
{
"marker": "selector_marker",
"type": "list",
"value": [
{
"marker": "list",
"type": "list",
"value": ["1"]
}
]
}
]
};

const response = await FormData.postFormsData(body);


Example with attribute type "entity" (nested list)


const body = {
"formIdentifier": "contact_us",
"formModuleConfigId": 2,
"moduleEntityIdentifier": "blog",
"replayTo": null,
"status": "sent",
"formData": [
{
"marker": "entity_marker",
"type": "entity",
"value": [25, 32, 24]
}
]
};

const response = await FormData.postFormsData(body);

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"


const body = {
"formIdentifier": "contact_us",
"formModuleConfigId": 2,
"moduleEntityIdentifier": "blog",
"replayTo": null,
"status": "sent",
"formData": [
{
marker: 'timeinterval_marker',
type: 'timeInterval',
value: [
[
"2025-02-11T16:00:00.000Z",
"2025-02-13T16:00:00.000Z"
]
]
},
]
};

const response = await FormData.postFormsData(body);

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.


Example return:

{
"formData": {
"formIdentifier": "test-form",
"time": "2025-11-06T09:28:00.915Z",
"formData": [
{
"marker": "name",
"type": "string",
"value": "Test"
}
],
"entityIdentifier": "blog",
"fingerprint": "UQ_ue7gas",
"isUserAdmin": false,
"formModuleId": 2,
"userIdentifier": null,
"parentId": null,
"id": 843
},
"actionMessage": ""
}

Response schema

Schema: IPostFormResponse

formData: object
Form data.
example:

{
"id": 42,
"formIdentifier": "contact_form",
"time": "2023-10-01T12:00:00Z",
"entityIdentifier": "blog",
"isUserAdmin": false,
"formModuleId": 2,
"parentId": null,
"userIdentifier": null,
"formData": [
{
"marker": "name",
"type": "string",
"value": "Jack"
}
]
}

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

formData.formIdentifier: string
The identifier of the form.
example: "contact_form"

formData.time: string
The time of the form submit.
example: "2023-10-01T12:00:00Z"

formData.entityIdentifier: string
The entity identifier.
example: "blog"

formData.isUserAdmin: boolean
Is user admin.
example: false

formData.formModuleId: number
The form module identifier.
example: 2

formData.parentId: any
The parent identifier.
example: null

formData.userIdentifier: any
The user identifier.
example: null

formData.formData: FormDataType[]
Form fields data.
example:

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

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