如何使用JavaScript调用Zillow API? [英] How to call Zillow API with JavaScript?

查看:151
本文介绍了如何使用JavaScript调用Zillow API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是API的新手,正在尝试弄清楚如何使用JavaScript进行Zillow调用,特别是"getsearchresults". 谢谢

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

推荐答案

您将需要在使用Node的服务器端使用Javascript.无法使用Java脚本在前端调用API.请参阅这个答案.

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.

要使用Node调用Zillow API,请查看 node-zillow 包裹.这是一个如何与GetSearchResults API调用一起使用的示例:

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
    })

确保在此处注册ZWSID: https://www.zillow.com/webservice/Registration.htm .向API发出请求时,将使用此唯一ID.它看起来像这样:X2-Ijdjkxlujnkd_jske2.保密,安全!

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!

这篇关于如何使用JavaScript调用Zillow API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