API

Javni REST API za dostop do svetopisemskih besedil, verza dneva in seznama prevodov. Odgovori so v formatu JSON (UTF-8).

Avtorske pravice. Besedila prevodov so zaščitena po avtorskem pravu posameznih izdajateljev. API uporabljaj v skladu z licencami; vsak odgovor vključuje polje copyright z atribucijo, ki jo je treba navajati.

Osnovni naslov

https://biblija.hozana.si/api/v1

Avtentikacija

Vsak zahtevek zahteva API ključ. Ključ dobiš (in regeneriraš) na strani Profil (potrebna je prijava). Pošlji ga v glavi:

Authorization: Bearer bib_xxxxxxxxxxxxxxxxxxxxxxxx

Alternativno je podprta tudi glava X-API-Key: <ključ>. Ključa nikoli ne pošiljaj v URL-ju.

Omejitev (rate limit)

100 zahtev na dan na ključ. Vsak odgovor vsebuje glave X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset. Ob preseženi meji vrne 429 in glavo Retry-After.

Endpointi

Primeri v:

GET /translations

Seznam prevodov, ki so na voljo (z oznakami za parameter translation).

curl -H "Authorization: Bearer bib_xxxxxxxxxxxxxxxxxxxxxxxx" \
  "https://biblija.hozana.si/api/v1/translations"
const res = await fetch("https://biblija.hozana.si/api/v1/translations", {
  headers: { Authorization: "Bearer bib_xxxxxxxxxxxxxxxxxxxxxxxx" }
});
if (!res.ok) throw new Error((await res.json()).error.message);
const { data } = await res.json();
console.log(data);
import requests

r = requests.get(
    "https://biblija.hozana.si/api/v1/translations",
    headers={"Authorization": "Bearer bib_xxxxxxxxxxxxxxxxxxxxxxxx"}, timeout=10)
r.raise_for_status()
print(r.json()["data"])
<?php
$ch = curl_init("https://biblija.hozana.si/api/v1/translations");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["Authorization: Bearer bib_xxxxxxxxxxxxxxxxxxxxxxxx"],
]);
$data = json_decode(curl_exec($ch), true);
print_r($data["data"]);

GET /passage

Odlomek po referenci v izbranem prevodu.

ParameterObvezenOpis
translationdaOznaka prevoda (npr. KJV, SSP3).
referencedaReferenca, npr. Jn 3,16, Mt 5,1-12 ali Ps 23.
curl -H "Authorization: Bearer bib_xxxxxxxxxxxxxxxxxxxxxxxx" \
  "https://biblija.hozana.si/api/v1/passage?translation=KJV&reference=Jn%203,16"
const res = await fetch("https://biblija.hozana.si/api/v1/passage?translation=KJV&reference=Jn%203,16", {
  headers: { Authorization: "Bearer bib_xxxxxxxxxxxxxxxxxxxxxxxx" }
});
if (!res.ok) throw new Error((await res.json()).error.message);
const { data } = await res.json();
console.log(data);
import requests

r = requests.get(
    "https://biblija.hozana.si/api/v1/passage?translation=KJV&reference=Jn%203,16",
    headers={"Authorization": "Bearer bib_xxxxxxxxxxxxxxxxxxxxxxxx"}, timeout=10)
r.raise_for_status()
print(r.json()["data"])
<?php
$ch = curl_init("https://biblija.hozana.si/api/v1/passage?translation=KJV&reference=Jn%203,16");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["Authorization: Bearer bib_xxxxxxxxxxxxxxxxxxxxxxxx"],
]);
$data = json_decode(curl_exec($ch), true);
print_r($data["data"]);

GET /verse-of-the-day

Verz dneva. Neobvezni parameter translation (privzeto SSP3).

curl -H "Authorization: Bearer bib_xxxxxxxxxxxxxxxxxxxxxxxx" \
  "https://biblija.hozana.si/api/v1/verse-of-the-day?translation=KJV"
const res = await fetch("https://biblija.hozana.si/api/v1/verse-of-the-day?translation=KJV", {
  headers: { Authorization: "Bearer bib_xxxxxxxxxxxxxxxxxxxxxxxx" }
});
if (!res.ok) throw new Error((await res.json()).error.message);
const { data } = await res.json();
console.log(data);
import requests

r = requests.get(
    "https://biblija.hozana.si/api/v1/verse-of-the-day?translation=KJV",
    headers={"Authorization": "Bearer bib_xxxxxxxxxxxxxxxxxxxxxxxx"}, timeout=10)
r.raise_for_status()
print(r.json()["data"])
<?php
$ch = curl_init("https://biblija.hozana.si/api/v1/verse-of-the-day?translation=KJV");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["Authorization: Bearer bib_xxxxxxxxxxxxxxxxxxxxxxxx"],
]);
$data = json_decode(curl_exec($ch), true);
print_r($data["data"]);

Primer odgovora

{
  "data": {
    "reference": "Jn 3,16",
    "translation": { "abbreviation": "KJV", "name": "King James Version", "language": "eng" },
    "verses": [
      {
        "book": "John", "book_abbrev": "Jhn", "chapter": 3, "verse": 16,
        "reference": "Jhn 3,16",
        "text": "For God so loved the world, ..."
      }
    ],
    "copyright": "Public Domain"
  }
}

Napake

{ "error": { "code": "reference_not_found", "message": "Reference ni mogoče najti: ..." } }
KodaHTTPPomen
missing_api_key / invalid_api_key401Manjkajoč ali napačen ključ.
invalid_translation / missing_parameter400Napačen vnos.
reference_not_found / not_found404Ni zadetka / neznan endpoint.
rate_limit_exceeded429Presežena dnevna meja.

← Volver al inicio