Skip to content

GO-3234 Add batch object fetch endpoint - #3238

Open
Namasivaayam-L wants to merge 1 commit into
anyproto:developfrom
Namasivaayam-L:GO-3234-batch-get-objects
Open

GO-3234 Add batch object fetch endpoint#3238
Namasivaayam-L wants to merge 1 commit into
anyproto:developfrom
Namasivaayam-L:GO-3234-batch-get-objects

Conversation

@Namasivaayam-L

@Namasivaayam-L Namasivaayam-L commented Aug 10, 2026

Copy link
Copy Markdown

What

Adds a new endpoint POST /v1/spaces/{space_id}/objects/batch that retrieves multiple objects by their IDs in a single request. Not-found objects return null in the response array, preserving input order.

Why

  • anytype-api#36 requests batch fetch by ID
  • The anytype-api spec (PR anytype-api#98) defines this endpoint
  • Avoids N+1 request overhead when operating on known object sets

Changes

File Change
core/api/model/object.go Add BatchGetObjectsRequest
core/api/service/object.go Add BatchGetObjects method with bounded concurrency (10 parallel) + ErrFailedRetrieveBatchObject, ErrBatchTooManyIds errors
core/api/handler/object.go Add BatchGetObjectsHandler with swag annotations
core/api/server/router.go Register POST /spaces/:space_id/objects/batch route
core/api/docs/* Regenerated via make openapi

Tests

  • Service: 5 test cases (success, empty IDs, >100 IDs, not-found entries, order preservation)
  • Router: 3 test cases (unauthorized, success with null entries, invalid body 400)
  • All go test ./core/api/... passing

Post-merge tasks

  • Update anytype-api spec PR speed up app closing #98 to reference this implementation
  • MCP proxy will auto-generate API-get-objects-batch tool from live spec (no MCP-side changes needed)

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@Namasivaayam-L

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant