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('https://muslimsalat.com/london/daily.json?key=API_KEY&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'); }); });
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.
https://muslimsalat.com/daily.json?key=api_key
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:
https://muslimsalat.com/london.json?key=api_key
Weekly prayer times for london starting from today:
https://muslimsalat.com/london/weekly.json?key=api_key
Next date weekly prayer times for london.
https://muslimsalat.com/london/weekly/12-01-2013.json?key=api_key
with daylight saying
https://muslimsalat.com/london/weekly/12-01-2013/true.json?key=api_key
and with Muslim World League calculation method.
https://muslimsalat.com/london/weekly/12-01-2013/true/5.json?key=api_key
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
https://muslimsalat.com/location/date.json?key=api_key
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.
https://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:
You can do experiment now with our lab area, to check all the prayer times and the calculation values for each location and to test your own values for prayer times.