Skip to content

REST API Reference

The AS Community API is a tenant-scoped JSON API.

Headers

All requests send:

text
x-tenant-id: <tenant-id>

Write operations also require:

text
x-fcm-token: <firebase-cloud-messaging-token>

Endpoints

MethodPathPurpose
GET/moderation/articlesList article IDs that currently have comments
GET/articles/{articleId}/commentsGet top-level comments
POST/articles/{articleId}/commentsCreate a comment or reply
PUT/articles/{articleId}/comments/{commentId}Edit a comment
DELETE/articles/{articleId}/comments/{commentId}Soft-delete a comment
GET/articles/{articleId}/comments/{commentId}/repliesGet replies for a comment
POST/articles/{articleId}/comments/{commentId}/voteCast or change a vote
DELETE/articles/{articleId}/comments/{commentId}/voteRemove a vote

GET /moderation/articles

Returns distinct article IDs that currently have comments.

Query parameters:

  • limit: 1-500, default 200

Example response:

json
{
  "articleIds": ["article-1", "article-2"],
  "count": 2
}

GET /articles/{articleId}/comments

Query parameters:

  • limit: 1-100
  • cursor: pagination cursor
  • sort: 'new' | 'score'

Response:

json
{
  "comments": [],
  "nextCursor": null,
  "hasMore": false
}

POST /articles/{articleId}/comments

Request body:

json
{
  "content": "My comment",
  "parentId": "optional-parent-uuid"
}

content must be 1 to 280 characters.

PUT /articles/{articleId}/comments/{commentId}

Request body:

json
{
  "content": "Updated text"
}

The server re-moderates edited comments.

GET /articles/{articleId}/comments/{commentId}/replies

Query parameters:

  • limit
  • cursor

Response:

json
{
  "replies": [],
  "nextCursor": null,
  "hasMore": false
}

Comment Shape

json
{
  "commentId": "uuid",
  "articleId": "article-123",
  "content": "Great article!",
  "parentId": null,
  "depth": 0,
  "visible": true,
  "moderationStatus": "approved",
  "upvotes": 42,
  "downvotes": 3,
  "netScore": 39,
  "deleted": false,
  "createdAt": "2024-01-15T10:30:00Z",
  "updatedAt": "2024-01-15T10:30:00Z",
  "editedAt": null,
  "authorType": "human",
  "isOwnComment": false,
  "replyCount": 5
}

OpenAPI

The source of truth is packages/contracts/api-spec/openapi.yaml.