RBA Cash Rate: 4.35% · 1AUD = 0.67 USD · Inflation: 4.1%  
Leading Digital Marketing Experts | 1300 235 433 | Aggregation Enquires Welcome | Book Appointment
Example Interest Rates: Home Loan Variable: 5.38% (6.14%*) • Home Loan Fixed: 5.44% (6.26%*) • Fixed: 5.44% (6.26%*) • Variable: 5.38% (6.14%*) • Investment IO: 5.69% (6.52%*) • Investment PI: 5.49% (5.98%*)

Bible API

Bible API

What better day to showcase the rudimentary features of our Bible API than Easter Sunday. While not planned, there is a serendipitous nature about it. When it comes to what information we make available via our social system we generally don't discriminate on the content... and our Bible API (from a business sense) tends to fit into the category that might attract a little scrutiny.

It's prudent at this time to reinforce our name: it has no connection or affiliate with any particular faith (unless of course you consider the pursuit of digital excellence to be a religion). Belief, in the context of our company name, refers to the state of mind in which a person thinks something to be true, with or without there being empirical evidence to prove that something is the case with factual certainty. It has everything to do with "Justified true belief" and nothing to do with religion. Of course, my little disclaimer doesn't mean that we don't have a spread of religions practitioners among our ranks.

This quick article serves to illustrate the basic use of our Bible API - available to all clients. For the purpose of our examples we'll be using the American Bible transation (a number of translations are available). For more complete documentation, please refer to our client area.

The Result

The endpoint for all requests is as follows: https://api.beliefmedia.com/platform/sources/bible/bible.json.

To return details about a specific verse in the bible, we reference that via its id. The result (for the first line in the Bible) may be returned with json.php?apikey=xxxxx&id=01001001. The result:

1
Array
2
(
3
    [code] => 200
4
    [status] => 200
5
    [message] => OK
6
    [source] => American Bible
7
    [data_version] => 0.2
8
    [data] => Array
9
        (
10
            [id] => 01001001
11
            [book] => Genesis
12
            [book_slug] => genesis
13
            [chapter] => 1
14
            [verse] => 1
15
            [text] => In the beginning God created the heavens and the earth.
16
            [translations] => Array
17
                (
18
                    [American_Bible] => In the beginning God created the heavens and the earth.
19
                    [Basic_English] => At the first God made the heaven and the earth.
20
                    [Darby_English] => In the beginning God created the heavens and the earth.
21
                    [King_James] => In the beginning God created the heaven and the earth.
22
                    [Websters] => In the beginning God created the heaven and the earth.
23
                    [World_English] => In the beginning God{After "God," the Hebrew has the two letters "Aleph Tav" (the first and last letters of the Hebrew alphabet) as a grammatical marker.} created the heavens and the earth.
24
                    [Young_Literal] => In the beginning of God's preparing the heavens and the earth --
25
                )
26
 
27
            
Image Error
 => Array
28
                (
29
                    [filename] => american-bible/01-genesis/001/001.jpg
30
                    [size] => 62.1K
31
                    [width] => 885
32
                    [height] => 885
33
                )
34
 
35
        )
36
 
37
)

Note that we return the book_slug. This may be used in addition to the numeric book_id (refer detailed documentation in the client area) to return texts relating only to that book (example: Genesis, John, Corinthians, Romans, Mark etc).

Translations from other Bible sources are returned and they are all available individually via the appropriate GET request. The image reference is a copy of the passage as an image on our own server, If we're required to manufacture the same branded images for clients, we honour the same directory structure.

You may search the text fields, and refine your search by book and chapter. Available request parameters are translation (source), search, book, and chapter. Example requests are as follows:

1
bible.json?apikey=xx&type=search&search=earth (searching text "earth")
2
bible.json?apikey=xx&source=websters&type=search&search=earth (searching text "earth" in Websters Bible)
3
bible.json?apikey=xx&type=search&search=earth&book=genesis (searching "earth" in Genesis)
4
bible.json?apikey=xx&type=search&search=earth&book=genesis&chapter=1
5
bible.json?apikey=xx&pg=15&number=20 (Browsing with pagination)

Whenever conducting a search the URL parameter of type=search is required (otherwise it details to type=browse). In the following example the results for a search of the word 'earth' in Genesis are returned.

1
Array
2
(
3
    [code] => 200
4
    [status] => 200
5
    [message] => OK
6
    [source] => American Bible
7
    [data_version] => 0.2
8
    [page] => 2
9
    [number] => 10
10
    [pages] => 10
11
    [total] => 95
12
    [search] => Array
13
        (
14
            [type] => search
15
            [term] => earth
16
        )
17
 
18
    [results] => Array
19
        (
20
            [0] => Array
21
                (
22
                    [id] => 01001025
23
                    [book] => Genesis
24
                    [book_slug] => genesis
25
                    [chapter] => 1
26
                    [verse] => 25
27
                    [text] => And God made the beasts of the earth after their kind, and the cattle after their kind, and everything that creepeth upon the ground after its kind: and God saw that it was good.
28
                    
Image Error
 => Array
29
                        (
30
                            [filename] => american-bible/01-genesis/001/025.jpg
31
                            [size] => 95.4K
32
                            [width] => 885
33
                            [height] => 885
34
                        )
35
 
36
                )
37
 
38
            [1] => Array
39
                (
40
                    [id] => 01001026
41
                    [book] => Genesis
42
                    [book_slug] => genesis
43
                    [chapter] => 1
44
                    [verse] => 26
45
                    [text] => And God said, Let us make man in our image, after our likeness: and let them have dominion over the fish of the sea, and over the birds of the heavens, and over the cattle, and over all the earth, and over every creeping thing that creepeth upon the earth.
46
                    
Image Error
 => Array
47
                        (
48
                            [filename] => american-bible/01-genesis/001/026.jpg
49
                            [size] => 108.9K
50
                            [width] => 885
51
                            [height] => 885
52
                        )
53
 
54
                )
55
 
56
            [.. SNIP ..]
57
 
58
            [9] => Array
59
                (
60
                    [id] => 01004012
61
                    [book] => Genesis
62
                    [book_slug] => genesis
63
                    [chapter] => 4
64
                    [verse] => 12
65
                    [text] => when thou tillest the ground, it shall not henceforth yield unto thee its strength; a fugitive and a wanderer shalt thou be in the earth.
66
                    
Image Error
 => Array
67
                        (
68
                            [filename] => american-bible/01-genesis/004/012.jpg
69
                            [size] => 89.2K
70
                            [width] => 885
71
                            [height] => 885
72
                        )
73
 
74
                )
75
 
76
        )
77
 
78
)

Translations

For the sake of a broader understanding (one that I required... despite a Churchy school-life), the following is a brief introduction to the various versions (or translations) we make available.

American Standard Bible

The Revised Version, Standard American Edition of the Bible, more commonly known as the American Standard Version (ASV), is a Bible translation into English that was completed in 1901, with the publication of the revision of the Old Testament; the revised New Testament had been released in 1900. It was originally best known by its full name, but soon came to have other names, such as the American Revised Version, the American Standard Revision, the American Standard Revised Bible, and the American Standard Edition. By the time its copyright was renewed in 1929, it had come to be known by its present name, the American Standard Version. Because of its prominence in seminaries, it was in America sometimes simply called the "Standard Bible".

Bible in Basic English

The Bible In Basic English (also known as BBE) is a translation of the Bible into Basic English. The BBE was translated by Professor S. H. Hooke using the standard 850 Basic English words. 100 words that were helpful to understand poetry were added along with 50 "Bible" words for a total of 1,000 words. This version is effective in communicating the Bible to those with limited education or where English is a second language. The New Testament was released in 1941 and the Old Testament was released in 1949.

Darby English Bible

The Darby Bible (DBY, formal title The Holy Scriptures: A New Translation from the Original Languages by J. N. Darby) refers to the Bible as translated from Hebrew and Greek by John Nelson Darby. Darby published a translation of the New Testament in 1867, with revised editions in 1872 and 1884. After his death, some of his students produced an Old Testament translation based on Darby's French and German translations. The complete Darby Bible, including Darby's 3rd edition New Testament and his students' Old Testament, was first published in 1890.

King James Bible

The King James Version (KJV), also known as the Authorized Version (AV) or the King James Bible (KJB), is an English translation of the Christian Bible for the Church of England begun in 1604 and completed in 1611. The books of the King James Version include the 39 books of the Old Testament, an intertestamental section containing 14 books of the Apocrypha, and the 27 books of the New Testament.

Webster's Bible

Noah Webster's 1833 limited revision of the King James Version focused mainly on replacing archaic words and making simple grammatical changes. For example: "why" instead of "wherefore", "its" instead of "his" when referring to nonliving things, "male child" instead of "manchild", etc. He also introduced euphemisms to remove words he found offensive: "whore" becomes "lewd woman". Overall, very few changes were made, and the result is a book which is almost indistinguishable from the King James Version. It has sometimes been called the "Common Version".

World English Bible

