How to call Zillow API with JavaScript? [closed]

2019-08-17 05:59发布

I'm new to APIs and am trying to figure out how to make a Zillow call with JavaScript, specifically the "getsearchresults". Thanks

1条回答
乱世女痞
2楼-- · 2019-08-17 06:30

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!

查看更多
登录 后发表回答