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

Return country & city information in addition to coordinates #46

Open
Nurou opened this issue Sep 1, 2021 · 5 comments
Open

Return country & city information in addition to coordinates #46

Nurou opened this issue Sep 1, 2021 · 5 comments
Assignees

Comments

@Nurou
Copy link

Nurou commented Sep 1, 2021

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!

@meezaan
Copy link
Member

meezaan commented Sep 2, 2021

@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 meezaan self-assigned this Sep 2, 2021
@Nurou
Copy link
Author

Nurou commented Sep 2, 2021

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.

@meezaan
Copy link
Member

meezaan commented Sep 2, 2021

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'.

@Nurou
Copy link
Author

Nurou commented Sep 2, 2021

Yeah, sure.

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

@meezaan
Copy link
Member

meezaan commented Nov 5, 2022

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

meezaan added a commit that referenced this issue Nov 7, 2024
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

2 participants