islamic-network / api.aladhan.com

The AlAdhan API
GNU General Public License v3.0
118 stars 30 forks source link

API does no longer returns yearly prayer times #69

Closed nayefag closed 5 months ago

nayefag commented 6 months ago

The previous API used to take annual=true to return all 12 months in a year of prayer times.

The option seems to have been removed and the documentation says that if you omit the "month" option, it will be equivalent.

However, removing both "annual=true" and "month" seems to be equivalent to "month=1".

I can't find a way to return prayer times for full year as it used to work before.

meezaan commented 6 months ago

@nayefag Can you please share the API call you are making?

https://api.aladhan.com/v1/calendarByCity/2017?city=London&country=United%20Kingdom&method=2 seems to return what I'd expect, all of 2017.

nayefag commented 6 months ago

I use this API /usr/bin/wget --quiet -O - 'http://api.aladhan.com/v1/calendar?latitude=51.5072&longitude=0.12760&method=2&timezonestring=America/Chicago&year=2024&midnightMode=1'

This used to work for me. I used to add "annual=true" and some dummy "month" value, but according to the latest docs this is no longer needed (just omitting month should work).

Thanks.

meezaan commented 6 months ago

I use this API /usr/bin/wget --quiet -O - 'http://api.aladhan.com/v1/calendar?latitude=51.5072&longitude=0.12760&method=2&timezonestring=America/Chicago&year=2024&midnightMode=1'

This used to work for me. I used to add "annual=true" and some dummy "month" value, but according to the latest docs this is no longer needed (just omitting month should work).

Thanks.

I think you are not reading the docs right. You need to specify the year in the URL as the docs say: http://api.aladhan.com/v1/calendar/:year/:month. If you omit the month, you will get the year.

meezaan commented 5 months ago

Any luck @nayefag?

nayefag commented 5 months ago

No luck, sorry.

I tried your example and added ?latitude and other information and I do not get any output.

I get a 404 error.

nayefag commented 5 months ago

/usr/bin/wget -O - 'http://api.aladhan.com/v1/calendar/:2024?latitude=51.5072&longitude=0.12760&method=2&timezonestring=America/Chicago&midnightMode=1'

... HTTP request sent, awaiting response... 400 Bad Request 2024-01-04 09:57:14 ERROR 400: Bad Request.

This one I added a month:

/usr/bin/wget -O - 'http://api.aladhan.com/v1/calendar/:2024:1?latitude=51.5072&longitude=0.12760&method=2&timezonestring=America/Chicago&midnightMode=1'

... Connecting to api.aladhan.com (api.aladhan.com)|109.74.197.73|:80... connected. HTTP request sent, awaiting response... 400 Bad Request 2024-01-04 09:59:36 ERROR 400: Bad Request.

meezaan commented 5 months ago

Why are you adding a : before the year?

That just means it is a variable you need to specify. Variables in docs are usually specified as :varname or {varname}.

nayefag commented 5 months ago

My bad. I didn't know this. Removing the : fixed the issue. Thanks for your help.