Prayer times made available through api, so everyone can benefit the easy access for prayer times with less effort to develop custom applications for verity of software's / application's.
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate.
All API data is served in json format.
JSONP is a communication technique used in Javascript. It provides a method to request data from a server in a different domain, something prohibited by typical web browsers because of the same origin policy.
To use jsonp technique, just use callback or jsoncallback parameter on the url and it will call the javascript callback function for execution.
jQuery(function($) {
$.getJSON('http://muslimsalat.com/london/daily.json?jsoncallback=?', function (times)
{
$('.prayerTimesExample')
.append('Today in '+times.title)
.append(' Fajr: '+times.items[0].fajr)
.append(' Dhuhr: '+times.items[0].dhuhr)
.append(' Asr: '+times.items[0].ashr)
.append(' Maghrib: '+times.items[0].maghrib)
.append(' Isha: '+times.items[0].isha)
.append(' by MuslimSalat.com');
});
});
This will fetch user prayer times with automatically selecting the location for user.
http://muslimsalat.com/daily.json
You can get time in the following timeline.
This will fetch the prayer time based on the location you request for with the given parameters.
Prayer Times
Today prayer times for london:
http://muslimsalat.com/london.json
Weekly prayer times for london starting from today:
http://muslimsalat.com/london/weekly.json
Next date weekly prayer times for london.
http://muslimsalat.com/london/weekly/12-01-2013.json
with daylight saying
http://muslimsalat.com/london/weekly/12-01-2013/true.json
and with Muslim World League calculation method.
http://muslimsalat.com/london/weekly/12-01-2013/true/5.json
All following parameters are optional, you can set as you wish. If you wish to set two or more parameters, then you have to set url in the order the parameter is given below.
if you want to set location and date. You should do following
http://muslimsalat.com/location/date.json
Parameters Properties and starting with the order for url
| Name | Values | Default value | Description |
|---|---|---|---|
| Location | City, country, state... | Auto select for the user | Name of the location where user is at or his state name or his country name or with his latitude and longitude . |
| Times | Daily, weekly, monthly or yearly | Monthly | Limit the prayer times by the value. |
| Date | 12-02-2012 | Today Date | Get the prayer times for the given date, please make sure the date is further head or current date. Heads up! Previous dates will be deprecated from the api. |
| Daylight saving | True or false | Auto select | Daylight saving for the user, if true then hours are incremented by 1+ |
| Method | 1 = Egyptian General Authority of Survey
2 = University Of Islamic Sciences, Karachi (Shafi) 3 = University Of Islamic Sciences, Karachi (Hanafi) 4 = Islamic Circle of North America 5 = Muslim World League 6 = Umm Al-Qura 7 = Fixed Isha |
Auto select based on the country where user is from. | Method to use for calculation of the timing. If method is provided invalid based on the country, it will give incorrect timing. |
Qibla compass images are based on given direction from the api response.
http://muslimsalat.com/qibla_compass/200/118.82.png
Parameters Properties and starting with the order for url
| Name | Values | Default value | Description |
|---|---|---|---|
| Size | 50 to 600 (optional) | 300 | Size of the image you want to show |
| Direction | 0 to 360 degree | Direction degree from json response |
Example: