Import form element submissions
FormElementSubmission
Import form element submissions
Import form element submissions data from external sources in bulk.
Import Features:
- Bulk data import from structured formats (CSV, Excel, JSON)
- Validation and error reporting for imported data
- Support for both new submissions and updates to existing ones
- Flexible mapping between external data formats and internal form structure
Data Validation:
- Validates form element types and constraints
- Ensures data integrity and consistency
- Provides detailed error reports for failed imports
- Supports rollback mechanisms for failed batch operations
TIMESTAMP support:
- Accepts a
recordedAt(ortimestamp) column; required for TIMESTAMP elements. - Parses ISO 8601 (assumes UTC if timezone missing), validates that year matches the CSV
year, and derivesperiodUnitfrom the UTC month. - Upserts per (formSubmissionId/new_formSiteId, formElementId, recordedAt); duplicates by timestamp update the value; empty
valuewithrecordedAtdeletes that exact entry inreplacemode and is ignored inmergemode.
Import modes:
merge: updates values present in the file and leaves omitted values unchanged.replace: updates values present in the file and clears omitted values in the imported form/site/year scope.
Multi-form import:
- If the uploaded file contains a
formNamecolumn (as produced by the export whenincludeFormName=true), rows are routed to their respective forms by name. In this case,formIdin the request is ignored for those rows. - When
formNameis not present, the import behaves as single-form and uses the providedformId.
Example request (CSV import, trimmed):
{
"formId": "form-123",
"format": "csv",
"mode": "merge",
"fileData": "<base64-csv>"
}
Example CSV content:
siteName,year,key,periodUnit,value,recordedAt
plant-a,2024,water_usage,,120.5,2024-03-15T10:30:00Z
Example response (trimmed):
{
"success": true,
"message": "Imported",
"stats": { "created": 1, "updated": 0, "deleted": 0, "valuesDeleted": 0, "formSitesCreated": 0 }
}
This endpoint is essential for migrating data from legacy systems, bulk data entry operations, and automated data synchronization workflows.
POST
Import form element submissions
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json

