-
Notifications
You must be signed in to change notification settings - Fork 0
Text
James Cuénod edited this page Jun 8, 2024
·
8 revisions
Endpoint: /api/v2/text
Parameter | Description | Explanation |
---|---|---|
modules | A case insensitive, comma separated list of module abbreviations. | "Modules" are Bible versions, including original languages and modern translations. A list of valid module abbreviations may be found at the module endpoint. |
reference | A comma separated list of book/chapter/verse references (including ranges). | Books currently only include the Protestant canon but Parabible aspires to handle additional literature (e.g., the Apostolic Fathers [now included!]). The server can parse ranges and comma separated values (e.g., "Gen 2:1–3, Exod 20:1"). |
Example: /api/v2/text?modules=ULT&reference=Gen2:1-3,exod20:1
Types for the /text
endpoint return are:
type HtmlString = string
type WordArray = {
wid: number
leader?: string
text: string
trailer?: string
}[]
type MatchingText = {
parallelId: number
moduleId: number
rid: number
type: "wordArray" | "html"
html: HtmlString
wordArray: WordArray
}
type TextEndpointResult = MatchingText[][]
Property | Description |
---|---|
parallelId | A non-consecutive identifier of verses that should be aligned (to solve the various versification differences). |
moduleId | Module identifier. Modules names/abbreviations may be mapped to module IDs by using data from the module endpoint. |
rid | Reference ids represent book/chapter/verse in an integer. For example 1001001 is Gen 1:1 |
type | An enum that indicates whether the html or wordArray field will be popuated. |
html | A string that should be rendered as sanitized HTML (could include paragraph breaks, for example). |
wordArray | As indicated by the WordArray type definition, an array of word "parts" that must be concatenated to produce text. The wid may be used for lookups in conjunction with the moduleId against the word endpoint. |
To display this data, the order
key must be used to sort the matchingText
.
Passing a WordArrayString
into JSON.parse
will produce WordOrFootnote[]
result.
type WordOrFootnote = Word | Footnote
type Word = {
wid: number,
leader?: string,
text: string,
trailer?: string,
}
type Footnote = {
fid: number,
leader?: string,
text: string,
trailer?: string,
}
Property | Description |
---|---|
wid | Module specific word ID. Morphological data about words may be looked up using the word endpoint. |
fid | Module specific footnote ID. (TODO: Footnote endpoint API is not yet specced). |
leader | [Optional] String that appears before the word/footnote text and is not a part of the word/footnote (e.g. an opening brackets). |
text | The text of the word/footnote. |
trailer | [Optional] String that appears after the word/footnote text and is not a part of the word/footnote (e.g. a closing bracket or a maqqef). |