realtorca v1.1.0
realtorca
Wrapper for the realtor.ca API
https://api2.realtor.ca/Listing.svc/PropertySearch_Post
Methods
realtor.post - returns a request-promise POST with the given options
realtor.buildUrl - returns a URL with the query string constructed from the specified options.
realtor.optionsFromUrl - returns options from a URL from realtor.ca (from the map view)
^ Note: The website link from buildUrl only allows specific price quantities. Any inconsistent PriceMin and PriceMax values will be rounded up to the next price level. Read the source for clarification.
Usage
const realtor = require('realtorca');
let opts = {
LongitudeMin: -79.6758985519409,
LongitudeMax: -79.6079635620117,
LatitudeMin: 43.57601549736786,
LatitudeMax: 43.602250137362276,
PriceMin: 100000,
PriceMax: 410000
};
console.log( realtor.buildUrl(opts) );
//https://www.realtor.ca/Residential/Map.aspx#LongitudeMin=-79.6758985519409&LongitudeMax=-79.6079635620117&LatitudeMin=43.57601549736786&LatitudeMax=43.602250137362276&PriceMin=100000&PriceMax=425000
// Parse options from url
console.log(realtor.optionsFromUrl("https://www.realtor.ca/Residential/Map.aspx#LongitudeMin=-79.6758985519409&LongitudeMax=-79.6079635620117&LatitudeMin=43.57601549736786&LatitudeMax=43.602250137362276&PriceMin=100000&PriceMax=425000"));
realtor.post(opts)
.then(data => {
//json response
})
.catch(err => {
});API Reference/Options
Most of the information was pulled from the DOM nodes on the website
All of the following options are optional. The first 3 listed are required but the wrapper will provide a default if they aren't specified.
CultureId-1for EN,2for FR. Defaulted to 1.ApplicationId- Unused. Defaulted to 1.PropertySearchTypeId- Defaulted to 1. Determines the type of property, possible values:0No Preference1Residential2Recreational3Condo/Strata4Agriculture5Parking6Vacant Land8Multi Family
Most useful options
PriceMin- Defaults to 0PriceMaxLongitudeMin- Designates the bounds of the query, easiest to find these values from browser requests.LongitudeMaxLatitudeMinLatitudeMaxTransactionTypeId- Defaults to 2?1For sale or rent2For sale3For rent
StoreyRange-"min-max"i.e."2-3"BedRange-"min-max"if min = max, it searches for the exact value. If it's1-0, it means it's 1+. Maxes at 5BathRange-"min-max"
Others
- Sorting:
| Type | Sort |
|---|---|
| Low to High ($) | 1-A |
| High to Low ($) | 1-D |
| Date Posted: New to Old | 6-D |
| Date Posted: Old to New | 6-A |
| Open Houses First | 12-D |
| More Photos First | 13-D |
| Virtual Tour First | 11-D |
organizationID- sort/search by organizationID of a group of realtors. Value of this field can be found using a URL such as https://www.realtor.ca/Residential/OfficeDetails.aspx?OrganizationId=271479 as pointed out by Froren.individualID- sort/search by agentID. Can be found using a URL such as https://www.realtor.ca/Agent/1914698/Gaetan-Kill-130---1152-Main... (in this case individualID = 1914698) as indicated by Kris.viewState-m,g, or1. Seems irrelevant.Longitude- Longitude to focus on? UnneededLatitude- Latitude to focus on? UnneededZoomLevel- not sure what this doesCurrentPage- read somewhere that it maxes at 51RecordsPerPage- maxes at 200MaximumResultsPropertyTypeGroupID- ???OwnershipTypeGroupId0Any1Freehold2Condo/Strata3Timeshare/Fractional4Leasehold
ViewTypeGroupId0Any1City2Mountain3Ocean4Lake5River6Ravine7Other8All Water Views
BuildingTypeId0Any1House2Duplex3Triplex5Residential Commercial Mix6Mobile Home12Special Purpose14Other16Row/Townhouse17Apartment19Fourplex20Garden Home27Manufactured Home/Mobile28Commercial Apartment29Manufactured Home
ConstructionStyleId0Any1Attached3Detached5Semi-detached7Stacked9Link
AirCondition-0or1, defaults 0Pool-0or1, defaults 0Fireplace-0or1, defaults 0Garage-0or1, defaults 0Waterfront-0or1, defaults 0Acreage-0or1, defaults 0Keywords- search textListingIds- Comma Separated listing IdsReferenceNumber- Search using MLS#OpenHouse-0or1, must include if filtering by open houseOpenHouseStartDate- MM/DD/YYYYOpenHouseEndDate- MM/DD/YYYY
Feel free to PR and fork.
