[go: up one dir, main page]

Skip to content

rkeplin/bible-php-api

Repository files navigation

Bible PHP API

Build Status codecov

Bible PHP API is an open source REST API. It contains multiple translations of The Holy Bible, as well as cross-references. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.

Live Demo

A live demo of this application can be viewed here.

Getting Everything Running

git clone https://www.github.com/rkeplin/bible-php-api
cd bible-php-api && docker-compose up -d

Note: Upon first start, the volume containing the MySQL data may take several seconds to load.

You should then be able to access http://localhost:8083 for the REST API and http://localhost:8082 for the UI (AngularJS).

API Specifications

List of available translations

GET http://localhost:8083/translations
GET http://localhost:8083/translations/[TranslationID]

List of Genres

GET http://localhost:8083/genres
GET http://localhost:8083/genres/[GenreID]

Content

GET http://localhost:8083/books
GET http://localhost:8083/books/[BookID]
GET http://localhost:8083/books/[BookID]/chapters/[ChapterID]
GET http://localhost:8083/books/[BookID]/chapters/[ChapterID]
GET http://localhost:8083/books/[BookID]/chapters/[ChapterID]/[VerseID]

Note: In order to get content for a specific translation, supply translation as a Query Parameter. For example, http://localhost:8083/books/1/chapters/1/1001002?translation=ASV

Cross References

GET http://localhost:8083/verse/[VerseID]/relations 

Registering

curl -XPOST -H "Content-Type: application/json" -d '{"email":"something@example.com", "password":"something", "passwordConf": "something"}' http://localhost:8083/register

Authenticating

# Logging in
curl -XPOST -H "Content-Type: application/json" -d '{"email":"something@example.com", "password":"something"}' http://localhost:8083/authenticate
 
# Logging out
curl -XGET -H "Content-Type: application/json" -H "Cookie: token=[TOKEN]" http://localhost:8083/authenticate/logout
 
# Getting current user information
curl -XGET -H "Content-Type: application/json" -H "Cookie: token=[TOKEN]" http://localhost:8083/authenticate/me

Managing lists

Registered users may create a list of verses

# Getting my lists
curl -XGET -H "Content-Type: application/json" -H "Cookie: token=[TOKEN]" http://localhost:8083/lists
 
# Creating a list
curl -XPOST -H "Content-Type: application/json" -H "Cookie: token=[TOKEN]" -d '{"name": "test list"}' http://localhost:8083/lists
 
# Getting a specific list
curl -XGET -H "Content-Type: application/json" -H "Cookie: token=[TOKEN]" http://localhost:8083/lists/[ListID]
 
# Updating a specific list 
curl -XPUT -H "Content-Type: application/json" -H "Cookie: token=[TOKEN]" -d '{"name": "test list updated"}' http://localhost:8083/lists/[ListID]
 
# Deleting a list
curl -XDELETE -H "Content-Type: application/json" -H "Cookie: token=[TOKEN]" http://localhost:8083/lists/[ListID]
 
# Get the verses on a list
curl -XGET -H "Content-Type: application/json" -H "Cookie: token=[TOKEN]" 127.0.0.1:8083/lists/[ListID]/verses
 
# Add a verse to a list
curl -XPUT -H "Content-Type: application/json" -H "Cookie: token=[TOKEN]" 127.0.0.1:8083/lists/[ListID]/verses/[VerseID]
 
# Remove a verse from a list
curl -XDELETE -H "Content-Type: application/json" -H "Cookie: token=[TOKEN]" 127.0.0.1:8083/lists/[ListID]/verses/[VerseID]

Running The Test Suite

make test

Related Projects

Credits

Data for this application was gathered from the following repositories.