Files
dashback/docs/api/routes/company/import.md
2026-10-08 02:53:32 +02:00

42 lines
1.1 KiB
Markdown

# `POST /company/import`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Import company catalog from zip archive (SSE)
Uploads a .zip archive containing company export data (categories, articles, pictures),
preserves archive contents under `data/import/<companyId>/`, and executes full catalog
import (categories hierarchy, articles upsert, variant linking, image processing).
Streams progress events via Server-Sent Events (`text/event-stream`).
## Body (`multipart/form-data`)
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `file` | no | file | ZIP archive (.zip) containing company data |
## Response `200`
Import progress stream (`text/event-stream`) or JSON result
```json
{
"ok": true,
"message": "Import erfolgreich abgeschlossen.",
"stats": {}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Bad request (missing file, not a zip, or no company selected) — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 500 | Server error — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._