Skip to content

Migration: Segment Info API #557

Description

@Tech-lo

OpenPecha API

GET /v2/segments/{segment_id}/related
Param Type In Required Description
segment_id string path Yes OP segment ID

Response (200) — segment_id=y2Yet24bsXbKeRU8fd55t:

[
  {
    "id": "8DX0DiD3I9vP5x4a9OxpV",
    "lines": [{ "end": 96, "start": 50 }],
    "manifestation_id": "rs02tl3E89TH6VKVhI8bB",
    "text_id": "PqT7jXsnVD8WUJIUtPXw9"
  }
]
Code Description
200 Related segments retrieved successfully
404 Resource not found
500 Internal server error

Replaces WeBuddhist API:

GET /api/v1/segments/{segment_id}/info
Param Type In Required Description
segment_id string path Yes WeBuddhist segment ID

Response (200) — segment_id=048576e2-b2bc-4275-9d6c-220ca7357f3c:

{
  "segment_info": {
    "segment_id": "048576e2-b2bc-4275-9d6c-220ca7357f3c",
    "text_id": "e159959d-2c0c-4f48-b02c-fbdc8c4a98e3",
    "translations": 2,
    "related_text": {
      "commentaries": 1,
      "root_text": 0
    },
    "resources": {
      "sheets": 0
    }
  }
}
Code Description
200 Successful Response
422 Validation Error

To determine whether a related segment is a commentary or translation, call GET /v2/texts/{text_id} with the text_id from each related segment — the commentary_of / translation_of fields indicate the type.

Response Mapping

OP: GET /v2/segments/{segment_id}/related
Replaces: GET /api/v1/segments/{segment_id}/info

WeBuddhist OpenPecha Notes
segment_info WeBuddhist wrapper object
segment_info.segment_id From request path
segment_info.text_id WeBuddhist-only
segment_info.translations WeBuddhist: count. OP: returns related segment objects, frontend must count
segment_info.related_text.commentaries WeBuddhist: count. OP: no count, frontend must derive from related segments
segment_info.related_text.root_text WeBuddhist: count. OP: no count, frontend must derive from related segments
segment_info.resources WeBuddhist-only
segment_info.resources.sheets WeBuddhist-only
[].id New. Related segment ID
[].lines[] New. Span offsets (start, end)
[].manifestation_id New. Edition ID
[].text_id New. Expression ID

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions