├── LICENSE ├── README.md ├── interactive-map-search └── index.html ├── javascript ├── README.md ├── ajax.js └── index.html ├── php ├── README.md └── simplyrets-example.php └── ruby ├── README.md └── example.rb /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2015 SimplyRETS, Inc. https://simplyrets.com 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SimplyRETS API Examples 2 | 3 | A collection of examples showcasing usage of the SimplyRETS API. 4 | SimplyRETS makes it easy to **build software using data from your 5 | MLS** or REALTORS association by normalizing any **RETS**, **IDX**, 6 | or **RESO WebAPI** feed into a [standardized JSON API made for real estate](https://docs.simplyrets.com). 7 | 8 | _NOTE: Looking for something plug-and-play? Check out the 9 | [SimplyRETS WordPress plugin](https://wordpress.org/plugins/simply-rets/)_ 10 | 11 | ## Getting Started 12 | 13 | The SimplyRETS API makes it easy to access your MLS's listing data from 14 | with any programming language. Below you'll find examples for getting started 15 | with some of the most common languages - if you don't see what you're looking 16 | for, [send us a message](https://simplyrets.com/#home-contact) and we'll be 17 | happy to help get you going. 18 | 19 | - [PHP](php/) 20 | - [Ruby](ruby/) 21 | - [JavaScript (ajax)](javascript/) 22 | - [JavaScript (ajax) - interactive map search](interactive-map-search/) 23 | 24 | ## Interactive map search 25 | 26 | The [interactive-map-search](interactive-map-search/) directory contains an 27 | example program for building a map-based search tool using Ajax, Leaflet, 28 | and OpenStreetMap. The test data is located in Houston. 29 | 30 | To run this example, download [`interactive-map-search/index.html`](interactive-map-search/index.html) 31 | and open it in your browser, or [visit the live version here](https://simplyrets.github.io/examples/interactive-map-search) 32 | 33 | ## More resources 34 | 35 | The SimplyRETS API can be accessed from and tool or language that can 36 | make HTTP requests. Use the examples in this repo to get started, or 37 | check out some of the other resources and documentation: 38 | 39 | - [API documentation and help topics](https://docs.simplyrets.com) 40 | - [Interactive API documentation](https://docs.simplyrets.com/api/index.html) 41 | - [Code snippets](https://simplyrets.com/#curl) 42 | -------------------------------------------------------------------------------- /interactive-map-search/index.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |" + res[i].address.full + "
"); 25 | } 26 | } 27 | }); 28 | } 29 | 30 | main(); 31 | -------------------------------------------------------------------------------- /javascript/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |List price: " . $json_response[0]->listPrice . "
"; 36 | 37 | ?> 38 | -------------------------------------------------------------------------------- /ruby/README.md: -------------------------------------------------------------------------------- 1 | example.rb 2 | ========== 3 | 4 | See the comments in example.rb for a walk-through. 5 | 6 | ## Running 7 | 8 | $ ruby example.rb 9 | 10 | -- 11 | SimplyRETS, Inc - Copyright (c) 2015 12 | support@simplyrets.com - https://simplyrets.com 13 | -------------------------------------------------------------------------------- /ruby/example.rb: -------------------------------------------------------------------------------- 1 | # example.rb - Accessing the SimplyRETS API via Ruby 2 | # SimplyRETS, Inc - Copyright (c) 2015 3 | 4 | require "net/http" 5 | require "uri" 6 | require "json" 7 | 8 | ## Define our API Endpoint and settings. Since the API is 9 | ## over HTTPS we set use_ssl to true. 10 | 11 | uri = URI.parse("https://api.simplyrets.com/properties") 12 | http = Net::HTTP.new(uri.host, uri.port) 13 | http.use_ssl = true 14 | 15 | ## Make the request. The API uses Basic Authorization for authentication with 16 | ## the API. Put your API Key/Secret there. 17 | 18 | request = Net::HTTP::Get.new(uri.request_uri) 19 | request.basic_auth("simplyrets", "simplyrets") 20 | response = http.request(request) 21 | 22 | ## The response body, which contains the listings, is not held in response.body. 23 | ## We parse the JSON response into `listings`. Then we iterate over each listing 24 | ## to get the information we need. 25 | 26 | listings = JSON.parse(response.body) 27 | 28 | listings.each do |listing| 29 | puts listing['address']['full'] 30 | end 31 | --------------------------------------------------------------------------------