r - 如何在 ZillowR 中使用 zillow api

标签 r api zillow

我要访问 GetDeepSearchResults来自 Zillow API 的信息。

我的代码:

library(ZillowR)
zapi_key = getOption('Myapikey')
GetDeepSearchResults(
    address = '600 S. Quail Ct.',
    zipcode = '67114',
    rentzestimate = FALSE,
    api_key = zapi_key
)

错误:
Error in GetDeepSearchResults(address = "600 S. Quail Ct.", zipcode = "67114",  : 
  unused arguments (zipcode = "67114", api_key = zapi_key)

为什么会出现这个错误?我能做些什么来解决这个问题?

编辑:我根据评论更改了代码并得到了这个:

我的代码:
library(ZillowR)
zapi_key = getOption('myapikey')
GetDeepSearchResults(
    address = '600 S. Quail Ct.',
    citystatezip = '67114',
    rentzestimate = FALSE,
    zws_id = 'myapikey',
    url = "http://www.zillow.com/webservice/GetDeepSearchResults.htm"
)

输出:
$request
$request$address
NULL

$request$citystatezip
NULL

$message
$message$text
[1] "Error: invalid or missing ZWSID parameter"

$message$code
[1] "2"

$response
NULL

我怎样才能解决这个问题?

最佳答案

当您传递不是函数的一部分的参数时,未使用的参数错误是典型的。所以 R 不知道如何处理这些并返回错误。您可以查看 documentation使用 ?GetDeepSearchResults 的函数

这向您展示了用法:

GetDeepSearchResults(address = NULL, citystatezip = NULL,
  rentzestimate = FALSE, zws_id = getOption("ZillowR-zws_id"),
  url = "http://www.zillow.com/webservice/GetDeepSearchResults.htm")


要完成这项工作,您必须首先设置您的 ID(您可以在 https://www.zillow.com/howto/api/APIOverview.htm 上创建一个 ID):
set_zillow_web_service_id("youractualkey")

所以你的函数没有参数 zipcodeapi_key .让我们将您的论点更改为存在的一些论点:
    GetDeepSearchResults(address='600 S. Quail Ct.', citystatezip ='67114',
                         rentzestimate=FALSE)

你肯定认得我没用你的api_key .这是因为默认值:zws_id = getOption("ZillowR-zws_id")调用您的全局'ZillowR-zws_id'您刚刚设置的 set_zillow_web_service_id()命令。所以没有必要改变默认值。但是当你使用 zws_id ="youractualkey" 时你可以跳过这个来自 zillow

我创建了一个随机帐户以进行验证。这给了我输出:
$request
$request$address
NULL

$request$citystatezip
NULL


$message
$message$text
[1] "Error: this account is not authorized to execute this API call"

$message$code
[1] "6"


$response
NULL

所以我可以成功联系服务器并且我的 key 被识别。账户权限与R无关,必须在网站上设置。

关于r - 如何在 ZillowR 中使用 zillow api,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56894321/

相关文章:

r - data.table - 也基于名称为列的变量进行子集化

从R中的CSV文件读取数字,数据文件中存在NaN

r - 循环遍历列表中的序列对象?

Laravel Passport 密码授予 token : own mobile app

php - Laravel 5.3 在 API 中过滤搜索数据

r - 带有 R 的 zillow api - XML 问题

r - 如何 reshape 数据帧并将其转换为 dgCMatrix?

python - 从json中提取某些数据

xml - 如何使用 zillow.com API 将数据发送到 API 调用并将其取回

xml - Zillow API 一般搜索