Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should API return pure data? #116

Open
Abdur-rahmaanJ opened this issue Oct 7, 2020 · 3 comments
Open

Should API return pure data? #116

Abdur-rahmaanJ opened this issue Oct 7, 2020 · 3 comments

Comments

@Abdur-rahmaanJ
Copy link

Abdur-rahmaanJ commented Oct 7, 2020

Aslm,

saw that on this query: https://api.sunnah.com/v1/collections/bukhari/books/1/chapters?limit=50&page=1 you receive among the response:

    {
          "lang": "ar",
          "chapterNumber": "1",
          "chapterTitle": "باب كَيْفَ كَانَ بَدْءُ الْوَحْىِ إِلَى رَسُولِ اللَّهِ صلى الله عليه وسلم",
          "intro": "<p>وَقَوْلُ اللَّهِ جَلَّ ذِكْرُهُ: {إِنَّا أَوْحَيْنَا إِلَيْكَ كَمَا أَوْحَيْنَا إِلَى نُوحٍ وَالنَّبِيِّينَ مِنْ بَعْدِهِ}</p>",
          "ending": null
        }

for the intro part, should api not return html-less data? What if someone is using the API for a commandline application? He won't need HTML. Or what if the user expects only the text and the <p> messes with his UI?

@ahadith
Copy link
Contributor

ahadith commented Oct 14, 2020

Wa`alaykum ussalam warahmatullah

Thank you for your message. For the hadith text field, I believe we have separate HTML and text-only fields. We may have neglected to do this for chapters.

@hasankhan Can we strip HTML tags from the returned chapter title and intro field? Or have HTML and non-HTML versions? Sometimes those fields contain hyperlinks to Qur'anic ayat.

@Abdur-rahmaanJ
Copy link
Author

Jzkl for addressing issue!

@hasankhan
Copy link
Collaborator

@ahadith yes we can. I'll take a look insha'Allah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants