6

I want to access the GetDeepSearchResults info from the Zillow API.

My code:

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

Error:

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

Why does this error occur? What can I do to fix this?


Edit: I changed the code according to the comments and got this:

My code:

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

Output:

$request
$request$address
NULL

$request$citystatezip
NULL

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

$message$code
[1] "2"

$response
NULL

How can I fix this?

Lypyrhythm
  • 324
  • 2
  • 13
  • 1
    According to the [documentation](https://www.rdocumentation.org/packages/ZillowR/versions/0.1.0/topics/GetDeepSearchResults) `GetDeepSearchResults` accepts only the following arguments: `address`, `citystatezip`, `rentzestimate`, `zws_id` and `url` – markus Jul 04 '19 at 21:34
  • Hi Markus, I changed my code but I still get an error: –  Jul 04 '19 at 21:42

1 Answers1

2

The unused arguments error is typical when you pass arguments, which are not parts of the function. So R doesn't know what to do with those and returns the error. You can check the documentation of the function with ?GetDeepSearchResults

This shows you the usage:

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

To have this work, you have to set your id first with (you can create an id on https://www.zillow.com/howto/api/APIOverview.htm):

set_zillow_web_service_id("youractualkey")

So you function does not have the argument zipcode and api_key. Let's change your arguments to some which exist:

    GetDeepSearchResults(address='600 S. Quail Ct.', citystatezip ='67114',
                         rentzestimate=FALSE)

You surely recognized I did not use your api_key. This is because the default:zws_id = getOption("ZillowR-zws_id") calls your global 'ZillowR-zws_id' which you just set with the set_zillow_web_service_id() command. So it's not necessary to change the default value. But you can skip this when you use zws_id ="youractualkey" from zillow

I made a random account I set up for validating. This gives me the output:

$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

So I could successfully contact the server and my key was recognized. The account authority is not R related and has to be set on the website.

mischva11
  • 2,811
  • 3
  • 18
  • 34
  • Hi @mischva11 I was able to get the output with your above suggestion and the format of the output is: 33024 1726 3.0 4 . However, I want to write.csv this. when I do the same the error i get is Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) : cannot coerce class ‘c("XMLNode", "RXMLAbstractNode", "XMLAbstractNode", "oldClass"’ to a data.frame In addition: There were 33 warnings (use warnings() to see them) –  Jul 04 '19 at 23:05
  • @bababoo i can't reproduce this, since i can't load data at the moment. I can't change my authoritys, the website is down. Try `data.frame(unlist(data))`. (data is your object) Your error message is pretty clear, you have something, which can't be transformed to a dataframe. In most cases you can extract the values with something like `data$xxx` or data[[1]]. Try to extract your data from the class and then save it as dataframe – mischva11 Jul 04 '19 at 23:16