Hacer peticiones
Para acceder a la API, solo necesita realizar una solicitud HTTP GET al punto final correcto.
Por ejemplo, para acceder al punto final available_translations.json , puede utilizar el siguiente 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.jsonA continuación, encontrará una lista de ejemplos. Para obtener una documentación más completa, consulte la documentación de referencia .
Ejemplos
Obtén la lista de traducciones disponibles.
( referencia )
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.jsonLista de libros traducidos
( referencia )
GET https://bible.helloao.org/api/{translation}/books.json
// Obtén la lista de libros para la traducción de 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.jsonObtén un capítulo de una traducción
( referencia )
GET https://bible.helloao.org/api/{translation}/{book}/{chapter}.json
// Obtén Génesis 1 de la traducción 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.jsonObtén un capítulo simplificado de una traducción.
( referencia )
GET https://bible.helloao.org/api/{translation}/{book}/{chapter}.simple.json
Utilice esta opción cuando solo necesite el texto de un capítulo. Cada versículo contiene una única cadena vacía text en lugar de una lista de contenido formateado, por lo que no tendrá que generar el texto usted mismo.
// Obtén el texto de Génesis 1 de la traducción 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.jsonObtenga la lista de comentarios disponibles.
( referencia )
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.jsonLista de libros en un comentario
( referencia )
const commentary = 'adam-clarke';
// Obtén la lista de libros para el comentario de 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.jsonObtén un capítulo de un comentario
( referencia )
const commentary = 'adam-clarke';
const book = 'GEN';
const chapter = 1;
// Obtén Génesis 1 del comentario de 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.jsonEnumerar perfiles en un comentario
( referencia )
const commentary = 'tyndale';
// Obtén la lista de perfiles para los comentarios de 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.jsonObtén un perfil en un comentario
( referencia )
const commentary = 'tyndale';
const profile = 'aaron';
// Obtén el perfil de Aaron del comentario de 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.jsonObtén la lista de conjuntos de datos disponibles.
( referencia )
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.jsonObtener la lista de libros en un conjunto de datos.
( referencia )
const dataset = 'open-cross-ref';
// Obtén la lista de libros para el conjunto de datos 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.jsonObtener un capítulo de un conjunto de datos
( referencia )
const dataset = 'open-cross-ref';
const book = 'GEN';
const chapter = 1;
// Obtén Génesis 1 del conjunto de datos 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