quran / quran.com-api

Quran.com content APIs
https://api-docs.quran.foundation/docs/category/content-apis
MIT License
922 stars 192 forks source link

Accessing all verses #218

Closed fizcoder closed 5 years ago

fizcoder commented 5 years ago

I am attempting to retrieve verses for example:

http://staging.quran.com:3000/api/v3/chapters/87/verses

It returns the first 10 verses. But when I added a 'page' query string, for example:

http://staging.quran.com:3000/api/v3/chapters/87/verses?recitation=1&translations=21&language=en&page=591&text_type=words

or

http://staging.quran.com:3000/api/v3/chapters/87/verses?recitation=1&translations=21&language=en&page=592&text_type=words

No verses are returned. Please advice. Thanks.

fizcoder commented 5 years ago

Also, when I attempt to use the verse API for example:

http://staging.quran.com:3000/api/v3/verses/1

I get the following message:

The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved. If you are the application owner check the logs for more information.

fizcoder commented 5 years ago

Thanks for your response. But I'm not sure how that helps with my issue.

naveed-ahmad commented 5 years ago

Surah 87 has only 19 ayah, that means only two pages. page=591 is query string wont return any ayah.

Api also has limit query string that you can use to increase the number of ayah in response. I think maximum value for limit is 50.

Try following URL to load all ayahs.

http://staging.quran.com:3000/api/v3/chapters/87/verses?recitation=1&translations=21&language=en&limit=50&text_type=words

fizcoder commented 5 years ago

Many thanks! That worked!