I'm new to APIs and am trying to figure out how to make a Zillow call with JavaScript, specifically the "getsearchresults". Thanks
Asked
Active
Viewed 2,866 times
1
-
4Welcome to SO, what have you tried so far? We can't write your code for you, but will help answer any questions you have. – mattdevio Mar 27 '18 at 16:22
-
1First you need [an account](https://www.zillow.com/webservice/Registration.htm) to use the API, then read about the [`GetSearchResults`](https://www.zillow.com/howto/api/GetSearchResults.htm) call. – Mr. Polywhirl Mar 27 '18 at 16:22
-
It depends on your JavaScript and where your code is. Is it latest standard, part of nodejs, or legacy? you can look into promises, fetch, or other asynchronous JavaScript calls. – Brandon Culley Mar 27 '18 at 16:28
1 Answers
3
You'll need to use Javascript on the server-side using Node. It won't be possible to call the API on the front-end with Javascript. See this answer.
For using Node to call the Zillow API, check out the node-zillow package. Here's an example of how to use it with the GetSearchResults
API call:
const Zillow = require("node-zillow")
const zillow = new Zillow('your key here')
const parameters = {
address: "2114 Bigelow Ave",
citystatezip: "Seattle, WA",
rentzestimate: false
}
zillow.get('GetSearchResults', parameters)
.then(results => {
console.log(results)
return results
})
Make sure you signup for ZWSID here: https://www.zillow.com/webservice/Registration.htm. You'll use this unique id when making the request to the API. It'll look something like this: X2-Ijdjkxlujnkd_jske2
. Keep it secret, keep it safe!

Jeff Appareti
- 311
- 3
- 6
-
How would one loop through the data? I get back this: response: { results: { result: [Array] } } } @Jeff Appareti – FabricioG Sep 04 '18 at 23:33
-
Depending on what you want to do with the data, you could use `forEach`, `map`, `filter` on `response.results.result`. For example `response.results.result.forEach(item => console.log(item))` would loop through the items in the `result` Array – Jeff Appareti Sep 05 '18 at 21:35