The World English Bible (also known as the WEB) is a free updated revision of the American Standard Version (1901). It is one of the few public domain, modern-English translations of the entire Bible, and it is freely distributed to the public using electronic formats. The Bible was created by volunteers using the ASV as the base text as part of the ebible project through Rainbow Missions, Inc., a Colorado nonprofit corporation.

Young's Literal Translation

Young's Literal Translation (YLT) is a translation of the Bible into English, published in 1862. The translation was made by Robert Young, compiler of Young's Analytical Concordance to the Bible and Concise Critical Comments on the New Testament. Young used the Textus Receptus (TR) and the Majority Text (MT) as the basis for his translation. He wrote in the preface to the first edition, "It has been no part of the Translator's plan to attempt to form a New Hebrew or Greek Text -- he has therefore somewhat rigidly adhered to the received ones. The Literal Translation is unusual in that, as the name implies, it is a strictly literal translation of the original Hebrew and Greek texts.

Example PHP Functions

The following basic functions will retrieve the results and return them as an array.

Returning Passage Details

1
<?php 
2
/*
3
 Bible API
4
 https://www.beliefmedia.com.au/bible-api
5
*/
6
 
7
function beliefmedia_bible_details($id, $apikey = 'xxxxx') {
8
 
9
  /* 8-figure Reference */
10
  if (preg_match('/[0-9]{8}/', $id) === false) return false;
11
 
12
  $data = @file_get_contents('https://api.beliefmedia.com/platform/sources/bible/bible.json?apikey=' . $apikey . '&id=' . $id);
13
  if ($data === false) return false;
14
 
15
  $data = json_decode($data, true);
16
  if ($data === false) return false;
17
 
18
  /* Likely return array of errors with code & message */
19
  if ($data['code'] != '200') return $data['message'];
20
 
21
 return (array) $data;
22
}

Returning Search Results

1
<?php 
2
/*
3
 Bible API
4
 https://www.beliefmedia.com.au/bible-api
5
*/
6
 
7
function beliefmedia_bible($page = '', $number = '', $search = false, $book = false, $chapter = false, $source = 'americanbible', $apikey = 'xxxxx') {
8
 
9
  if ($page == '') $page = '1';
10
  if ($number == '') $number = '20';
11
 
12
  $type = ($search === false) ? 'browse' : 'type=search&search=' . str_replace(' ', '+', $search);
13
 
14
  $request_url = 'https://api.beliefmedia.com/platform/sources/bible/bible.json?apikey=' . $apikey . '&pg=' . $page . '&number=' . $number . '&' . $type;
15
  if ($book !== false) $request_url .= '&book=' . $book;
16
  if ($chapter !== false) $request_url .= '&chapter=' . $chapter;
17
 
18
  $data = @file_get_contents($request_url);
19
  if ($data === false) return false;
20
 
21
  $data = json_decode($data, true);
22
  if ($data === false) return false;
23
 
24
  /* Likely return array of errors with code & message */
25
  if ($data['code'] != '200') return $data['message'];
26
 
27
 return (array) $data;
28
}

Bible Text as Images

Each passage makes its way onto an image (available in the response). We're using our yet-to-be-discussed Image Factory API to create a square typewriter image (not unlike our Quotes API) with the following result. If the result is more than 14 lines we'll create a 'Basic Image' instead.

Bible API

We use the 'nature' backgrounds by default but there is a gallery of various religious images if that's what tickles your pickle.

Considerations

  • There's no error checking in our example PHP functions. It's expected that you'll code this in to avoid your responses being ignored on our end.
  • In the interests of keeping everybody happy, we have a similar API that returns various translation of the Quran - details of which will be published soon.
  • If you're a client and require it, make contact with us for a full branded collection of images. They are good for social fuel if it relates to your service. Of course, the entire collection can be scheduled to all social platforms via our platform.
  • Various details on making requests to the available translations are available within our client area. At this stage we only have images manufactured locally for the American Bible.
  • Other requests are available to return specific information about each translation, such as word counts, paragraph counts etc. Their use is beyond the scope of this brief introduction.
  • We have a Twitter and Facebook page that essentially tweeted the Bible one image at a time. Publishing was suspended for a few days at the time of publishing this article so we could migrate the feature over to the new platform.
  • There's another API we'll link to in a couple of days that returns text which includes "Jesus only" passages.
  • Strangely enough, some Bible texts are subject to copyright.

■ ■ ■

 
Download our complimentary 650-page guide on marketing for mortgage brokers. We'll show you exactly how we generate billions in volume for our clients.
Finance Guide, Cropped Top and Bottom
  Timezone: 1 · [ CHANGE ]

RELATED READING

Like this article?

Share on Facebook
Share on Twitter
Share on Linkdin
Share on Pinterest

Leave a comment