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
The Nelson’s Project

The Nelson’s Project

I'm a paragraph. Click here to add your own text and edit me. It’s easy. Just click “Edit Text” or double click me to add your own content and make changes to the font. 

20131 Grove Street

20131 Grove Street

I'm a paragraph. Click here to add your own text and edit me. It’s easy. Just click “Edit Text” or double click me to add your own content and make changes to the font. 

The Jefferson’s Lake House

The Jefferson’s Lake House

I'm a paragraph. Click here to add your own text and edit me. It’s easy. Just click “Edit Text” or double click me to add your own content and make changes to the font. 

  • Facebook
  • Instagram
  • Yelp
bottom of page