api.aladhan.com icon indicating copy to clipboard operation
api.aladhan.com copied to clipboard

Return country & city information in addition to coordinates

Open Nurou opened this issue 4 years ago • 5 comments

Since the project uses Google Maps API for the geocoding, it would be useful to also get the country and city data in the response alongside the coordinates currently being returned.

When getting times by coordinates (geolocation API), I need to additionally reverse geocode the coordinates in order to know what city the times are for. It'd be great to have the available directly from the response.

Thanks!

Nurou avatar Sep 01 '21 20:09 Nurou

@Nurou Thank you for reaching out.

So far I have intentionally removed this as it encourages abuse of the service by people who actually have no interest in prayer times but want to reverse engineer co-ordinates.

We can always add authentication to the API, but that's something I have stayed clear of thus far.

Which endpoint are you using?

meezaan avatar Sep 02 '21 05:09 meezaan

Thanks for the response and that's a fair point which I hadn't considered. The endpoint I initially call is (using IP location info):

http://api.aladhan.com/v1/timingsByCity/city=${city}&country=${country}

If/when the user grants geolocation info, I fetch times using the following endpoint:

http://api.aladhan.com/v1/timings/null?latitude={lat}&longitude={long}

But, now I've lost information about the city since the geolocation API doesn't return it, and neither does the adhan endpoint. I need it to update the UI so the user knows which city the time is based on.

Nurou avatar Sep 02 '21 06:09 Nurou

OK, give me a few days to think about it.

Are you making your call client side or server side? Basically all machine to machine authentication become useless if the call is done purely on the client side.

Also, you can drop the null from the second api call.

/v1/timings?latitude.... should work just fine if you're always getting the time 'now'.

meezaan avatar Sep 02 '21 06:09 meezaan

Yeah, sure.

I make all calls client side (I'm not running a server).

Nurou avatar Sep 02 '21 08:09 Nurou

@Nurou I am working on a solution for this. Thanks for your patience.

meezaan avatar Nov 05 '22 15:11 meezaan