API Guide

Fetch passages from the Maronite liturgical Bible (Arabic) as JSON, using a standard Bible reference in English or Arabic: the whole New Testament verse by verse, and the Old Testament readings of the lectionary.

…

Base URL

https://example.com/api/v1/ar/
RequestReturns
?ref=<reference>Passages for a reference written in standard notation
?book=…&chapter=…A passage given as separate parameters
?booksAll 73 books: verses per chapter (New Testament), readings (Old Testament)

1. Get passages by reference

/api/v1/ar/?ref=Mat 5:3; 6:9–13
/api/v1/ar/?ref=متى ٥/٣؛ ٦/٩-١٣

URL-encode the reference (encodeURIComponent in JavaScript, rawurlencode in PHP).

Notation

WriteTo getExample
Book C:Vone verseJohn 3:16
Book C:V-Va range of versesMat 5:3-12
Book C:V-C:Va range across chaptersMt 5:48-6:4
Book C:V, V, V-Vseveral verses of one chapterMk 1:1, 4-8, 14
Book Ca whole chapter1 Cor 13
Book C-Cseveral chaptersRom 5-6
Booka whole bookJude
A; Bseveral passages; a part without a book continues the previous bookMat 5:3; 6:9-13

Single-chapter books (Philemon, 2 John, 3 John, Jude) are cited by verse: Jude 3-5.

English or Arabic, any digits

Response

{
  "query": "Mat 6:9-10",
  "passages": [
    {
      "reference": "MAT 6:9-10",
      "reference_ar": "متى 6/9-10",
      "book": { "id": 47, "code": "MAT", "code_ar": "متى", "testament": "NT", "name": "إنجيل سيِّدنا يسوع المسيح كما رواه متّى" },
      "from": { "chapter": 6, "verse": 9 },
      "to":   { "chapter": 6, "verse": 10 },
      "verses": [
        { "chapter": 6, "verse": 9,  "text": "أَمَّا أَنْتُم فَصَلُّوا هكَذَا: …" },
        { "chapter": 6, "verse": 10, "text": "لِيَأْتِ مَلَكُوتُكَ، …" }
      ]
    }
  ],
  "errors": []
}
FieldMeaning
passagesOne entry per range, in the order requested
reference / reference_arThe range in standard form, in English (MAT 5:3-12) and Arabic (متى 5/3-12)
bookid (1–73, Catholic canonical order), code, code_ar, testament (OT/NT), name
from / toFirst and last verse returned
verseschapter, verse, text
verses[].readingsOnly on verses where a liturgical reading begins, e.g. ["يو 2/1-15"]
errorsProblems with parts of the reference that could not be resolved

A range running past the end of a chapter stops at its last verse. Verses the edition omits (e.g. Mt 23:14) have the text ....

2. Get a passage by parameters

ParameterDescription
book (required)English code, Arabic code, abbreviation, or id (1–73)
chapterStart chapter. Omit for the whole book
verseStart verse. Omit for the whole chapter
to_chapterEnd chapter. Defaults to chapter
to_verseEnd verse. Defaults to verse if only verse is given, otherwise the end of the chapter
/api/v1/ar/?book=MAT&chapter=5                                  Matthew 5
/api/v1/ar/?book=MAT&chapter=5&verse=3&to_verse=12              Matthew 5:3-12
/api/v1/ar/?book=JHN&chapter=3&verse=16&to_chapter=4&to_verse=2  John 3:16-4:2
/api/v1/ar/?book=متى&chapter=٥                                  Matthew 5
/api/v1/ar/?book=73                                             Revelation
/api/v1/ar/?book=ISA&chapter=42&verse=1                          Isaiah 42:1-8 (an Old Testament reading)

The response is the same as above, without query.

Liturgical mode

By default the API returns the biblical text. Add mode=liturgical to a ?ref= or ?book= request to get the text as it is read in the liturgy.

