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.
###Example
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].asr)
.append(' Maghrib: '+times.items[0].maghrib)
.append(' Isha: '+times.items[0].isha)
.append(' by MuslimSalat.com');
});
});
###Output:
Today in UK Fajr: 1:28 am Dhuhr: 12:06 pm Asr: 4:25 pm Maghrib: 8:21 pm Isha: 10:43 pm by MuslimSalat.com
To get started with api request, you will need api key. Get your API KEY now.
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
to read more about parameters, please check url parameters section on http://muslimsalat.im/api
Qibla compass images are based on given direction from the api response.
http://muslimsalat.com/qibla_compass/200/118.82.png
###Example: