Parameters & Example

Data Source ID

  1. Upload your initial data source from the Form Admin menu -> Data sources -> Add Data Source (link).
  2. Click View/Edit, then “Update Data” to find the data source’s ID.




File Details

A CSV file needs to be included in the PUT and POST calls. The file will need to meet these requirements:

  • Unique identifier column (which was identified when the data source was created) must contain unique values
  • Column headers must be unique
  • Column headers must include the headers existing in the current data source. File can contain new columns.

The Data Source Upload API is currently optimized for files up to 20,000 rows. While there is no enforced file size limit, uploading very large data sets may result in timeouts.


For additional information on setting up prefill for a form, including adding users to a data source, please refer to this article: https://help.informedk12.com/hc/en-us/articles/26159147874707-How-to-Set-Up-forms-to-be-Prefilled-by-a-Data-Source


Example

Data Source
	•	File needs to be UTF-8
	•	Content needs to be multipart/form-data

Powershell:

# Read CSV file content as plain text (not bytes)
$csvContent = Get-Content -Path $csvFilePath -Raw -Encoding UTF8

# Create a unique boundary string
$boundary = [System.Guid]::NewGuid().ToString()
$contentType = "multipart/form-data; boundary=$boundary"

# Build multipart/form-data request body as text
$body = @"
--$boundary
Content-Disposition: form-data; name="file"; filename="$(Split-Path $csvFilePath -Leaf)"
Content-Type: text/csv
$csvContent
--$boundary--
"@

# Send PUT request
$response = Invoke-RestMethod -Uri $url -Method Put -Headers $headers -Body $body -ContentType $contentType
Example 2

    $boundary = [System.Guid]::NewGuid().ToString()
    $fileBytes = [System.IO.File]::ReadAllBytes($csvFilePath)
    $fileName = [System.IO.Path]::GetFileName($csvFilePath)
    # Construct multipart/form-data body
    $LF = "`r`n"
    $bodyLines = (
        "--$boundary",
        "Content-Disposition: form-data; name=`"file`"; filename=`"$fileName`"",
        "Content-Type: text/csv$LF",
        [System.Text.Encoding]::UTF8.GetString($fileBytes),
        "--$boundary--$LF"
    ) -join $LF
    $headers = @{
        "Authorization" = "Bearer $apiToken"
        "Content-Type"  = "multipart/form-data; boundary=$boundary"
        "Accept"        = "application/json"
    }
    $response = Invoke-WebRequest -Uri $apiUrl -Method PUT -Headers $headers -Body $bodyLines -ErrorAction