Bismillah

For developers

masjidnear.me exposes API that can be used by developers to get masjids from our database

The search API - http://masjidnear.me/api/Masjid/SearchMasjids/query/{querystring}/
 
This is a web API that can be called from the masjidnear.me domain, it uses the GET method and returns a JSON response.
The main component of this API is the query string that will retrieve the masjids. This query needs to be designed in a way, that will for a search string that will be understood by the application. masjidnear.me used MongoDB as the database. The description of each component of the query and its usage is explained below.

Search by coordinates

 
To search for a masjid using the latitude and longitude, use the search terms lat & lng.
The search query should have the search term followed by a dollar symbol ($) followed by the value, for example, if the latitude needs to be 12.3682265169693, then the search query should contain: lat$12.3682265169693. And if this needs to be followed by the longitude then, use a comma (,) as the term separator; for example, if the logitude is 76.6509528432083, then the search query would be lat$12.3682265169693,lng$76.6509528432083.
A radius can be passed to the coordinate search as a optional parameter; to provide the search radius to the query we need to use the search term rad.This is a value that should be in meters. For example, if the radius is 3000 meters (3 Kilometers, 1.864 miles) then this should be included in the query : lat$12.3682265169693,lng$76.6509528432083,rad$3000
 Therefore complete search API would be: http://masjidnear.me/api/Masjid/SearchMasjids/query/lat$12.3682265169693,lng$76.6509528432083,rad$3000/

There is more than just syntax that need to be taken care of when generating a coordinates query. Listed below are the this you should keep in mind

  • For a location query, the latitude and longitude are mandatry
  • If the search radius in not specified (but the latitude and longitude are present), then a default radius of 2000 meters would be taken
  • If the radius is provided without the latitude or longitude, then it would not be considered

Search by Masjid name

 
To search for a masjid using it's name, use the search terms name.
The search query needs to have the search term followed by a dollar symbol ($) then the value, for example, if the name is Sidiq Masjid, then the search query should be: name$Siddiq Masjid.
 Therefore complete search API would be: http://masjidnear.me/api/Masjid/SearchMasjids/query/name$Siddiq Masjid/

Search by Country

 
To search for a masjid using it's country, use the search terms country.
The search query needs to have the search term followed by a dollar symbol ($) then the value, for example, if the country is India, then the search query should be: country$India.
 Therefore complete search API would be: http://masjidnear.me/api/Masjid/SearchMasjids/query/country$India/

Search by City

 
To search for a masjid using it's city, use the search terms city.
The search query needs to have the search term followed by a dollar symbol ($) then the value, for example, if the city is London, then the search query should be: city$London.
 Therefore complete search API would be: http://masjidnear.me/api/Masjid/SearchMasjids/query/city$London/

Search by Pin/Zip Code

 
To search for a masjid using it's zip code or pin code, use the search terms pin.
The search query needs to have the search term followed by a dollar symbol ($) then the value, for example, if the pin/zip code is 560040, then the search query should be: pin$560040.
 Therefore complete search API would be: http://masjidnear.me/api/Masjid/SearchMasjids/query/pin$560040/
 
Combining the search queries is simple. Seperate each search term with a comma (,), therefore the complete API would be
http://masjidnear.me/api/Masjid/SearchMasjids/query/lat$12.3682265169693,lng$76.6509528432083,rad$3000,name$Siddiq Masjid,country$India,city$Bengaluru,pin$560040/

Other stuff you need to know

    All the masjids returned are from the database of masjidnear.me. You might have noticed, that there are some unverified masjids returned when you search on the site; these are not included in the database and therefore will not be returned by the search API. If the unverified masjids are verified by users, then they would be added to our database, and would appear in the search result.
Every search term needs to be separated from its value with a $ sign.
Every search string needs to be seperated from another search sting, with the , sign.