sunnah-com / api

API for sunnah.com
https://sunnah.com
320 stars 62 forks source link

"Get a list of hadiths" not working #253

Open Thuliumitation opened 3 years ago

Thuliumitation commented 3 years ago

Assalamualaikum. I am trying to get a hadith from Bukhari by using "https://api.sunnah.com/v1/hadiths?collection=bukhari&bookNumber=3&chapterId=23&hadithNumber=43" but it shows 403 Forbidden { "message": "Missing Authentication Token" } I tried using my token and also the default one too, but it doesn't work. Thank you

ahadith commented 3 years ago

Wa`alaykum ussalam warahmatullah. It is a REST API, so the way you access it for your example is with the URL https://api.sunnah.com/v1/collections/bukhari/hadiths/43 while passing in the API key as a value for the header X-API-KEY.

Thuliumitation commented 3 years ago

Waalaykum ussalam warahmatullah. It is a REST API, so the way you access it for your example is with the URLhttps://api.sunnah.com/v1/collections/bukhari/hadiths/43while passing in the API key as a value for the headerX-API-KEY`.

Is there a way to specify the book and chapter number?

ahadith commented 3 years ago

Once you specify the hadith number, there is no need to specify the book and chapter number. You can get a list of hadith in a book using this route: https://sunnah.api-docs.io/1.0/collections/get-the-list-of-hadith-of-a-book-for-a-collection

nadahamdy217 commented 5 months ago

how can i get api key