Upload Files for SmartConnector Runs
A SmartConnector typically runs against an input file you provide. If none is supplied, it falls back to the SmartConnector 's sample file. To use your own file, first upload it to Kizen's file storage. The presigned request in Get a Presigned Upload URL returns an s3object_id, which you confirm in Confirm the Upload with Kizen and then pass as source_file_id to the Start SmartConnector Flow API.
Get a Presigned Upload URL
Request a temporary presigned URL from Kizen's file storage service. This URL authorizes a direct upload to S3 and expires after a short window. Upload the file and confirm the upload before the expires_at timestamp in the response.
GET /api/s3/presigned-post
filename
string
Yes
The name of the file to upload, including extension (for example, data.csv).
contenttype
string
Yes
The MIME type of the file (for example, text/csv or application/vnd.openxmlformats-officedocument.spreadsheetml.sheet for XLSX).
source
string
Yes
Must be set to smart_connector_import.
Example request:
GET /api/s3/presigned-post?filename=data.csv&contenttype=text/csv&source=smart_connector_importExample response:
{
"url": "https://<bucket>.s3.amazonaws.com/",
"fields": {
"key": "...",
"Content-Type": "text/csv",
"acl": "private",
"tagging": "...",
"policy": "...",
"x-amz-algorithm": "...",
"x-amz-credential": "...",
"x-amz-date": "...",
"x-amz-signature": "..."
},
"s3object_id": "f9e8d7c6-...",
"max_file_size": 15000000,
"expires_at": "..."
}Response fields:
url
string
The S3 bucket URL to POST the file to in the upload process.
fields
object
Required form fields to include in the upload multipart POST. All fields must be included in the upload request.
s3object_id
string (UUID)
The Kizen identifier for this upload, a randomly generated ID. Pass this as the uuid parameter in the upload and as the source_file_id subsequent steps.
max_file_size
integer
Maximum allowed file size in bytes.
expires_at
string (datetime)
Timestamp after which the presigned URL is no longer valid.
Upload the File to S3
POST the file directly to the S3 URL. This request goes to S3 directly, not to the Kizen API.
POST {url from URL request response}
Send all fields returned in the fields Object from the URL request as multipart/form-data, with the file content appended last. Capture the ETag value from the S3 response header, since you will need it in subsequent steps.
Confirm the Upload with Kizen
Notify Kizen that the S3 upload completed successfully so the file is registered in the system and available for use as a SmartConnector run input.
POST /api/s3/success?source=smart_connector_import
Send as application/x-www-form-urlencoded:
uuid
string (UUID)
Yes
The s3object_id returned with the URL request.
key
string
Yes
The key value from the fields Object returned with the URL request.
name
string
Yes
The filename including extension ( data.csv).
etag
string
Yes
The ETag value from the S3 upload response header.
Once this request returns successfully, the file is registered in Kizen and ready to use as the input for a SmartConnector run.
What's Next?
Continue with the Start SmartConnector Flow API to run a SmartConnector against your uploaded file, passing the s3object_id as source_file_id.
Last updated
Was this helpful?