Skip to content

Instantly share code, notes, and snippets.

@harrisonmalone
Created February 23, 2020 03:52
Show Gist options
  • Save harrisonmalone/07efd0f6dd4fbfb4aa63f60325331e0d to your computer and use it in GitHub Desktop.
Save harrisonmalone/07efd0f6dd4fbfb4aa63f60325331e0d to your computer and use it in GitHub Desktop.
const axios = require('axios');
const requestBody = {
"listingType":"Rent",
"propertyTypes":[
"Townhouse",
"ApartmentUnitFlat"
],
"minBedrooms": 2,
"minPrice": 500,
"maxPrice": 620,
"locations":[
{
"state":"VIC",
"region":"",
"area":"",
"suburb":"Richmond",
"postCode":"3121",
"includeSurroundingSuburbs":true
}
],
"pageSize": "200"
}
const axiosConfig = {
"headers": {
"X-API-Key": process.env.API_KEY
}
}
const search = async () => {
const request = await axios.post("https://api.domain.com.au/v1/listings/residential/_search", requestBody, axiosConfig)
console.log(request.data)
}
search()
{
"name": "domain",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.19.2",
"dotenv": "^8.2.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment