Navisen IDX API Public API Methods Version 1.2.4 //////////////////////////////////////////////////////////////////////////////// Constructor: var idx = new NavisenIDX(apiKey: Number, callback: Function); Description: self explanatory. [apiKey: Number] Navisen will provide you with an unique API key to hardcode in the constructor for each individual client website after they are registered with TRREB. During development, this API must be run on a LocalHost (127.0.0.1) for the test API key 500 to work! If you don't have a LocalHost to develop on, download WebServer for Chrome to run a LocalHost: https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb [callback: Function] Custom call back function that is triggered when IDX API is in ready state. You should not call any idx.method() until this callback is ready. Call back receives one parameter as its responseObject. [responseObject: Object] responseObject.email - an email address if the user is already logged in. If the login is determined by the API to be expired (90 day max login session as per TRREB rules), then the API will auto logout the user and an empty string will show in this response field. Ensure you show the logout state user interface if there is nothing in the responseObject.email response field. responseObject.favouritesUser - the name and contact info of the local MLS favourites user //////////////////////////////////////////////////////////////////////////////// requestPassword(email: String) Description: sends an one-time-password (OTP) to the email specified. [email: String] Email address to send OTP to. //////////////////////////////////////////////////////////////////////////////// resendPassword(email: String) Description: re-sends an one-time-password (OTP) to the email specified. [email: String] Email address to send OTP to. //////////////////////////////////////////////////////////////////////////////// login(email: String, OTP: Number, callback: Function) Description: attempts to authenticate VOW session with email address and the one-time-password code sent to the specified email address via requestPassword(). If the email was not previously registered with TRREB, it will automatically be registered as part of the login process. [email: String] Email address that OTP was sent to. [OTP: Number] One-Time-Password number received by email. [callback: Function] Custom call back function that is triggered when login is successful. Call back receives one parameter as its responseObject. [responseObject: Object] responseObject.email: String - email address that was provided to login responseObject.success: Boolean - true or false responseObject.reason: String - if failure, reason for failure is provided //////////////////////////////////////////////////////////////////////////////// logout() Description: logs out of current VOW session. //////////////////////////////////////////////////////////////////////////////// search(paramsObject: Object, callback: Function) Description: General search function. If Google Maps visual search is activated, it will automatically re-plot new markers on the map for all search results. [paramsObject: Object] includeVOW: Boolean bike: Boolean roof: Boolean gym: Boolean pool: Boolean party: Boolean parking: Boolean bedrooms: Number, minimum number of bedrooms washrooms: Number, minimum number of washrooms squareFootage: { "min": Number, "max": Number } listPrice: { "min": Number, "max": Number } region: String, see getRegions() city: String, see getCities() community: String, see getCommunities() buildingType: possible String values: "residential", "lease" buyLease: possible String values: "buy", "lease" [callback: Function] Custom call back function that is triggered when search returns with results. Call back receives one parameter as its responseObject. [responseObject: Object] If the search was a success: responseObject.success: Boolean - if your API key and domain name is authorized to make a search on Navisen's IDX system, this field will return as true responseObject.data: Object - search result data, see below responseObject.pagesAvailable: Number - total number of pages of results available responseObject.currentPage: Number - current page of results being accessed If there was a search API error: responseObject.success: Boolean - false responseObject.reason: String - reason for failure If a MLS listing cannot be accessed, only the following fields will be returned: responseObject.data.Address: String responseObject.data.MLS: String responseObject.data.Reason: String - reason for failure (such as VOW user not logged in) responseObject.data.Success: false - if MLS listing is not allowed to be shown (because VOW is not logged in), this field will always be displayed as false responseObject.data.VOWListing: Boolean - whether this is a VOW listing type or not If a MLS listing can be accessed, the following fields will be returned: responseObject.data.ApartmentNumber: String responseObject.data.Address: String responseObject.data.ApproxSquareFootage: Number responseObject.data.Area: String responseObject.data.Basements: String responseObject.data.Bedrooms: Number responseObject.data.BedroomsPlus: Number responseObject.data.BuildingAmenities1: String responseObject.data.BuildingAmenities2: String responseObject.data.BuildingAmenities3: String responseObject.data.BuildingAmenities4: String responseObject.data.BuildingAmenities5: String responseObject.data.BuildingAmenities6: String responseObject.data.BuildingDescription: String responseObject.data.BuildingType: String responseObject.data.Community: String responseObject.data.Description: String responseObject.data.Exterior: String responseObject.data.Extras: String responseObject.data.GarageType: String responseObject.data.GarageSpaces: Number responseObject.data.HeatSource: String responseObject.data.ListBrokerage: String responseObject.data.ListPrice: String responseObject.data.Maintenance: String responseObject.data.MLS: String responseObject.data.Municipality: String responseObject.data.PhotoGallery: Array responseObject.data.PostalCode: String responseObject.data.Reason: String responseObject.data.Region: String responseObject.data.Sewers: String responseObject.data.Status: String responseObject.data.Style: String responseObject.data.Success: true - if MLS listing is allowed to be shown, this field will always be displayed as true responseObject.data.Taxes: String, responseObject.data.TotalParkingSpaces: Number responseObject.data.VOWListing: Boolean - whether this is a VOW listing type or not responseObject.data.Washrooms: Number //////////////////////////////////////////////////////////////////////////////// searchByBrokerageName(brokerageObject: Object, callback: Function) Description: search by brokerage name. Must provide exact spelling and case of brokerage name as provided in example. If Google Maps visual search is activated, it will automatically re-plot new markers on the map for all search results. [brokerageObject: Object] ListBrokerage: String, qualified brokerage name only DefaultSearchType: possible String values: "residential", "condo", "both" DefaultSalesLeaseType: possible String values: "sale", "lease", "both" includeVOW: Boolean [callback: Function] Custom call back function that is triggered when search returns with results. Call back receives one parameter as its responseObject. [responseObject: Object] Same responseObject as search() //////////////////////////////////////////////////////////////////////////////// searchByMLS(MLSArray: Array, callback: Function) Description: search with an unlimited number of MLS. If Google Maps visual search is activated, it will automatically re-plot new markers on the map for all search results. [MLSArray: Array] Provide an array of MLS string values to search for. [callback: Function] Custom call back function that is triggered when search returns with results. Call back receives one parameter as its responseObject. [responseObject: Object] Same responseObject as search() //////////////////////////////////////////////////////////////////////////////// getRegions() Description: self explanatory Returns: an array of strings with the names of all of Ontario's regions. //////////////////////////////////////////////////////////////////////////////// getCities(regionName: String) Description: self explanatory [regionName: String] String name of region desired. Returns: an array of strings with the names of all the cities from any desired region. //////////////////////////////////////////////////////////////////////////////// getCommunities(cityName: String) Description: self explanatory [cityName: String] String name of city desired. Returns: an array of strings with the name of all the communities from any desired city. //////////////////////////////////////////////////////////////////////////////// getAllCondoPreconstructions() Description: provides the entire list of active condo projects. Returns: an array of objects containing info about all available condo preconstruction projects. //////////////////////////////////////////////////////////////////////////////// getCondoPreconstruction(projectName: String) Description: get specific condo preconstruction project by specific name. [projectName: String] Specific Project Names can be retrieved from getAllCondoPreconstructions(). Returns: an object containing info about a particular condo preconstruction project. //////////////////////////////////////////////////////////////////////////////// currencyFormat() Description: utility function that formats any big number up to 10 digits into a currency format with commas and a $ at the front. Backwards compatible with older browsers. Returns: String value of currency input number. //////////////////////////////////////////////////////////////////////////////// setDedicatedServerNodes(URLArray) Description: Input a list of URLs of server nodes. For enterprise API customers who want to start their own branded IDX/VOW service by renting as many dedicated IDX/VOW server nodes from Navisen for exclusive use for themselves and/or their clients. Navisen provides both domain names, SSL certificates and setup included in rental cost of server nodes. Contact Navisen Sales for more information. //////////////////////////////////////////////////////////////////////////////// loginToFavouritesAccount(name, contact) Description: create a local favourites account stored in local storage only. Returns: String - the concatenated name and contact as userID //////////////////////////////////////////////////////////////////////////////// logoutFavouritesAccount() Description: logs out of any local favourites account that is currently logged in. //////////////////////////////////////////////////////////////////////////////// addToFavourites(MLS) Description: must be logged into a local favourites account first. Adds a MLS to currently logged in local favourites account. //////////////////////////////////////////////////////////////////////////////// removeFromFavourites(MLS) Description: must be logged into a local favourites account first. Removes a MLS to currently logged in from local favourites account. //////////////////////////////////////////////////////////////////////////////// getFavourites(callback) Description: must be logged into a local favourites account first. Gets an Object listing all the MLS back. [responseObject: Object] responseObject.success: Boolean - true or false responseObject.data: Object - list of MLS responseObject.reason: String - if there's a failure, the reason will be stated here //////////////////////////////////////////////////////////////////////////////// checkIfFavExists(MLS) Description: check if a particular MLS exists in the currently logged in user's favourites list. Returns: Boolean //////////////////////////////////////////////////////////////////////////////// getFavUserName() Description: returns the name of the logged in user, if logged in. Returns: String //////////////////////////////////////////////////////////////////////////////// getFavContact() Description: returns the contact information of the logged in user, if logged in. Returns: String //////////////////////////////////////////////////////////////////////////////// setBypassCache(Boolean) Description: gives the option to skip fetching results from local cache and always get the latest results from the server instead. By default, API does not bypass cache so to bypass cache, this option must explicitly be set to true in order to bypass cache. //////////////////////////////////////////////////////////////////////////////// clearCache() Description: this clears the client side cached search results for both IDX and VOW if any. Sometimes, after an upgrade or bug fix, the new data is slightly modified so the old cache becomes invalid or outdated or incompatible with new data structures. It is not recommended to clear cache every time the user re-activates the API. While this feature is available more for debugging and convenience, it is not even recommended to use this function at all in production environment. //////////////////////////////////////////////////////////////////////////////// getWalkScore(apiKey, MLS, callback) [apiKey: Number] - you must provide your own developer API key from WalkScore to use this feature (https://www.navisen.com/how_to_setup_google_map.html) [MLS: String] - the MLS number you want to retrieve a WalkScore rating for. [callback: Function] - the callback function that will receive the response data from WalkScore. Description: Get a WalkScore/BikeScore/TransitScore rating for any MLS. [responseObject: Object] JSON object response from WalkScore service. //////////////////////////////////////////////////////////////////////////////// initGoogleMaps(apiKey, divID, callback) [apiKey: Number] - you must provide your own developer Google Maps API key from Google to use this feature (https://www.navisen.com/how_to_setup_google_map.html). [divID: String] - the ID of the