Best Practices: Photo downloads
The below outlines some of the best practices for retrieving real estate listing photos from the flexmls RETS server.
Hot-link our photos whenever able.
Our RETS server supports the Location=1 parameter through GetObject which means that, rather than you downloading and maintaining the entire collection of listing photos on your servers, you can instead simply get back the URL to our hosted versions of the photos and link to them directly from your application. Instead of maintaining many GBs worth of images, you'd instead manage a list of photo URLs per listing. The photo URLs given back point to a distributed CDN for fast delivery to your end users.
Be aware of which RETS version you're using and how querying by timestamps work in that version.
When using RETS version 1.5, the timestamps you supply in your queries are assumed to be in GMT. When using RETS version 1.7.2, the timestamps you supply can contain additional timezone offset information; however, if that timezone offset information is missing (making the timestamp look identical to the format used in RETS 1.5), the timestamp is assumed to be in server local time. For more information on how timezones work, see this write-up along with the examples.
Use RETS 1.7.2 if able
Related to the above, being able to specify the desired timezone makes things much clearer. If your process expects to send timestamps in GMT, simply add a "Z" to the end to tell the server that this is a GMT timestamp. For example: (LIST_134=2013-03-01T12:31:00Z+)
Detect which listings to re-retrieve photos for based on the photo modification timestamp field -- not the data modification timestamp field.
On the flexmls RETS server, the photo modification timestamp field is LIST_134. If you're detecting changed photos by looking at LIST_87 (the data modification timestamp field), you're downloading more photos than needed.
Query based on the highest timestamp you've previously seen
In order to pull photos for only those listings which have had recent photo changes, you'll need to track a timestamp to use for your incremental queries. Track this query based upon the highest LIST_134 timestamp seen during your previous processes. This allows your process to better withstand failures which could ultimately result is missed photo updates. Remember that the timestamps returned by the server are in server local time (typically Central time from the flexmls RETS server).
Choose the appropriate photo size for your use.
- HiRes (1024x768 pixels or less. Only available by URL - See this tutorial)
- 640x480 (640x480 pixels or less. Only available by URL - See this tutorial)
- Photo (300x225 pixels or less)
- Thumbnail (65x42 pixels or less)
Select the size that best meets your needs and resize down if necessary. This goes into your request as the Type parameter.
If you only need the primary photo, request ":0"
If you're only interested in getting the main photo for a listing, making a request like the one below will only give back the photo marked as the primary. flexmls Web allows for any photo to be marked as primary so this may not be the same as the 1st photo in the list.
http://retsgw.flexmls.com/rets2_3/GetObject?Resource=Property&Type=HiRes&ID=352918:0&Location=1