LemonFree API 2.0 Documentation - Locations Feed

Last Updated: January 21, 2014

Overview

The Locations feed provides access to locations (city/state) of listings currently available on LemonFree

Base URL

http://api.lemonfree.com/v2/locations

Parameters

Parameter Type Occurrence Description
key string required Your API key
format Result Format optional Sets the format of the result.
If format is not specified the default format is xml.
make | make_id string | int required A specific make (or ID) that has been obtained by the makes feed.
Only make or make_id must be set. If both are specified an error will be returned.
model | model_id string | int required A specific model (or ID) that has been obtained by the models feed.
If used, make (or make_id) must also be specified.
Only model or model_id must be set. If both are specified an error will be returned.
trim | trim_id string | int optional A specific trim (or ID) that has been obtained by the trims feed.
If used, make (or make_id) and model (or model_id) must also be specified.
Only trim or trim_id must be set. If both are specified an error will be returned.
price_min Price optional Limits the results to a price range; price_min specifies the lower end of this range.
If used, price_max must also be specified, and be greater than or equal to price_min.
price_max Price optional Limits the results to a price range; price_max specifies the upper end of this range.
If used, price_min must also be specified, and be less than or equal to price_max.
year_from Year optional Limits the results to a year range; year_from specifies the lower end of this range.
If used, year_to must also be specified, and be greater than or equal to year_from.
year_to Year optional Limits the results to a year range; year_to specifies the upper end of this range.
If used, year_from must also be specified, and be less than or equal to year_to.
state State optional Limits the results to the specified state/province.
sort_by Sort optional Sorts the results by the specified value.
If sort_by is not specified the default sort order is by city name.

Query Result Fields

Field Description
state The name of the state / province associated with this location
state_abbreviation The two letter abbreviation of the state / province associated with this location
city The name of the city associated with this location
listing_count The number of listings associated with this location

Sample Results

XML

<?xml version="1.0" encoding="UTF-8"?>
<response xmlns:lf="http://api.lemonfree.com/ns/1.0">
    <lf:request_type>locations</lf:request_type>
    <lf:request_params>
        <lf:attr name="feed">locations</lf:attr>
        <lf:attr name="key">[YOUR API KEY]</lf:attr>
    </lf:request_params>
    <lf:response_code>0</lf:response_code>
    <lf:result>
        <lf:item>
            <lf:attr name="state">Louisiana</lf:attr>
            <lf:attr name="state_abbreviation">LA</lf:attr>
            <lf:attr name="city">Abbeville</lf:attr>
            <lf:attr name="listing_count">61</lf:attr>
        </lf:item>
        <lf:item>
            <lf:attr name="state">Texas</lf:attr>
            <lf:attr name="state_abbreviation">TX</lf:attr>
            <lf:attr name="city">Abilene</lf:attr>
            <lf:attr name="listing_count">29</lf:attr>
        </lf:item>
        <lf:item>
            <lf:attr name="state">Massachusetts</lf:attr>
            <lf:attr name="state_abbreviation">MA</lf:attr>
            <lf:attr name="city">Boston</lf:attr>
            <lf:attr name="listing_count">696</lf:attr>
        </lf:item>
    </lf:result>
</response>    

JSON

{
    "response":{
        "request_type":"locations",
        "request_params":{
            "feed":"locations",
            "format":"json",
            "key":"[YOUR API KEY]"
        },
        "response_code":"0",
        "result":[
            {
                "state":"Louisiana",
                "state_abbreviation":"LA",
                "city":"Abbeville",
                "listing_count":"61"
            },
            {
                "state":"Texas",
                "state_abbreviation":"TX",
                "city":"Abilene",
                "listing_count":"29"
            },
            {
                "state":"Massachusetts",
                "state_abbreviation":"MA",
                "city":"Boston",
                "listing_count":"696"
            }
        ]
    }
}    

Examples

Query LemonFree API URL to use
All locations http://api.lemonfree.com/v2/locations/?key=[YOUR API KEY]
All locations sorted by listing count http://api.lemonfree.com/v2/locations/?sort_by=count&key=[YOUR API KEY]
All locations associated with Toyota listings http://api.lemonfree.com/v2/locations/?make=Toyota&key=[YOUR API KEY]
All locations associated with all 2004-2005 Hyundai listings http://api.lemonfree.com/v2/locations/?make=Hyundai&model=Accent&year_from=2004&year_to=2005&key=[YOUR API KEY]
All locations associated with 2000-2010 Ford Escort SE listings http://api.lemonfree.com/v2/locations/?make=Ford&model=Escort&trim=SE&year_from=2000&year_to=2010&key=[YOUR API KEY]
All locations associated with Pontiac listings in Oregon that are under $20000 http://api.lemonfree.com/v2/locations/?make=Pontiac&state=OR&price_min=0&price_max=20000&key=[YOUR API KEY]