1

Im using axios, if that matters. Im using using GetSearchResults.htm? api

The api works, I get all the xml data. I am having issues accessing specific data from Zillows api, everything I tried is coming back undefined.

Part of the axios get I am using to retrieve the data

  .then(function(res){
      console.log(res.data)
    })

The results come like below.... I would for example want to access request.address I have tried

res.data.request['address']
res.data.request.address
res.data.searchresults.request['address']
res.data.searchresults.request.address


    <?xml version="1.0" encoding="utf-8"?>
  <SearchResults:searchresults cut to format">
    <request>
        <address>Some address here</address>
        <citystatezip>some city here, ca</citystatezip>
    </request>
    <message>
        <text>Request successfully processed</text>
        <code>0</code>
    </message>
    <response>
        <results>
            <result>
                <zpid>some zipid here</zpid>
born2gamble
  • 197
  • 7
  • 17
  • 1
    I think [this thread](https://stackoverflow.com/questions/49517891/how-to-call-zillow-api-with-javascript) and/or [this thread](https://stackoverflow.com/questions/1090659/how-to-send-data-to-an-api-call-and-get-it-back-using-zillow-com-api) will point you in the right direction. [This node module](https://www.npmjs.com/package/node-zillow) may prove helpful otherwise you likely want some way to convert xml to json – uncleoptimus Apr 13 '18 at 01:20
  • How were you able to integrate the zillow api on the frontend using javascript ? Don't you need some kind of a server ? – Max Doung Jul 22 '18 at 04:00
  • @MaxDoung Yes I did. No server needed, it’s just an Ajax request. I happened to use axios, but you can use fetch as well. I’ll dig up the code in the morning and edit this post if you would like – born2gamble Jul 23 '18 at 08:54
  • @born2gamble I would really appreciate it if you can provide an example. Somehow I keep getting same origin error. I'm using axios as well – Max Doung Jul 24 '18 at 22:25
  • @MaxDoung I’m sorry I thought I had it implemented but I don’t. I am also getting same origin issues. ( although you can get a cors extension on chrome to make it work locally) I tried to mess around with it for about an hour and couldn’t get past that cors issue for production. Bothering me to the point I’ll be YouTubing this stuff , I’ll update here when I figure this out . – born2gamble Jul 25 '18 at 06:35

0 Answers0