Bismillah

For developers

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

The search API - https://api.masjidnear.me/v1/masjids/search?{querystring}
 
This is a REST API that can be called from the api.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.
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 and & 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 2000 meters (2 Kilometers, 1.25 miles) then this should be: lat=12.3682265169693&lng=76.6509528432083&rad=2000
 Complete search API would be: https://api.masjidnear.me/v1/masjids/search?lat=12.3682265169693&lng=76.6509528432083&radius=2000

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 name, If the name is masjid, then the search query should be:  name=masjid.
 Therefore complete search API would be: https://api.masjidnear.me/v1/masjids/search?name=masjid/

Search by City

 
To search for a masjid using it's city, use the search terms city.

Other stuff you need to know

TODO