getAllForms
Lấy tất cả các đối tượng biểu mẫu.
Mô tả
Phương thức này truy xuất tất cả các đối tượng biểu mẫu với phân trang. Nó trả về một Promise mà khi hoàn thành sẽ trả về một đối tượng IFormsResponse chứa các mục và tổng số.
Forms.getAllForms(
langCode,
offset,
limit
);
Sơ đồ tham số
Sơ đồ
langCode: string
Mã ngôn ngữ. Mặc định: "en_US"
ví dụ: "en_US"
offset: number
Tham số cho phân trang. Mặc định: 0
ví dụ: 0
limit: number
Tham số cho phân trang. Mặc định: 30
ví dụ: 30
Mặc định, bạn có thể truy xuất 10 đối tượng. Điều này là do giới hạn số bản ghi trong cài đặt quyền của mô-đun.
Để phân trang hoạt động chính xác, bạn cần cấu hình Quyền mô-đun theo nhu cầu của bạn trong phần tương ứng.
Ví dụ
Ví dụ tối thiểu
const response = await Forms.getAllForms();
Ví dụ với các thuộc tính
const response = await Forms.getAllForms('en_US', 0, 30);
Ví dụ phản hồi
{
"items": [
{
"id": 4,
"attributeSetId": 11,
"type": "data",
"localizeInfos": {
"title": "user_form",
"titleForSite": "",
"successMessage": "",
"unsuccessMessage": "",
"urlAddress": "",
"database": "0",
"script": "0"
},
"version": 9,
"position": 1,
"identifier": "user_form",
"processingType": "script",
"templateId": null,
"attributes": [
{
"type": "string",
"marker": "name_attr",
"position": 1,
"settings": {},
"isVisible": true,
"listTitles": [],
"validators": {},
"initialValue": null,
"localizeInfos": {
"title": "name"
},
"additionalFields": {}
},
{
"type": "string",
"marker": "username",
"position": 2,
"settings": {},
"isVisible": true,
"listTitles": [],
"validators": {},
"initialValue": null,
"localizeInfos": {
"title": "username"
},
"additionalFields": {}
},
{
"type": "string",
"marker": "password",
"position": 3,
"settings": {},
"isVisible": true,
"listTitles": [],
"validators": {},
"initialValue": null,
"localizeInfos": {
"title": "password"
},
"additionalFields": {}
},
"..."
]
},
{
"id": 6,
"attributeSetId": 15,
"type": "data",
"localizeInfos": {
"title": "Test form",
"titleForSite": "",
"successMessage": "",
"unsuccessMessage": "",
"urlAddress": "",
"database": "0",
"script": "0"
},
"version": 14,
"position": 2,
"identifier": "test-form",
"processingType": "script",
"templateId": null,
"attributes": [
{
"type": "string",
"marker": "name",
"position": 1,
"settings": {},
"isVisible": true,
"listTitles": [],
"validators": {
"requiredValidator": {
"strict": true
},
"stringInspectionValidator": {
"stringMax": 0,
"stringMin": 0,
"stringLength": 0
}
},
"initialValue": null,
"localizeInfos": {
"title": "Name"
},
"additionalFields": {
"additional_field": {
"type": "string",
"value": "Additional field data"
}
}
},
{
"type": "file",
"marker": "file",
"position": 2,
"settings": {},
"isVisible": true,
"listTitles": [],
"validators": {},
"initialValue": null,
"localizeInfos": {
"title": "File"
},
"additionalFields": {}
}
]
},
{
"id": 7,
"attributeSetId": 15,
"type": "data",
"localizeInfos": {
"title": "File form",
"titleForSite": "Form title (for application)",
"successMessage": "Message about successful data processing",
"unsuccessMessage": "Message about unsuccessful data processing",
"urlAddress": "",
"database": "0",
"script": "0"
},
"version": 15,
"position": 3,
"identifier": "file_form",
"processingType": "script",
"templateId": null,
"attributes": [
{
"type": "string",
"marker": "name",
"position": 1,
"settings": {},
"isVisible": true,
"listTitles": [],
"validators": {
"requiredValidator": {
"strict": true
},
"stringInspectionValidator": {
"stringMax": 0,
"stringMin": 0,
"stringLength": 0
}
},
"initialValue": null,
"localizeInfos": {
"title": "Name"
},
"additionalFields": {
"additional_field": {
"type": "string",
"value": "Additional field data"
}
}
},
{
"type": "file",
"marker": "file",
"position": 2,
"settings": {},
"isVisible": true,
"listTitles": [],
"validators": {},
"initialValue": null,
"localizeInfos": {
"title": "File"
},
"additionalFields": {}
}
]
},
"..."
],
"total": 9
}
Sơ đồ phản hồi
Sơ đồ: IFormsEntity[]
total: number
Tổng số mục.
items: IFormsEntity[]
Mảng các thực thể biểu mẫu.
items.id: number
Định danh của đối tượng.
ví dụ: 12345
items.attributeSetId: number | null
Định danh của bộ thuộc tính đang được sử dụng, hoặc null nếu không áp dụng.
ví dụ: 1234
items.type: string | null
Loại biểu mẫu.
ví dụ: "contact"
items.localizeInfos: IFormLocalizeInfo
Tên của biểu mẫu và các trường địa phương hóa phía biểu mẫu (tin nhắn thành công/lỗi, cấu hình xử lý, v.v.).
ví dụ:
{
"key": "value"
}
items.version: number
Số phiên bản của đối tượng.
ví dụ: 1
items.position: number
Vị trí của đối tượng.
ví dụ: 1
items.identifier: string
Định danh văn bản cho trường bản ghi.
ví dụ: "form_contact_us"
items.processingType: string
Loại xử lý biểu mẫu.
ví dụ: "async"
items.templateId: number | null
Định danh của mẫu được sử dụng bởi biểu mẫu, hoặc null nếu không có mẫu nào được sử dụng.
ví dụ: 6789
items.attributes: IFormAttribute[]
Các trường biểu mẫu với địa phương hóa của chúng, bộ xác thực và cờ cụ thể của biểu mẫu.
items.total: number | string
Tổng số mục liên quan.
ví dụ: "1"
items.moduleFormConfigs: IFormConfig[]
Mảng các cấu hình biểu mẫu mô-đun liên kết với biểu mẫu.
Ví dụ sử dụng
Hướng dẫn từng bước trong tài liệu:
- Lấy tất cả biểu mẫu — truy xuất mọi biểu mẫu đã được cấu hình trong dự án.
Thử nghiệm trực tiếp
Chạy phương thức này một cách tương tác trong JS SDK sandbox — kết nối URL Dự án và Mã thông báo Ứng dụng của bạn khi lần đầu truy cập, sau đó mở:
- Lấy tất cả biểu mẫu — truy xuất mọi biểu mẫu đã được cấu hình trong dự án.