Ingestion file upload
Overview
Using files to ingest codes is common which is why Scantrust supports uploading codes using CSV
and JSON
formatted files directly. The files must be UTF-8 encoded.
To use file uploads, the mode needs to be set to file
in the initial record creation using one of the available upload methods. Scantrust supports files up to 100 MB each.
When using mode=file
the API will respond with a url
and fields
which need to be dynamically used for uploading the file and are valid for 30 minutes.
Example CSV file
id,product,pallet_number,intended_market
abc12345,sku1,pal1,BE
def12345,sku1,pal1,NL
ghi12345,sku1,pal2,DE
jkl12345,sku1,pal2,FR
...
Example JSON file
[
{
"id": "abc-abc1-dfg",
"pallet_nr": "123"
},
{
"id": "aa748ec8-6742-11",
"pallet_nr": "345"
},
{
"id": "hij-hij3",
"pallet_nr": "567",
"activation_status": 0
}
]
...
API Design
Upload the File to our file server
POST { DYNAMIC URL }
This call uses the URL retrieved in the previous call from any chosen method with mode=file
to upload your file for processing by Scantrust. The fields retrieved in the fields dictionary must all be dynamically posted to the given URL. The content and amount of fields might change overtime.
Fields | Value | Description |
---|---|---|
{fields} | fields | All fields dynamically retrieved by the get-post-data endpoint |
Response (201): Created
POST /api/v2/ingestion/codes/process-from-file/
Starts the ingestion process from a file previously uploaded to the S3 storage by calling the post-data endpoint. The process is started asynchronously.
Fields | Value | Description |
---|---|---|
record | string | Record |
Example
{
"record": "xvg24feojYz",
}
Example Response 200 OK
{
"record_key": "xvg24feojYz"
}
Error responses
HTTP Code | Message | Reason |
---|---|---|
400 | Only code ingestion records of type 'file' in state 'uploading' can be processed. | Triggered when posting a record which is in the wrong state |
400 | Invalid record | Triggered when a non-existing record is posted |