リクエストを行う
APIにアクセスするには、適切なエンドポイントに対してHTTP GETリクエストを送信するだけで済みます。
例えば、エンドポイントavailable_translations.jsonにアクセスするには、次のJavaScriptまたはcURLコマンドを使用できます。
JavaScript
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
curl https://bible.helloao.org/api/available_translations.json以下に例を示します。より詳細なドキュメントについては、リファレンスドキュメントを参照してください。
例
利用可能な翻訳の一覧を取得する
(参照)
GET https://bible.helloao.org/api/available_translations.json
JavaScript
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
curl https://bible.helloao.org/api/available_translations.json翻訳された書籍一覧
(参照)
GET https://bible.helloao.org/api/{translation}/books.json
JavaScript
// 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
curl https://bible.helloao.org/api/BSB/books.json翻訳版から章を取得する
(参照)
GET https://bible.helloao.org/api/{translation}/{book}/{chapter}.json
JavaScript
// BSB訳の創世記1章を入手してください
fetch(`https://bible.helloao.org/api/BSB/GEN/1.json`)
.then(request => request.json())
.then(chapter => {
console.log('Genesis 1 (BSB):', chapter);
});cURL
curl https://bible.helloao.org/api/BSB/GEN/1.json翻訳から簡略化された章を取得する
(参照)
GET https://bible.helloao.org/api/{translation}/{book}/{chapter}.simple.json
章のテキストだけが必要な場合は、これを使用してください。各節には、書式設定されたコンテンツのリストではなく、単一のtext文字列が含まれているため、自分でテキストを作成する必要はありません。
JavaScript
// BSB訳の創世記1章の本文を入手してください。
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
curl https://bible.helloao.org/api/BSB/GEN/1.simple.json利用可能な解説書のリストを取得する
(参照)
JavaScript
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
curl https://bible.helloao.org/api/available_commentaries.json解説書に収録されている書籍の一覧
(参照)
JavaScript
const commentary = '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
curl https://bible.helloao.org/api/c/adam-clarke/books.json解説書から章を取得する
(参照)
JavaScript
const commentary = 'adam-clarke';
const book = 'GEN';
const chapter = 1;
// アダム・クラーク解説書から創世記1章を入手してください。
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
curl https://bible.helloao.org/api/c/adam-clarke/GEN/1.json解説記事にプロフィール一覧を掲載する
(参照)
JavaScript
const commentary = '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
curl https://bible.helloao.org/api/c/tyndale/profiles.json解説記事でプロフィールを取得する
(参照)
JavaScript
const commentary = 'tyndale';
const profile = 'aaron';
// ティンダル解説書からアーロンのプロフィールを入手してください。
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
curl https://bible.helloao.org/api/c/tyndale/profiles/aaron.json利用可能なデータセットの一覧を取得する
(参照)
JavaScript
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
curl https://bible.helloao.org/api/available_datasets.jsonデータセット内の書籍リストを取得する
(参照)
JavaScript
const dataset = 'open-cross-ref';
// 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
curl https://bible.helloao.org/api/d/open-cross-ref/books.jsonデータセットから章を取得する
(参照)
JavaScript
const dataset = 'open-cross-ref';
const book = 'GEN';
const chapter = 1;
// open-cross-refデータセットからGenesis 1を取得する
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
curl https://bible.helloao.org/api/d/open-cross-ref/GEN/1.json