Switched to sqlite virtual table searching, a built-in reference parser, and changed endpoints to be more sane.

This commit is contained in:
2023-01-08 11:14:29 -08:00
parent 65f0064953
commit 2d52f6e9d4
5 changed files with 230 additions and 217 deletions
+24 -33
View File
@@ -16,30 +16,31 @@ html{
<h3>Usage</h3>
<p>URL Root: <a href="https://api.1611.social/">https://api.1611.social/<a> (you are here)</p>
<ul>
<li><a href="https://api.1611.social/random">/random</a> - a random JSON-encoded verse. Different every time.</li>
<li><a href="https://api.1611.social/votd">/votd</a> - json-encoded verse changes from day-to-day.</li>
<li><a href="https://api.1611.social/p/john3:16">/p/someverse</a> - will attempt to parse and return the Bible requested in plaintext (pretty, with escape characters)</li>
<li><a href="https://api.1611.social/John3:16">/someverse</a> - will attempt to parse and return the Bible requested in plaintext, with no escape characters. Newlines are encoded as "/n" - for you to handle.</li>
<li><a href="https://api.1611.social/s/faith">/s/keyword</a> - will return any verses containing keyword in a JSON list</li>
<li><a href="https://api.1611.social/sp/faith">/sp/keyword</a> - will return any verses containing keyword in a newline (html break) delimited list</li>
<li><a href="https://api.1611.social/sl/faith">/sl/keyword</a> - will return all searched references and the scripture in JSON</li>
<li><a href="https://api.1611.social/spl/faith">/spl/keyword</a> - will return all searched references and the scripture in text delmied by a newline</li>
<li><a href="https://api.1611.social/random">/random</a> - A random verse from the KJV</li>
<li><a href="https://api.1611.social/votd">/votd</a> - A random verse that changes from day-to-day.</li>
<li><a href="https://api.1611.social/search?kw=faith">/search</a> - Search keywords</li>
<li><a href="https://api.1611.social/show?kw=John3:16">/show</a> - Show a set of verses</li>
</ul>
<h3>Verse searching</h3>
<p>'/someverse' accepts verse references in a variety of forms, including single verses and verse ranges. For
example:</p>
<li>Jn3:16, john3:16,17 ps1:1-6</li>
<p>
Most recognizable abbreviations are allowed, and spelling errors are ignored if the book can be made
out in the first few characters. No distinction is made between upper and lower case. Multiple
references may be provided on an input line, delimited by spaces or commas.
</p>
<p>'/show?kw=' will try to match single verses and verse ranges. For example:</p>
<pre>
<code>
/search?kw=john3:16
/search?kw=John 3:13-18
/search?kw=2 Peter 2:8
/search?kw=1 John 3:3- (gets the whole rest of the chapter)
/search?kw=ecc 2:1-
</code>
</pre>
<h3>Keyword searching</h3>
<p>'/s*/keyword' accepts a search word, and will return any verses matching the query</p>
<p>'/search?kw=keyword' accepts a search word, and will return any verses matching the query. For example:</p>
<pre>
<code>
</code>
</pre>
<h3>Integration</h3>
<p>If you want to put the verse of the day into your website, you can use the following example php:</p>
@@ -47,8 +48,8 @@ example:</p>
<pre>
<code>
FUTURE ENDPOINT SPECIFICATION
======================
API ENDPOINT SPECIFICATION v 0.2
================================
/random - outputs a random verse
/votd - returns verse of the day
@@ -68,20 +69,10 @@ default: json
search default: faith
show default: john3:16
?op=
- Multi-keyword search operator
- and - both keywords must be in verse
- any - any keyword must be in a verse
search default: any
?fz=
- on - fuzzy search on
default: off
EXAMPLES
========
api.tld/random?view=json
api.tld/votd?view=human
api.tld/random
api.tld/votd?view=rich
api.tld/show?kw=john3:16,1john5:7&view=plain
api.tld/search?kw=faith
api.tld/search?kw=nimrod&view=rich