Browse Community Interaction

beta · guide · 0.1.0

Create and list resource comments

Before every request, the Project Backend verifies its own session, Project Membership, resource visibility, and interaction policy. MiniCenter never fetches the resource or infers those decisions. Keep the Project Credential server-side and request only comments:write and comments:read as needed.

Shell example
: "${MINICENTER_URL:?set the Sandbox URL}"
: "${MINICENTER_PROJECT_CREDENTIAL:?set a Project Credential}"

curl --fail-with-body -X POST "${MINICENTER_URL}/api/v1/community/comments" \
  -H "Authorization: Bearer ${MINICENTER_PROJECT_CREDENTIAL}" \
  -H 'Content-Type: application/json' \
  --data '{"platform_account_id":"30000000-0000-4000-8000-000000000003","resource_type":"article","resource_id":"article-42","body":"A useful comment.","idempotency_key":"article-42-comment-1"}'

Reuse the same idempotency_key only when retrying the identical author, resource, and body. An identical replay returns HTTP 200 and the original Comment; changed input returns 422. A first creation returns 201.

The first successful creation also publishes one client-scoped community.comment.accepted Domain Event in the same database transaction. It identifies the Comment and resource but omits the Platform Account and body. Subscribe through Events & Webhooks, verify the webhook signature, and deduplicate at-least-once delivery by the envelope id; a create replay publishes no second logical event.

Shell example
curl --get --fail-with-body "${MINICENTER_URL}/api/v1/community/comments" \
  -H "Authorization: Bearer ${MINICENTER_PROJECT_CREDENTIAL}" \
  --data-urlencode 'resource_type=article' \
  --data-urlencode 'resource_id=article-42' \
  --data-urlencode 'limit=50'

Results are oldest-first and never cross the credential's Project Client or the exact resource. When next_after is non-null, repeat the request with that value as after. A cursor from another resource returns 422.

An author-removed Comment remains in this ordering as a tombstone with body: null and a non-null removed_at; its immutable revision number and moderation state remain visible. Do not render reaction counts for a tombstone.

body is UTF-8 text up to 4,000 characters. Treat it as untrusted text and HTML-escape it when rendering. MiniCenter rejects inactive Platform Accounts, but that does not replace the Project Backend's current authorization decision. If MiniCenter is unavailable or the result is uncertain, keep the Project Backend's resource usable without comments and retry only with the original idempotency key; creation and its durable event either commit together or both fail.