Express courier. Direct.
Also overnight.
x25pronto Switzerland takes goods direct to the destination. Small loads go by car. Larger loads go by van or Van XL. Direct, express and overnight trips run Monday to Sunday when a slot is free. Free times are shown in the booking calendar. This keeps the plan clear.
Template: CSV import schema and Python script for on-call blocks
A clear CSV layout and a Python example that validates on-call blocks and uploads them via API. Built to integrate with Swiss ERPs and backends.
Quick answer
This post provides a straightforward CSV import schema and a practical Python script to validate on-call blocks locally and upload them to your ERP or internal backend via API. The example checks headers, types, business rules and only sends data when all rows pass validation. It fits Swiss procurement and logistics workflows and can be adapted to any ERP endpoint.
What this covers
Companies often manage on-call blocks in spreadsheets. For automation you need a clean CSV format and reliable checks. This tutorial shows a simple schema, validation rules and a Python script for REST upload. The aim: fewer errors and faster imports into ERPs used in Zurich, Basel or Geneva.
Recommended CSV import schema
Header (recommended order): - contract_id: string, required - sku: string, required - supplier_id: string, required - start_date: ISO-8601 (YYYY-MM-DD), required - end_date: ISO-8601 (YYYY-MM-DD), optional - quantity_total: integer ≥ 0, required - quantity_available: integer ≥ 0 ≤ quantity_total, required - location_code: string (optional, e.g. CH ZIP or site ID) - notes: optional Save as UTF-8 without BOM. Use dot for decimals and ISO dates for consistent parsing.
Core validation rules
Check file basics: UTF-8, header present, no empty lines. Per row validate: - required fields present and non-empty - data types (integer, string, date) - numeric ranges: quantity_total ≥ 0, quantity_available between 0 and quantity_total - date logic: start_date ≤ end_date (if end_date set) - uniqueness: contract_id + sku should not repeat within a batch Report invalid rows; do not auto-overwrite existing data.
Python example: flow and behavior
The script is split into three steps: 1) Read and parse with csv.DictReader 2) Validate with clear row-level messages 3) Build JSON payload and POST with requests It prints a validation summary and only posts when all rows are valid. You can add hooks to pre-check against your ERP API before upload.
Security, error handling and idempotency
Use HTTPS and protect endpoints with API keys or OAuth. Implement idempotency keys (e.g. batch_id + timestamp) on POST so repeated calls do not create duplicate blocks. Log attempts and responses. On 4xx errors check payloads; on 5xx errors retry with exponential backoff.
Adapting to your Swiss ERP
ERPs (e.g. Abacus, SAP Business One, Bexio or in-house systems) often require different field names or payload wrappers. Add a mapping layer: CSV field → internal field → API field. Test first in a staging environment or a vendor sandbox.
Frequently asked questions
How do I test the script locally before production?
Run it against a local mock API, for example a small Flask or FastAPI endpoint that validates the JSON. You can also use Postman or a vendor sandbox.
What if many rows miss required data?
Export invalid rows to a separate CSV, fill missing values manually or with a helper script, then re-run validation. Automatic fill-in should only be used if rules are fully reliable.
How do I avoid duplicate uploads of the same file?
Create a batch ID (for instance a hash of the file plus timestamp) and send it with the request. Your ERP can then detect repeated uploads. Server-side idempotency helps too.
Can I handle multiple locations in one file?
Yes. Use location_code and document valid site IDs. Validate location_code against a reference table to avoid typos.

