Add bulkFetch API for synchronous multi-document retrieval#745
Merged
stevevanhooser merged 3 commits intomainfrom Apr 16, 2026
Merged
Add bulkFetch API for synchronous multi-document retrieval#745stevevanhooser merged 3 commits intomainfrom
stevevanhooser merged 3 commits intomainfrom
Conversation
Thin MATLAB client for the new POST /datasets/:id/documents/bulk-fetch
cloud endpoint: a synchronous companion to the async bulk-download
pipeline that fetches up to 500 documents (with full data) in a single
call. Intended for small sets (e.g. a subset of IDs returned by
/ndiquery) where the async zip/S3 round-trip would be overkill.
Adds:
- ndi.cloud.api.documents.bulkFetch (user-facing wrapper)
- ndi.cloud.api.implementation.documents.BulkFetch (implementation
class, following the same pattern as BulkDeleteDocuments and
GetBulkDownloadURL, including the scalar-string duplication
workaround for JSON array encoding).
- new 'bulk_fetch_documents' entry in ndi.cloud.api.url.
- four tests appended to ndi.unittest.cloud.DocumentsTest:
* round-trip fetch of N documents, verifying IDs/names
round-trip correctly (order-insensitive).
* mixing a real ID with a bogus-but-syntactically-valid 24-hex
ID is silently omitted, not an error.
* a malformed (non-hex) ID in the list is rejected with HTTP 400.
* an empty documentIds array is rejected with HTTP 400.
stevewds
approved these changes
Apr 16, 2026
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.
Summary
This PR adds a new
bulkFetchAPI endpoint to enable synchronous fetching of multiple documents by ID from the NDI Cloud in a single call. This complements the existing asynchronous bulk download pipeline and is optimized for small document sets.Key Changes
ndi.cloud.api.implementation.documents.BulkFetchclass that handles the HTTP POST request to the bulk fetch endpoint with proper authentication and error handlingndi.cloud.api.documents.bulkFetch()function that provides a clean interface for calling the bulk fetch APIndi.cloud.api.url()to include the newbulk_fetch_documentsendpoint mappingtestBulkFetchRoundTrip: Validates successful bulk fetch of multiple documents with correct contenttestBulkFetchSilentlyOmitsUnknownIDs: Verifies that nonexistent document IDs are silently omitted (not an error)testBulkFetchRejectsMalformedIDs: Ensures malformed IDs are rejected with HTTP 400testBulkFetchRejectsEmptyList: Confirms empty document ID arrays are rejected with HTTP 400Implementation Details
https://claude.ai/code/session_014buyoUmSXQ8HyGZgzNQ8hZ