zillow package for a project. I've successfully executed a GetSearchResults() and gotten a response, but I don't exactly know how to process the response to get the information from it. For example, here is the log in the terminal from the call:
{ request:
{ address: '113 Cherry St',
citystatezip: 'Seattle, Washington' },
message: { text: 'Request successfully processed', code: '0' },
response: { results: { result: [Array] } } }
I see that I have an array called result which I presume has the information in it but how do I go about processing this?
Thanks
Looks like you're using the node-zillow
package. I signed up for a zillow api key to play with the package. Hard to believe the official API only returns XML...
To navigate the resulting JSON and print out the first results
, first set of links
, and grab its first homedetails
url.
const Zillow = require('node-zillow');
// get key from environment variable
const z = new Zillow(process.env.ZWSID);
const params = {
address: '2512 Mapleton Ave.',
citystatezip: '80304',
};
// store the results
const results = await z.get('GetSearchResults', params);
const homeDetails = results.response.results.result[0].links[0].homedetails[0];
console.log(homeDetails);
which prints out
https://www.zillow.com/homedetails/2512-...