Comments (3)
Salaam brother.
The Adhan audio and backgrounds aren't semantically arranged to return via an API, per se. If you can explain your use case we can always looking at doing it if it is useful or helpful.
But all of this is already available over HTTP via the AlAdhan CDN, which is a simple git repo. See https://github.com/islamic-network/cdn.aladhan.com/tree/master/html/images/backgrounds and https://github.com/islamic-network/cdn.aladhan.com/tree/master/html/audio/adhans.
Does this help?
from api.aladhan.com.
This is a good start is there. Thanks for sharing I missed to look into cdn.aladhan.com I will browse at what's available there shortly.
-
I am building my own view of the Timings and wanted to leverage the available audio and backgrounds like I leverage the API instead of building my own.
-
Is there a related JSON of these resources (background, audio) that's kept in sync with the files on the CDN? or should I for now just assume there are sequentially named and build my own JSON array for them?
Thank you for helping out.
To be more concrete here is a sample of JSON I would think would be useful:
{
"Adhans": [ {
"URL": "https://cdn.aladhan.com/audio/adhans/a4.mp3",
"Author": "AlAfasi"
},
{...} ]
}
like wise for the images....
{
"Backgrounds": [ {
"URL": "https://cdn.aladhan.com/images/backgrounds/3.jpg",
"Location": "Lahore, Pakistan",
"Description": "Famous palace, Mosque"
},
{...} ]
}
- I am programming with TypeScript under Ionic/Angular frameworks. Perhaps this is trivial for you, but in my case I had to convert the timings into an array of objects in order to iterate over it using Angular html binding. Angular will not iterated over object keys. Perhaps it's not an issue in JS? or you may have directly referenced each time by its key for example timings.Fajr, to achieve the layout for all? I guess what I am trying to say is that you may want to consider presenting your API JSON with some arrays where it makes sense.
from api.aladhan.com.
The images are numeric values, so an array is not needed, at least not in the current state. See https://github.com/islamic-network/aladhan.com/blob/master/html/js/app.js#L8. Also, I actually don't know where all the locations are - most of them, yes, but not all, so a list might not be entirely accurate. Instead of an API, it might just be right to add a file in the images folder called images.json which contains this - and it will also be accessible over the CDN. You can make a start and raise a PR on the cdn.aladhan.com repo if this is something you need urgently.
As far as the timings response is concerned, it is an object on purpose. The order of that object might change any time, and I may add an additional field to it - if it was an array and clients looped around it to build their UI, their UI would break if we added an additional field or change the order.
I would, therefore, not loop through it.
Also, an array would be semantically incorrect, unless the response format was changed to something similar:
data: {
timings: [
{
"name": "Fajr",
"time": "04:28"
},
{
"name": "Sunrise",
"time": "05:37"
},
{
"name": "Dhuhr",
"time": "12:15"
},
...
],
...
}
Aside from fitting a UI that wants to loop through timings, this design serves no purpose and simply increases the size of the payload - and it makes a particular object direct inaccessible.
from api.aladhan.com.
Related Issues (20)
- Add Moonsighting Prayer Times Method HOT 5
- Automatically select calculation method based on the location to the closest authority HOT 3
- limited API HOT 3
- Add Cache Control Header to Response
- No such file or directory in /var/www/config/init.php HOT 1
- Service is unstable HOT 11
- Not working for about 3 days now HOT 4
- Prayer times as date objects HOT 6
- nextPrayerByAddress throws DateTime Error
- Return country & city information in addition to coordinates HOT 5
- A server response — we could make smaller JSON HOT 1
- Inconsistent Hijri day between calendar and v1 timingsByCity HOT 1
- state or region parameter to timingsByCity is not recognized or validated correctly HOT 5
- Missing Ramadan days with adjustment HOT 1
- Is the api down HOT 7
- ISO 8061 format is wrong? HOT 6
- api down HOT 4
- Tune setting not working when using a custom method HOT 2
- JSON returned by API endpoint v1 timingsByCity is not matching the demo app play link HOT 5
- Prayer times differ between timingsByCity and calendarByCity HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from api.aladhan.com.