Spaces:
Sleeping
Sleeping
| # Backend endpoints (upload service β your backend) | |
| Your backend implements two endpoints. The upload service calls them. | |
| --- | |
| ## POST /update (progress, multiple times per job) | |
| **Headers:** `Content-Type: application/json`; optional `Authorization: <task_auth_token>` | |
| **Body:** | |
| ```json | |
| { | |
| "doc_id": "string", | |
| "finished": 1, | |
| "total": 4, | |
| "message": "string", | |
| "project_id": "string" | |
| } | |
| ``` | |
| - `doc_id` β document/job id | |
| - `finished` β current step (1β4) | |
| - `total` β always 4 | |
| - `message` β e.g. "Downloading...", "Parsing document...", "Upload complete" | |
| - `project_id` β optional, if client sent it | |
| **Respond:** 200 | |
| --- | |
| ## POST /finish (once per job) | |
| **Headers:** `Content-Type: application/json`; optional `Authorization: <task_auth_token>` | |
| **Body (success):** | |
| ```json | |
| { | |
| "status": "complete", | |
| "doc_id": "string", | |
| "project_id": "string" | |
| } | |
| ``` | |
| **Body (failure):** | |
| ```json | |
| { | |
| "status": "failure", | |
| "doc_id": "string", | |
| "message": "string", | |
| "project_id": "string" | |
| } | |
| ``` | |
| - `doc_id` β same as the doc_id used to start the job | |
| - `project_id` β optional | |
| **Respond:** 200 | |