/api/v1/ar/?ref=لو 13/6-9&mode=liturgical
{
  "query": "لو 13/6-9",
  "mode": "liturgical",
  "passages": [
    {
      "reference": "LUK 13:6-9",
      "reading": { "id": 123, "label": "لو 13/6-9" },
      "text": "قالَ الربُّ يَسوعُ هذَا المَثَل: «كَانَ لِرَجُلٍ…\nفقالَ لِلكَرَّام…",
      "verses": [
        { "chapter": 13, "verse": 6, "text": "قالَ الربُّ يَسوعُ هذَا المَثَل: «…", "override": true },
        …
      ],
      …
    }
  ],
  "errors": []
}

mode=bible (the default) returns the text unchanged. Any other value is an error.

Old Testament

The Maronite Church has no full Arabic translation of the Old Testament, only the readings of the lectionary. These readings are available, each as a whole: there is no verse-by-verse text.

/api/v1/ar/?ref=أش 42/1-8
/api/v1/ar/?ref=Isa 61:1
/api/v1/ar/?ref=يون 2                 (a chapter alone works when only one reading starts in it)
{
  "query": "أش 42/1-8",
  "passages": [
    {
      "reference": "ISA 42:1-8",
      "reference_ar": "أش 42/1-8",
      "book": { "id": 29, "code": "ISA", "code_ar": "أش", "testament": "OT", "name": "سفر أشعيا" },
      "from": { "chapter": 42, "verse": 1 },
      "to":   { "chapter": 42, "verse": 8 },
      "source": "lectionary",
      "reading": { "id": 21106, "label": "…", "title": "قراءة العهد القديم في …", "day": "…" },
      "text": "هُوَذَا عَبْدِي الَّذِي أَعْضُدُهُ…",
      "verses": null
    }
  ],
  "errors": []
}

3. List the books

/api/v1/ar/?books
{
  "books": [
    {
      "id": 29, "code": "ISA", "code_ar": "أش", "testament": "OT", "name": "سفر أشعيا",
      "chapters": [],
      "readings": [ { "id": 21106, "reference": "ISA 42:1-8", "reference_ar": "أش 42/1-8", "title": "…", "day": "…" }, … ]
    },
    …
    {
      "id": 47, "code": "MAT", "code_ar": "متى", "testament": "NT", "name": "إنجيل سيِّدنا يسوع المسيح كما رواه متّى",
      "chapters": [ { "chapter": 1, "verses": 25 }, { "chapter": 2, "verses": 23 }, … ]
    },
    …
  ]
}

Books are numbered in the Catholic canonical order: 1 Genesis … 46 Malachi, 47 Matthew … 73 Revelation.

Book codes

idcodecode_aridcodecode_aridcodecode_ar

Errors

Each part of a reference is resolved separately: valid parts come back in passages, the others are explained in errors.

ExampleError
Xyz 1:1Unknown book "Xyz"
6:9No book given for "6:9"
Mat 29MAT has no chapter 29 (it has 28)
Mat 5:99MAT 5 has no verse 99 (it has 48)
Mat 5:12-3Range ends before it starts in MAT 5:12-5:3
Mat 5:3xCannot read "5:3x" in MAT
HTTP statusWhen
200At least one passage found (other parts may still have errors)
400Nothing could be resolved, a parameter is invalid, or no parameters were given
500The database is unavailable

Code examples

JavaScript

const res = await fetch('https://example.com/api/v1/ar/?ref=' + encodeURIComponent('يو ١٥/٩-١٧'));
const { passages, errors } = await res.json();
for (const p of passages) {
  console.log(p.reference_ar);
  for (const v of p.verses) console.log(v.verse, v.text);
}

PHP

$json = file_get_contents('https://example.com/api/v1/ar/?ref=' . rawurlencode('Mat 5:3-12'));
$data = json_decode($json, true);
foreach ($data['passages'][0]['verses'] as $v) {
    echo "{$v['verse']} {$v['text']}\n";
}

curl

curl "https://example.com/api/v1/ar/?book=MAT&chapter=5&verse=3&to_verse=12"