Version: 2.2
Welcome to the GurbaniDB API for the Sikh Scriptures developed using the popular Laravel PHP Framework. We decided to take advantage of Laravel's fantastic ORM to rapidly develop this API.
We decided to keep this API version (2.x) and the GurbaniDB database version (2.x) the same because they were developed together and are compatible with one another.
GurbaniDB API Version 1.0, as used formerly in the GurbaniDB search engine, is now deprecated and we will no longer be supporting or documenting it.
The latest version of this repo is live at: http://api.sikher.com
Before installing the GurbaniDB API, please ensure you have the following packages installed on your local machine or server.
You may choose to use a software like WAMPP or XAMPP, or a package manager like Brew for Mac or APT for Linux, to install most of these dependencies for you:
phpinfo();
command)As well as this, you will need to know how to setup name-based Virtual Hosts or vhosts in Apache and how to edit your system's hosts
file.
Finally, you will need to know some basics of how to use Terminal
or the command-line.
Just use git
to clone the ssh version:
git clone git@github.com:sikher/gurbanidb.git
Or use git
to clone the https version:
git clone https://github.com/sikher/gurbanidb.git
Or download the .zip archive and unzip it:
https://github.com/sikher/gurbanidb/archive/master.zip
api.dev
(or a name of your choosing) to point to the directory where you just downloaded the GurbaniDB repositoryTerminal
or the command-line and use cd
to navigate to the GurbaniDB repository. Then run the command php composer.phar install
to install all the dependencies of the Laravel PHP frameworkapi.dev/
to see if it loads the homepage. If not, check your Apache error log and double-check you installed all the pre-requisites properly../app/config/
in your repository and mkdir
'production'. Then cp
the file database.php
into the new production folder. Now update the database settings inside the following files:
app/config/database.php
- Default Databaseapp/config/local/database.php
- Local Databaseapp/config/production/database.php
- Production DatabaseThe local and production environments are determined by the bootstrap/start.php
file, so you will also have to modify this to your local and production server HTTP host names.
To run the unit tests simply navigate to the root of the directory in Terminal
and use the command:
$ phpunit
If everything is setup right, you should see something like:
PHPUnit 3.7.28 by Sebastian Bergmann.
Configuration read from {/dir/to/application}/phpunit.xml
....................................
Time: 2.57 seconds, Memory: 53.75Mb
OK (60 tests, 60 assertions)
Below is a list of all the API routes supported in this application, which you can also find in app/routes.php
:
/search/{query?}/{translation?}/{transliteration?}/{offset?}
- Gives back the first 10 search results by first letters from start for the scripture, defaults to (empty string)/13 (English)/69 (Latin)/0/search/1/{query?}/{translation?}/{transliteration?}/{offset?}
- Gives back the first 10 search results by first letters anywhere for the scripture, defaults to (empty string)/13 (English)/69 (Latin)/0/search/2/{query?}/{translation?}/{transliteration?}/{offset?}
- Gives back the first 10 search results by words anywhere for the scripture, defaults to (empty string)/13 (English)/69 (Latin)/0/search/3/{query?}/{translation?}/{transliteration?}/{offset?}
- Gives back the first 10 search results by words anywhere for the translation, defaults to (empty string)/13 (English)/0/search/4/{query?}/{translation?}/{transliteration?}/{offset?}
- Gives back the first 10 search results by words anywhere for the transliteration, defaults to (empty string)/69 (Latin)/0/page/{page_id?}/{translation?}/{transliteration?}
- Gives back the scripture, translation and transliteration of a page in the language specified, defaults to 1/13 (English)/69 (Latin)/hymn/{hymn_id?}/{translation?}/{transliteration?}
- Gives back the scripture, translation and transliteration of a hymn in the language specified, defaults to 1/13 (English)/69 (Latin)/{scripture_id?}/{translation?}/{transliteration?}
- Gives back the scripture, translation and transliteration of a line in the language specified, defaults to 1/13 (English)/69 (Latin)/random/{type?}/{translation?}/{transliteration?}
- Gives back either a page (type 1) or a hymn (type 2) with the scripture, translation and transliteration in the language specified, defaults to 1 (Page)/13 (English)/69 (Latin)/melody
- Gives back a list of all the melodies/melody/{id?}
- Gives back the melody specified, defaults to 1/author
- Gives back a list of all the authors/author/{id?}
- Gives back the author specified, defaults to 1/language
- Gives back a list of all the languages/language/{id?}
- Gives back the language specified, defaults to 1/about
- Gives version number of APIPlease Note: Some entries in our database contain two lines in the same entry and therefore will not show up in search by first letters from start (/search/). To find these you may search by first letters anywhere (/search/1/)