Mengajukan Permintaan
Untuk mengakses API, Anda hanya perlu membuat Permintaan HTTP GET ke endpoint yang tepat.
Misalnya, untuk mengakses endpoint available_translations.json , Anda dapat menggunakan perintah JavaScript atau cURL berikut:
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 bawah ini, Anda dapat menemukan daftar contoh. Untuk dokumentasi yang lebih lengkap, lihat Dokumentasi Referensi .
Contoh
Dapatkan Daftar Terjemahan yang Tersedia
( referensi )
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.jsonDaftar Buku Terjemahan
( referensi )
GET https://bible.helloao.org/api/{translation}/books.json
// Dapatkan daftar buku untuk terjemahan 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.jsonDapatkan Satu Bab dari Terjemahan
( referensi )
GET https://bible.helloao.org/api/{translation}/{book}/{chapter}.json
// Dapatkan Kejadian 1 dari terjemahan 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.jsonDapatkan Bab yang Disederhanakan dari Terjemahan
( referensi )
GET https://bible.helloao.org/api/{translation}/{book}/{chapter}.simple.json
Gunakan ini jika Anda hanya menginginkan teks dari sebuah bab. Setiap ayat berisi satu string text , bukan daftar konten yang diformat, sehingga Anda tidak perlu membuat teks sendiri.
// Dapatkan teks Kejadian 1 dari terjemahan 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.jsonDapatkan Daftar Komentar yang Tersedia
( referensi )
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.jsonDaftar Buku dalam Sebuah Komentar
( referensi )
const commentary = 'adam-clarke';
// Dapatkan daftar buku untuk komentar 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.jsonDapatkan Satu Bab dari Sebuah Komentar
( referensi )
const commentary = 'adam-clarke';
const book = 'GEN';
const chapter = 1;
// Dapatkan Kejadian 1 dari komentar 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.jsonCantumkan Profil dalam Komentar
( referensi )
const commentary = 'tyndale';
// Dapatkan daftar profil untuk komentar 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.jsonDapatkan Profil Anda di Bagian Komentar
( referensi )
const commentary = 'tyndale';
const profile = 'aaron';
// Dapatkan profil Aaron dari komentar 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.jsonDapatkan daftar Kumpulan Data yang Tersedia
( referensi )
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.jsonDapatkan daftar buku dalam sebuah dataset.
( referensi )
const dataset = 'open-cross-ref';
// Dapatkan daftar buku untuk 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.jsonAmbil Satu Bab dari Kumpulan Data
( referensi )
const dataset = 'open-cross-ref';
const book = 'GEN';
const chapter = 1;
// Dapatkan Kejadian 1 dari dataset referensi silang terbuka.
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