• GoDaddy Community
  • VPS & Dedicated Servers
  • VPS & Dedicated Servers

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    Integrating Zillow API

    Hello,

    I'm building a C# ASP.NET application on my site to create a RESTful API call to Zillow.com and I will GET data from that site then display it on my site. I am able to make the call and receive the data just fine on my Local computer, but when I deploy the code to my GoDaddy page it doesn't work. This is my first time building a site so I'm sure this is an easy issue, but is there something that I need to reconfigure for these calls to begin working?

     

    Thanks!

    6 REPLIES 6
    Moderator
    Moderator

    Re: Integrating Zillow API

    Hey @wtnelso,

     

    Welcome to the community! Smiley Happy

     

    So our more knowledgeable members who might be familiar with the type of API you're trying to integrate into your first site can offer some suggestions, can you provide a sample of the scripting you're trying to use that works within your home environment?

     

    It might also help to know what specific type of hosting plan you're then trying to utilize this code in? You mentioned ASP.NET, so I assume you're on a Windows based plan? 

     

    CG - GoDaddy | Community Moderator
    24/7 support available at x.co/247support

    Re: Integrating Zillow API

    Hi, thanks for your response.

    My plan is the Hosting - Web - Economy - Windows Plesk.

    I'm making an AJAX jQuery call to a C# WebMethod:

     

    [WebMethod]
    public static string GetZillowData()
    {
    const string zwsid = "password";
    //url goes here. For some reason it won't let me save if I put that line in.
    ZillowHomeData zhd = new ZillowHomeData();
    try
    {
    // Make the HTTP request / get the response
    HttpWebRequest Request = (System.Net.HttpWebRequest)HttpWebRequest.Create(url);
    HttpWebResponse Response = (HttpWebResponse)Request.GetResponse();

    // Parse the HTTP response into an XML document
    XmlDocument xml = new XmlDocument();
    xml.Load(Response.GetResponseStream());
    XmlElement root = xml.DocumentElement;

    // Get today's rates via XPath
    XmlNode xmlNode = root.SelectSingleNode("//response/results/result/address/street");
    zhd.Street = xmlNode.InnerText;
    xmlNode = root.SelectSingleNode("//response/results/result/address/city");
    zhd.City = xmlNode.InnerText;
    xmlNode = root.SelectSingleNode("//response/results/result/address/state");
    zhd.State = xmlNode.InnerText;
    xmlNode = root.SelectSingleNode("//response/results/result/address/zipcode");
    zhd.ZipCode = xmlNode.InnerText;

    Response.Close();
    }
    catch (Exception ex)
    {
    }
    return JsonConvert.SerializeObject(zhd);
    }

     

    Like I said, it works great from my local but doesn't from my URL. I'm not sure if it is a security setting or a Zillow related issue.


    Thanks!

    Employee
    Employee

    Re: Integrating Zillow API

    @wtnelso - any chance you can write log the exception?  As it stands I'd guess you're just getting an empty result set back when you serialize zhd.  You have options on how to log this which is entirely up to you.  A couple options are logging this to some log file on the hosting account or return the error back to the client when you serialize.

     

    With that I'm sure there will be some others that could help figure things out.


    Thanks
    Jake

    Re: Integrating Zillow API

    Hey @Jake,

     

    I've written this code to write the log:

    public static string errLocation = "/Common/Logs/error";
    
    public void ErrorLog(string sPathName, string sErrMsg)
            {
                string sLogFormat = DateTime.Now.ToShortDateString().ToString();
                string sYear = DateTime.Now.Year.ToString();
                string sMonth = DateTime.Now.Month.ToString();
                string sDay = DateTime.Now.Date.ToString();
                string sErrorTime = sYear + sMonth + sDay;
                string path = HostingEnvironment.MapPath(sPathName);
                StreamWriter outputFile = new StreamWriter(path);
                outputFile.WriteLine(sLogFormat + sErrMsg);
                outputFile.Flush();
                outputFile.Close();
            }

    The Common folder is one level below the httpdocs folder, but no log is being created.

     

    Any idea how to get these logs to work?

    Re: Integrating Zillow API

    Hi, I'm getting some more response info. I'm getting a AJAX fail response of "Internal Server Error". My AJAX jQuery POST function works fine locally, but on the server it doesn't seem to like this. Is it a server configuration issue?

    Community Manager
    Community Manager

    Re: Integrating Zillow API

    Hi @wtnelso. To clarify, are you seeing a 500 error on the site or just in your error log? If you're getting an error on the site, disabling custom errors to allow the error details to come through might help you identify exactly what the problem is. This article explains how to do that.

     

    JesseW - GoDaddy | Community Manager | 24/7 support available at x.co/247support | Remember to choose a solution and give kudos.