Quran-Tafseer / tafseer_api

Quran Tafseer REST APIs and Quran Text
MIT License
47 stars 8 forks source link

Documentation needs clarification (or API inconsistencies) #52

Closed ghost closed 4 years ago

ghost commented 5 years ago
screen shot 2019-02-25 at 9 13 18 pm

I was in the process of writing a ~python~ client for the API when I noticed an inconsistency. The documentation above shows that the query can be made without a trailing slash. When querying the API without a trailing slash for tafseer, a 301 Permanently Moved is returned with a redirect to the same URI with a trailing slash appended. See here:

% curl http://api.quran-tafseer.com/tafseer/1/2/1 -vvv
*   Trying 188.166.0.196...
* TCP_NODELAY set
* Connected to api.quran-tafseer.com (188.166.0.196) port 80 (#0)
> GET /tafseer/1/2/1 HTTP/1.1
> Host: api.quran-tafseer.com
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Server: nginx/1.14.0 (Ubuntu)
< Date: Tue, 26 Feb 2019 03:10:21 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 0
< Connection: keep-alive
< Location: /tafseer/1/2/1/
< Vary: Accept-Language, Cookie
< Content-Language: en
<
* Connection #0 to host api.quran-tafseer.com left intact

Some clients (like the library used by cURL above), don't follow redirects by default and might break here. Should the documentation be clarified to require the trailing slash? If so, my only nit would be that the tafseer resources seems inconsistent with the quran resources given the latter don't require a trailing slash in their URIs.

jazakumallah khair for your work on this project

EmadMokhtar commented 5 years ago

Thanks, @amerghazal for reporting this, I will fix it.

BTW I made a Python client if you would like to contribute to it as well.

ghost commented 5 years ago

thanks! i saw that after i had gotten started - i'll look into it iA. i'm happy to submit a PR if you can tell me whether you prefer addressing the API or the documentation.

EmadMokhtar commented 5 years ago

@amerghazal If you mean by addressing the API is this bug, then no I will do it. it is an easy fix. I want to help more in the documentation part/

ghost commented 5 years ago

sounds good, JAK