Prepare a Migration Sample
Use one small collection to compare CLI and API migration approaches. The sample contains three text files, three string attribute definitions, a source-to-document ID mapping, and SHA-256 checksums. Both walkthroughs use these same files and expected results.
For source discovery, permission mapping, versions, and cutover planning, start with Migrating Into and Out of FormKiQ. These walkthroughs demonstrate the destination import and verification steps after extraction and mapping.
Choose a walkthrough
| Starting point | Walkthrough |
|---|---|
| Your extraction process can produce files and CSV metadata | Migrate using the CLI. Use the existing importer and keep its outputs with your migration records. |
| Your application needs to control requests, checkpoints, and reconciliation | Migrate using the API. Inspect the example's write handling before adapting it. |
| You have completed either import and want to check the result | Export and verify the sample. Use the same read-only checks for either method. |
You can combine the methods. For example, a source extraction script can translate legacy fields into CSV files, the CLI can load them, and an API script can verify the resulting content and metadata. Keep one agreed source-ID mapping throughout.
Before you begin
- Use an approved test deployment and an existing site where you can create sample documents and attributes. Confirm the deployment supports the attribute operations used here. The CLI can be used with Core and commercial editions; individual operations depend on the deployed features and permissions.
- Install Python 3.10 or later. The example uses only the Python standard library.
- For the CLI walkthrough, install and configure the FormKiQ CLI.
- For the API walkthrough or shared verification, obtain a JWT and the matching API endpoint, with access to the selected site.
- Review site rules, schemas, and processing before importing. Omitting explicit actions from a request does not disable processing configured elsewhere in the deployment.
The API request shapes in these examples were checked against the v1.19.2 source. CLI releases have their own version numbers. Record your backend and CLI versions, and check the CSV reference for options introduced in later releases.
Prepare the files once
Download migration_sample.py into a working directory. Review the script, then run:
umask 077
python3 migration_sample.py prepare --directory migration-sample
export FORMKIQ_SITE_ID="default"
Replace default with the approved test site if needed. Preparation runs locally and makes no AWS or FormKiQ requests. It generates new UUID v4 document IDs and a batch identifier, then writes:
migration-sample/
manifest.json
attributes.csv
documents.csv
document-attributes.csv
document-contents.csv
files/
legacy-001.txt
legacy-002.txt
legacy-003.txt
| Source ID | Document type | File content |
|---|---|---|
legacy-001 | invoice | Invoice example: amount 125.00 EUR. |
legacy-002 | policy | Policy example: review every twelve months. |
legacy-003 | memo | Memo example: retain the original source identifier. |
Each file ends with a newline. The manifest records its exact byte count and checksum. The target path is migration-sample/<batchId>/<sourceId>.txt. Each document receives migrationSampleSourceId, migrationSampleBatch, and migrationSampleType attributes, all defined as STRING and STANDARD.
document-contents.csv contains absolute local file paths. Keep the prepared directory in place while using those CSV files. Preserve manifest.json and its generated IDs; preparation refuses to overwrite an existing directory.
Keep the comparison consistent
Choose one import method for a prepared batch. To try the other method independently, prepare another directory and batch, then use that directory consistently in its commands. Importing both batches into the same site creates six sample documents in total.
Do not regenerate IDs to retry a failed import. Retain the original mapping, inspect the affected records, and replay only work that is safe to repeat. The API walkthrough explains ambiguous create responses; the CLI walkthrough explains retries by stage and row.
Expected result and scope
For one completed batch, expect three mapped documents, their three original files, and the three sample attribute values on each document. The common verification checks those IDs, paths, content types, attributes, byte counts, and downloaded SHA-256 checksums.
The API example uses presigned URLs to upload current content and verifies it through separate content downloads. It handles string attributes and files up to 1 MiB sequentially to keep memory use bounded. That is an example limit, not a FormKiQ upload limit. It does not migrate versions, artifacts, audit history, users, permissions, retention controls, or active workflows. Add and test the mappings required for your source before expanding beyond the sample.
After either walkthrough, continue to Export and Verify a Migration Sample.