Property Info using Google Apps Script and Melissa API

This is an example for all those interested in fetching Property data from Melissa API. I have only used this for US Addresses - not sure about other countries.

Please see https://www.melissa.com/developer/ for more info about what kinds of data you can fetch from the various API that they have. There is a free tier (1,000 free credits per month) and for most small apps, that should be enough.

In this example, we are fetching Year Built and Square Footage. XML_TO_JSON() is available here.

function getPropertyInfo(address)
 {
   var secret = 'YOUR MELISSA API SECRET';
 
   var BASEURL = 'https://property.melissadata.net/v4/WEB/LookupProperty';

   var options = {
     'method' : 'get',
     'headers' : {
       'Authorization': "Basic ",
       'content-type' : 'application/json'    
     },
     'payload' : JSON.stringify({
       "id": secret,
       "cols": "GrpPropertySize",
       "ff": address,      
     })
   }

  // Log readable JSON object
  Logger.log( 
     JSON.stringify(
       UrlFetchApp.getRequest(BASEURL+'?id='+secret+'&cols=GrpPropertySize&ff='+encodeURIComponent(address)),
       null, 2 ));

  var response = UrlFetchApp.fetch(BASEURL+'?id='+secret+'&cols=GrpPropertySize&ff='+encodeURIComponent(address));
  Logger.log("Response Code: "+response.getResponseCode())
  if (response.getResponseCode() == 200) {
    var params = XML_to_JSON(response.getContentText());
    if (params.TotalRecords = 1 && params.LookupPropertyResponse.Records.Record.PropertyUseInfo) { 
      return {data: {"yearbuilt": params.LookupPropertyResponse.Records.Record.PropertyUseInfo.YearBuilt.Text, "sqfeet": params.LookupPropertyResponse.Records.Record.PropertySize.AreaBuilding.Text}};
    } else {
      Logger.log("LookupProperty Failed.");
      Logger.log("Failure Codes =" + params.LookupPropertyResponse.Records.Record.Results.Text);
      return false;
    }
  } else {
    Logger.log("LookupProperty Failed ");
    return false;
  }  
 
}
5 Likes

Thank you, @Bellave_Jayaram! I have a few real estate clients who are going to love this!

Wow, Very interesting. Just added to my knowledge base :slight_smile: