Effettuare richieste
Per accedere all'API, è sufficiente effettuare una richiesta HTTP GET all'endpoint corretto.
Ad esempio, per accedere all'endpoint available_translations.json , è possibile utilizzare il seguente comando JavaScript o cURL:
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.jsonDi seguito è riportato un elenco di esempi. Per una documentazione più completa, consultare la Documentazione di riferimento .
Esempi
Ottieni l'elenco delle traduzioni disponibili
( riferimento )
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.jsonElenco dei libri in traduzione
( riferimento )
GET https://bible.helloao.org/api/{translation}/books.json
// Ottieni l'elenco dei libri per la traduzione BSB
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.jsonOttieni un capitolo da una traduzione
( riferimento )
GET https://bible.helloao.org/api/{translation}/{book}/{chapter}.json
// Ottieni Genesi 1 dalla traduzione BSB
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.jsonOttieni un capitolo semplificato da una traduzione
( riferimento )
GET https://bible.helloao.org/api/{translation}/{book}/{chapter}.simple.json
Utilizza questa opzione quando desideri solo il testo di un capitolo. Ogni versetto contiene una singola stringa text anziché un elenco di contenuti formattati, quindi non è necessario costruire il testo manualmente.
// Ottieni il testo di Genesi 1 dalla traduzione BSB
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.jsonOttieni l'elenco dei commenti disponibili
( riferimento )
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.jsonElenco dei libri in un commentario
( riferimento )
const commentary = 'adam-clarke';
// Ottieni l'elenco dei libri per il commentario di Adam Clarke
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.jsonOttieni un capitolo da un commentario
( riferimento )
const commentary = 'adam-clarke';
const book = 'GEN';
const chapter = 1;
// Scarica Genesi 1 dal commentario di Adam Clarke
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.jsonElenca i profili in un commento
( riferimento )
const commentary = 'tyndale';
// Ottieni l'elenco dei profili per il commento di Tyndale
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.jsonOttieni un profilo in un commento
( riferimento )
const commentary = 'tyndale';
const profile = 'aaron';
// Ottieni il profilo di Aaron dal commento di Tyndale
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.jsonOttieni l'elenco dei set di dati disponibili
( riferimento )
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.jsonOttieni l'elenco dei libri in un dataset
( riferimento )
const dataset = 'open-cross-ref';
// Ottieni l'elenco dei libri per il dataset open-cross-ref
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.jsonOttieni un capitolo da un set di dati
( riferimento )
const dataset = 'open-cross-ref';
const book = 'GEN';
const chapter = 1;
// Ottieni Genesis 1 dal dataset open-cross-ref
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