Versoeke maak
Om toegang tot die API te verkry, hoef jy net 'n HTTP GET-versoek na die regte eindpunt te maak.
Byvoorbeeld, om toegang tot die available_translations.json eindpunt te verkry, kan jy die volgende JavaScript- of cURL-opdrag gebruik:
fetch(`https://bible.helloao.org/api/available_translations.json`)
.then(request => request.json())
.then(availableTranslations => {
console.log('The API has the following translations:', availableTranslations);
});curl https://bible.helloao.org/api/available_translations.jsonHieronder vind u 'n lys van voorbeelde. Vir meer volledige dokumentasie, sien die Verwysingsdokumentasie .
Voorbeelde
Kry die lys van beskikbare vertalings
( verwysing )
GET https://bible.helloao.org/api/available_translations.json
fetch(`https://bible.helloao.org/api/available_translations.json`)
.then(request => request.json())
.then(availableTranslations => {
console.log('The API has the following translations:', availableTranslations);
});curl https://bible.helloao.org/api/available_translations.jsonLys boeke in 'n vertaling
( verwysing )
GET https://bible.helloao.org/api/{translation}/books.json
// Kry die lys van boeke vir die BSB-vertaling
fetch(`https://bible.helloao.org/api/BSB/books.json`)
.then(request => request.json())
.then(books => {
console.log('The BSB has the following books:', books);
});curl https://bible.helloao.org/api/BSB/books.jsonKry 'n hoofstuk uit 'n vertaling
( verwysing )
GET https://bible.helloao.org/api/{translation}/{book}/{chapter}.json
// Kry Genesis 1 uit die BSB-vertaling
fetch(`https://bible.helloao.org/api/BSB/GEN/1.json`)
.then(request => request.json())
.then(chapter => {
console.log('Genesis 1 (BSB):', chapter);
});curl https://bible.helloao.org/api/BSB/GEN/1.jsonKry 'n vereenvoudigde hoofstuk uit 'n vertaling
( verwysing )
GET https://bible.helloao.org/api/{translation}/{book}/{chapter}.simple.json
Gebruik dit wanneer jy net die teks van 'n hoofstuk wil hê. Elke vers bevat 'n enkele text string in plaas van 'n lys van geformateerde inhoud, so jy hoef nie self die teks te bou nie.
// Kry die teks van Genesis 1 uit die BSB-vertaling
fetch(`https://bible.helloao.org/api/BSB/GEN/1.simple.json`)
.then(request => request.json())
.then(chapter => {
for (let content of chapter.chapter.content) {
if (content.type === 'verse') {
console.log(`${content.number}. ${content.text}`);
}
}
});curl https://bible.helloao.org/api/BSB/GEN/1.simple.jsonKry die lys van beskikbare kommentare
( verwysing )
fetch(`https://bible.helloao.org/api/available_commentaries.json`)
.then(request => request.json())
.then(availableCommentaries => {
console.log('The API has the following commentaries:', availableCommentaries);
});curl https://bible.helloao.org/api/available_commentaries.jsonLys boeke in 'n kommentaar
( verwysing )
const commentary = 'adam-clarke';
// Kry die lys van boeke vir die Adam-Clarke-kommentaar
fetch(`https://bible.helloao.org/api/c/${commentary}/books.json`)
.then(request => request.json())
.then(books => {
console.log('The adam-clarke commentary has the following books:', books);
});curl https://bible.helloao.org/api/c/adam-clarke/books.jsonKry 'n hoofstuk uit 'n kommentaar
( verwysing )
const commentary = 'adam-clarke';
const book = 'GEN';
const chapter = 1;
// Kry Genesis 1 uit die Adam-Clarke-kommentaar
fetch(`https://bible.helloao.org/api/c/${commentary}/${book}/${chapter}.json`)
.then(request => request.json())
.then(chapter => {
console.log('Genesis 1 (adam-clarke):', chapter);
});curl https://bible.helloao.org/api/c/adam-clarke/GEN/1.jsonLys Profiele in 'n Kommentaar
( verwysing )
const commentary = 'tyndale';
// Kry die lys van profiele vir die Tyndale-kommentaar
fetch(`https://bible.helloao.org/api/c/${commentary}/profiles.json`)
.then(request => request.json())
.then(profiles => {
console.log('The tyndale commentary has the following profiles:', profiles);
});curl https://bible.helloao.org/api/c/tyndale/profiles.jsonKry 'n Profiel in 'n Kommentaar
( verwysing )
const commentary = 'tyndale';
const profile = 'aaron';
// Kry die Aaron-profiel van die Tyndale-kommentaar
fetch(`https://bible.helloao.org/api/c/${commentary}/profiles/${profile}.json`)
.then(request => request.json())
.then(profile => {
console.log('The Aaron tyndale commentary profile:', profile);
});curl https://bible.helloao.org/api/c/tyndale/profiles/aaron.jsonKry die lys van beskikbare datastelle
( verwysing )
fetch(`https://bible.helloao.org/api/available_datasets.json`)
.then(request => request.json())
.then(availableDatasets => {
console.log('The API has the following datasets:', availableDatasets);
});curl https://bible.helloao.org/api/available_datasets.jsonKry die lys van boeke in 'n datastel
( verwysing )
const dataset = 'open-cross-ref';
// Kry die lys van boeke vir die oop-kruisverwysingsdatastel
fetch(`https://bible.helloao.org/api/d/${dataset}/books.json`)
.then(request => request.json())
.then(books => {
console.log('The open-cross-ref dataset has the following books:', books);
});curl https://bible.helloao.org/api/d/open-cross-ref/books.jsonKry 'n hoofstuk uit 'n datastel
( verwysing )
const dataset = 'open-cross-ref';
const book = 'GEN';
const chapter = 1;
// Kry Genesis 1 van die oop-kruisverwysingsdatastel
fetch(`https://bible.helloao.org/api/d/${dataset}/${book}/${chapter}.json`)
.then(request => request.json())
.then(chapter => {
console.log('Genesis 1 (open-cross-ref):', chapter);
});curl https://bible.helloao.org/api/d/open-cross-ref/GEN/1.json