feat(api): add block object link REST endpoints with card presentation - #3200
Open
tayuLuc wants to merge 2 commits into
Open
feat(api): add block object link REST endpoints with card presentation#3200tayuLuc wants to merge 2 commits into
tayuLuc wants to merge 2 commits into
Conversation
Introduce UI-equivalent link block management through the REST API.
Links/backlinks now populate correctly when content is created via API,
matching desktop app behavior.
New endpoints:
POST /v1/spaces/{space}/objects/{obj}/blocks/{block_id}/link
DELETE /v1/spaces/{space}/objects/{obj}/blocks/{block_id}/link
Set or remove an object link on a text/link block via the same
internal BlockReplace path the editor uses — links and backlinks
derive normally.
New request fields on POST …/link:
target_object_id — required, the object to link to
link_style — page / dataview / dashboard / archive
card_style — text / card / inline
background_color — grey, yellow, orange, red, pink, purple,
blue, ice, teal, lime
icon_size — none / small / medium
link_description — none / added / content
relations — []string, relation keys to show on the card
PATCH …/objects now also accepts:
markdown_append — append markdown as new blocks without
removing existing content (mutually exclusive
with markdown)
GET …/objects/{id} now accepts:
?block_link_candidates=1 — returns text and link block ids with
metadata for the POST …/link workflow
Closes anyproto/anytype-mcp#105 (partial — block links & card style)
|
CLA Assistant Lite bot: I have read the CLA Document and I hereby sign the CLA 1 out of 2 committers have signed the CLA. |
Author
|
I have read the CLA Document and I hereby sign the CLA |
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
Add REST endpoints for managing object link blocks with full card presentation, matching desktop UI behavior. Links and backlinks now populate correctly when content is created via API.
New endpoints
POST /v1/spaces/{space_id}/objects/{object_id}/blocks/{block_id}/link — Set or update an object link on a block. A text block becomes a link block (card layout); an existing link block gets updated target and presentation. Uses the same internal BlockReplace path as the editor — links/backlinks derive normally.
DELETE /v1/spaces/{space_id}/objects/{object_id}/blocks/{block_id}/link — Remove a link block. Supports optional ?target_object_id= query parameter for safety.
New fields on PATCH …/objects
markdown_append — Append markdown as new blocks at the end without removing existing content. Mutually exclusive with markdown.
New query parameter on GET …/objects
?block_link_candidates=1 — Returns text and link block IDs with metadata (kind, text_preview, target_object_id, link_style, card_style, icon_size, link_description, relations, background_color) so clients can discover which blocks to operate on.
POST …/link request fields
Idempotency
When both link payload and block-level chrome (background_color) already match, the endpoint returns replaced: false and skips the BlockReplace call.
Related
Checklist