Drop the multi-step upload; use POST /documents/upload everywhere#2
Merged
Conversation
The External API removed the multi-step upload (POST /documents -> S3 PUT -> PUT /documents/{id}), leaving the single multipart endpoint POST /documents/upload. The CLI and examples now use it exclusively: the CLI always uses UploadMultipart (removed the --single-request flag, the 3-step branch, and the unused UploadToS3 client method); the TypeScript and Python examples do one multipart request; READMEs document only the single upload.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the demo CLI, examples, and docs to use the External API’s single multipart upload endpoint (POST /documents/upload) everywhere, removing the old 3-step upload flow.
Changes:
- Removed the CLI’s 3-step upload branch and the
--single-requestflag;uploadnow always uses multipart upload. - Updated the TypeScript and Python examples to upload via a single multipart request.
- Updated documentation to describe only the single-request upload flow.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Removes 3-step upload docs; documents multipart upload as the only flow. |
| examples/typescript/upload-and-poll.ts | Switches to multipart upload via fetch + FormData. |
| examples/python/sync-polling.ipynb | Switches to multipart upload via httpx; removes create/S3/complete steps. |
| cli/README.md | Updates CLI docs/examples to reflect multipart-only upload. |
| cli/cmd/upload.go | Removes flag/branching and always uploads via UploadMultipart. |
| cli/api/client.go | Removes the S3 helper (UploadToS3); retains multipart upload client method. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- UploadMultipart now writes the `size` form field (exact byte count, len(data)) before the file part. POST /documents/upload requires [name, size, file] and rejects a mismatched byte count, so the prior body was incomplete. Brings the Go CLI in line with the TypeScript + Python examples and the README. - upload.go now errors explicitly when the upload response has no `id`, instead of silently polling /documents//processing/latest until timeout. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Both addressed in b5b1ad7:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The External API removed the multi-step upload (
POST /documents→ S3PUT→PUT /documents/{id}), leaving a single endpoint:POST /api/documents/upload. This updates the demo (CLI + examples) to use it exclusively.Changes
cli/cmd/upload.go,cli/api/client.go) —uploadalways uses the single multipart request; removed the--single-requestflag, the 3-step branch, and the now-unusedUploadToS3client method.examples/typescript/upload-and-poll.ts) — single multipart upload viafetch+FormData.examples/python/sync-polling.ipynb) — single multipart upload viahttpx; dropped the create / S3 / complete cells.README.md,cli/README.md) — document only the single upload.Verification
go build ./...,go vet ./...,gofmt -l— all clean.Pairs with LexSelect/lexselect#979 (the API change that removed the multi-step routes).
🤖 Generated with Claude Code