They also provide metadata for download
https://tanzil.net/docs/Quran_Metadata
If you instead send an http request to antoher server, you are just introducing a pointless dependency in your system. It will make your system generally slower because it will take more time to get answers. There's absolutely no benefit.
Those seem like pretty high costs to me mainly to avoid processing a local database. Especially if someone could wrap the local database with a library that has the same interface as the network API! (That library could stop being maintained, but the failure modes are much narrower than the failure modes of a network service.)
A lot of the comments in this thread are suggesting that an API to search small public data is not a very productive approach compared to having that data present locally in programs that will use it. I can think of lots of advantages that network APIs could have:
* querying nonpublic data (including nonpublic data that the end user is fully entitled to access all of, but doesn't want to cache on a mobile device because of its sensitivity)
* applying a sophisticated algorithm to the data
* offloading computation or storage to a more powerful device
* dealing with frequent updates or edits to the data
* ...
However, none of those seem to apply readily to the case of searching a specific religious or literary text, because downloading the complete text is usually a very practical option. (I guess the "nonpublic data" part could also apply because some of the translations and transliterations and associated information might be under copyright, and the copyright holder might choose to authorize the API but not authorize bulk downloads of the database. That could also be true for modern commentaries and annotations.)
The only other one that comes to mind for me in terms of people's enthusiasm for this API approach (and indeed in the comment I'm replying to) is
* developers are very used to querying web APIs (and don't like writing their own parsers)
That's fair, but I feel like it's best mitigated by having someone develop a reliable library for parsing a particular database or dataset, with a nice API that the developers will be happy with.
To expand on that, here downloading the file is a way of caching the data. Caching invalidation can be tricky, but for something like this it's actually easy, so you can afford all the benefits of a cache.
- type safe clients provided by M3o
- reducing app/webapp/binary space by relying on APIs to get a subset of the content you need
- a web interface to query the data
There are probably a few more, YMMV
Reudcing space? Really? The data is actually very small. Your npm modules take a lot more space. If anything is really cheap and not worth worrying about, it's disk space.
> Type safety is worse for http calls because you literlly have no idea at compile time what the data will be.
We promise we will return data as per API spec ;)
> The data is actually very small
For this particular example, I guess you are right.
Our vision is that all APIs will have uniform clients, docs etc, so in aggregate it will provide a very convenient workflow. So instead of downloading a.json and b.xml and c.yaml (if possible at all due to size) and defining data structures yourself, just import our library and you are good to go.
But as I said, YMMV. If it's not your cup of tea, I understand that too.
Even though I don't think that the Quran API will benefit many applications, you could probably envision some, like very tiny embedded systems that don't have even megabytes of spare local storage (but do have some kind of user interface).
Here's a list of electronic text resources for the Christian Bible
of which (surprisingly to me) many are also APIs rather than downloads. But there are lots of downloads like XML and text files. One that I found of the King James Version translation has lines like
Gen|4|26| And to Seth, to him also there was born a son; and he called his name Enos: then began men to call upon the name of the LORD.~
i.e. book of Genesis, chapter 4, verse 26, followed by an ASCII string of that verse.
The Quran download mentioned in the grandparent comment at
includes text files with lines like
2|150|ﻮَﻤِﻧْ ﺢَﻴْﺛُ ﺥَﺮَﺠْﺗَ ﻑَﻮَﻟِّ ﻮَﺠْﻬَﻛَ ﺶَﻃْﺭَ ﺎﻠْﻤَﺴْﺟِﺩِ ﺎﻠْﺣَﺭَﺎﻣِ ۚ ﻮَﺤَﻴْﺛُ ﻡَﺍ ﻚُﻨﺘُﻣْ ﻑَﻮَﻟُّﻭﺍ ﻮُﺟُﻮﻬَﻜُﻣْ ﺶَﻃْﺮَﻫُ ﻞِﺌَﻟَّﺍ ﻲَﻛُﻮﻧَ ﻞِﻠﻧَّﺎﺳِ ﻊَﻠَﻴْﻜُﻣْ ﺢُﺟَّﺓٌ ﺈِﻟَّﺍ ﺎﻟَّﺬِﻴﻧَ ﻆَﻠَﻣُﻭﺍ ﻢِﻨْﻬُﻣْ ﻒَﻟَﺍ ﺖَﺨْﺷَﻮْﻬُﻣْ ﻭَﺎﺨْﺷَﻮْﻨِﻳ ﻮَﻟِﺄُﺘِﻣَّ ﻦِﻌْﻤَﺘِﻳ ﻊَﻠَﻴْﻜُﻣْ ﻮَﻠَﻌَﻠَّﻜُﻣْ ﺖَﻬْﺗَﺩُﻮﻧَ
i.e. surah 2, ayah 150, followed by a Unicode string of the text of that ayah. (There's no "book" field because of the sufficiency of the surah numbers.) This file is about 1.3 megabytes uncompressed, although of course it doesn't include additional data that a user might want to have presented (the transliterations or translations mentioned elsewhere in this thread, for example).
There are probably lots of mobile apps that have graphics files alone that are larger than this 1.3 megabyte Quran text file. (Not that mobile apps are the only application for the APIs or anything.)
Another online text at
https://www.sacred-texts.com/isl/htq/index.htm
gives each surah in a separate file (less convenient for downloading, although you could still do it in a few minutes!), so that ayah is
150 وَمِنْ حَيْثُ خَرَجْتَ فَوَلِّ وَجْهَكَ شَطْرَ ٱلْمَسْجِدِ ٱلْحَرَامِ ۚ وَحَيْثُ مَا كُنتُمْ فَوَلُّوا۟ وُجُوهَكُمْ شَطْرَهُۥ لِئَلَّا يَكُونَ لِلنَّاسِ عَلَيْكُمْ حُجَّةٌ إِلَّا ٱلَّذِينَ ظَلَمُوا۟ مِنْهُمْ فَلَا تَخْشَوْهُمْ وَٱخْشَوْنِى وَلِأُتِمَّ نِعْمَتِى عَلَيْكُمْ وَلَعَلَّكُمْ تَهْتَدُونَ
There's some kind of Unicode issue where the letters in the second version seem to be connecting better (e.g. مَا rather than ﻡَﺍ), but my knowledge of Arabic isn't enough to make it obvious to me whether the second one is a more correct encoding or the first one is just making more assumptions about the rendering or something.
Heck, sacred-texts.com will sell you a Flash drive with a huge chunk of their collection on it: https://sacred-texts.com/cdshop/dvd90/index.htm
It's all of four gigabytes. Once that was a lot. Now it's nothing. Every holy text from antiquity, in something the size of your thumb.
I cannot access the tanzil XML file right now due to MobileSafari layout issues (boo). https://github.com/ceefour/qurandatabase has its own consistent DTD, but I doubt this is the only format I will find.
Don’t think it’s possible? There are 114 suras. The longest one is like the screenplay of Star Wars, something many of know by heart even if we can’t recite it. The smallest bunch of suras resemble song lyrics. Most people have memorized considerably more than 114 songs. Replaying them just requires the right stimulus.
{"chapter":1}
instead of ?chapter=1 in the URL. Just something I've noticed in a lot of APIs recently.A curiosity to be sure, and by no means a critical problem.
EDIT: added some commas to help with parsing since I have my phrasing all turned about.
A GET request with a `?chapter=1` argument is more correct than POST because then it's cacheable by browsers, proxies or middleware clients, and thus respects the spirit of the HTTP protocol.
Only if the Qur'an is immutable, that is.
For this usecase a ?chapter=1 query string would have been better and not at all less "RESTy".
Sometimes the "point" is because it can be done. Sometimes the point is someone wants to learn about building an API and would prefer to do it with the Quran rather than with movie quotes.
Then it should be phrased like that. It's obvious the original comment was phrased as a condescending question, especially since they tried to answer it themselves.
There's a difference between genuine interest and trying to show off how smart you are.
"I wanted to build a fun, cool project." Is a perfectly valid answer.
I think there is value in people critiquing methods and designs for various systems. If I were building some new project I would want my peers to give me honest critique and constructive probing. I make mistakes all the time and would never learn from those mistakes if others didn't point them out to me.
> "liabd 1 hour ago [–] This is awesome and will enable a whole suite of apps to be build on top of it. Great work"
So even in this thread people are discussing adding this service as a dependency to their own applications. I think if you are building a project for yourself for fun that is one thing... but If you advertise it for public use, criticism is perfectly valid, and should be expected.
ESV has a pretty decent API, actually! https://api.esv.org/ I used it way back when when Google TV was a thing, to make a verse-display used during bible studies.
Beyond that, it seems like this could be used as a base for adding new translations, commenting and conversation on particular verses, personal collections of scripture, etc. If you are planning on going in any of those directions you need to build a platform for the static stuff before you expand.
If you did use their resources, please cite/reference them :)
But I want to highlight something from a comment of mine further down: while looking for examples of downloadable sacred texts, I found this page
which has -- alongside downloads -- a whole bunch of actively-maintained APIs for Christian Bible verse access, some of them run by pretty prominent organizations.
So, all of our intuitions about the merits of downloading sacred texts to bundle with apps are, apparently, not entirely shared by other developers. :-)
It would be quite interesting if all the world religions’ and philosophies’ texts could be hosted with a common format and available with an API for linking and finding parallels etc.
Maybe then run it all though GPT-3 and generate a new ideology – perhaps a bit scary as to what will come out!
One thing which ancient texts require that modern ones don’t is this: there are a lot of commentaries written about these texts. They’re crucial for understanding the original text. In fact in the Arab world commentaries on Greek and other books were sometimes as valuable as the originals. Commentaries on commentaries were common.
In the west we treat the original as sacred and everything else as secondary.
A real value for an API on a sacred text is to capture all the commentary around it, and let people upload the present say contexts in which they understand it. That would be one way to “understand” a text.
That would be a crowd-sourced encyclopedia of hermeneutics.
Call it Wikineutics.
Good attempt!
And you will get the same answer from any of the multitude of non-Muslim professors in Islamic Studies faculties from universities throughout the non-Muslim world.
And in other news, no - the world is NOT flat. That myth was also debunked, long ago.
Mods - this is a blatent attempt to drag what is an interesting thread into the realm of Islamophobia and the resultant mud slinging that comes with it. Isn't there anything you can do to nip this sort of nonsense in the bud?
https://yaqeeninstitute.org/read/paper/the-origins-of-the-va...
Disclaimer: I am one of the contributors of the site.
In fact, an API that allows access to a religious text should be useful for everyone - even those detractors of said religion.
Next up, we need a legal code API and versioning.
I don't really want to shit on any particular religion, so I'll just say that what you've written does not apply to most religious people. Most religions have a live-and-let-live attitude when it comes to other people's religious beliefs.
Based on how many religions and sects of these religions out there, it is entirely unfeasible to have that as a criteria for anything. Human knowledge/text no matter what it contains could have APIs just fine.
In fact, the memory usage required to establish a few TLS sessions might even be greater than the size of the full dataset.
I could ask the same for other holy texts, I guess.
https://news.ycombinator.com/item?id=28595832
If you don't want to be banned, you're welcome to email hn@ycombinator.com and give us reason to believe that you'll follow the rules in the future. They're here: https://news.ycombinator.com/newsguidelines.html.
So English via API doesn't satisfy that.
Can you explain how I'd make calls from a frontend to a PDF? I'd like to include various search terms, and then get back well-structured data.
Is this something PDF's recently started supporting?