Closer look at Bhagavad Gita REST API and JSON public GitHub repos

Last updated on 14 Oct. 2024
My post: Bhagavad Gita and some other Hindu scripture websites/web apps with source code (Next.js, React, React Native, REST API, JSON, AI-ChatGPT), https://raviswdev.blogspot.com/2024/05/bhagavad-gita-and-hindu-scripture.html lists some public Gita repositories including REST API and JSON repos. At the time I put up the post, I did not spend much time on details of the REST API and JSON repos. Now I am taking a closer look at them.

About the two REST APIs listed in my above post:
  1. https://github.com/gita/bhagavad-gita-api is in Python. I don't want to get into Python stuff now.
  2. https://github.com/vedicscriptures/bhagavad-gita-api is in Express JS and uses mongoose. I think I should be able to go through this source code. More details covered later on in this post.
About the three Gita JSON data sources listed in my above post:
  1. https://github.com/bhavykhatri/DharmicData/tree/main/SrimadBhagvadGita has 18 JSON files with translations for each chapter from similar or same set of commentators or translators as the GraphQL endpoint I used in my Gita front-end web app. But it does not seem to differentiate between language of translations or commentaries.
  2. https://github.com/gita/gita seems to be from same group that published the GraphQL endpoint I use in my Gita front end web app. It has json files for authors, chapters, verses, languages, commentary and translation. This data seems to be similar to the GraphQL endpoint data. It also has gita audio files as mp3 files. I don't think the GraphQL endpoint has mp3 files. Overall I find this JSON gita data source to be quite impressive.
  3. https://github.com/vedicscriptures/bhagavad-gita seems to be from same group/person as https://github.com/vedicscriptures/bhagavad-gita-api mentioned earlier. Has chapter summary json files and individual verse files with verse commentaries and translations (same or similar set of commentators and translators as mentioned above). The verse json files seem to differentiate between languages of commentaries and translations through a JSON property. 
-----------------------
Around 12th to 14th Oct.:
Cloned https://github.com/vedicscriptures/bhagavad-gita-api and had a quick look at the source code. It needs a MongoDb connection related environment variable which is not revealed. However, the model files src\models\bhagavadgita.model.js and src\models\user.model.js describe the needed MongoDB collections. 

https://github.com/vedicscriptures/bhagavad-gita has the dataset in JSON for bhagavadgita.model.js collections. If needed and the author license info. allows for it, the key MongoDb collection can be created with gita data populated using the dataset. Express course 04-Store-API has a populate.js file which does something similar. 

It does not use a controllers folder and all the database retrieval code is in the routes folder.

src\utils\auth.js code checks for x-api-key in header or req.query.api_key being present and if present checks for it being present as id in User collection. About getting this API key, the info. is not clear. https://vedicscriptures.github.io/privacy-policy.html indicates that one has to email the author for it.

tests\api-test.js seems to be automated test. 

The repo info. says it uses Heroku. Perhaps it was using the free tier which is no longer available. I wonder whether the API is live now. ... It is sort-of live - https://vedicscriptures.github.io/slok/1/1/ works (without any API key). Is it hosted on github.io now instead of Heroku? But I don't think Github.io hosts APIs. I wonder whether https://vedicscriptures.github.io/ is serving out JSON files for each valid URL in the API. See Hosting a JSON API on GitHub Pages, https://victorscholz.medium.com/hosting-a-json-api-on-github-pages-47b402f72603 .

Comments