import {fetch} from 'wix-fetch'; function parseRetsXml(xml) { const parser = new DOMParser(); const xmlDoc = parser.parseFromString(xml, "text/xml"); const retsNode = xmlDoc.getElementsByTagName("RETS")[0]; const replyCode = retsNode.getAttribute("ReplyCode"); const replyText = retsNode.getAttribute("ReplyText"); const loginUrl = retsNode.getAttribute("Login"); const searchUrl = retsNode.getAttribute("Search"); return { replyCode, replyText, loginUrl, searchUrl }; } async function searchMLS(xml, query) { const retsInfo = parseRetsXml(xml); const response = await fetch(retsInfo.searchUrl, { method: 'post', headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, body: `search=${encodeURIComponent(query)}` }); const results = await response.json(); return results; } const xml = ' Broker = MemberName = 79190-RETSIDX James T Morrison MetadataVersion = 8.09.00001 MinMetadataVersion = 8.09.00001 User = 547029,NULL,NULL,NULL Login = http://rets.hawaiiinformation.com:6103/rets/login Logout = http://rets.hawaiiinformation.com:6103/rets/logout Search = http://rets.hawaiiinformation.com:6103/rets/search GetMetadata = http://rets.hawaiiinformation.com:6103/rets/getMetadata GetObject = http://rets.hawaiiinformation.com:6103/rets/getObject Balance = 0.01 TimeoutSeconds = 1800 '; const query = 'property type:Residential'; searchMLS(xml, query).then(results => { console.log(results); });
top of page
11062b_bbf4118055a54ce2b43094153fd792dc~mv2.jpg

Big Island Blog

Explore the vibrant real estate market and breathtaking lifestyle of the Big Island of Hawaii through our informative blog. From luxury properties to local insights, we provide all the information you need to make your dream of living in paradise a reality

  • Facebook
  • Instagram
  • Yelp
bottom of page