TruliaStats.getCityStats

Description

Retrieves all statistics for a city within the given date range. General information about Trulia stats can be found at the TruliaStats library page.

Function Parameters

Parameter Description Required Format
apikey Your TruliaAPI key Yes
city The city for which you wish to receive statistics. Yes
state The state which contains the above county Yes 2-letter postal code
startDate The first date for which you wish to receive statistics. No (Defaults to last valid day) YYYY-MM-DD
endDate The last date for which you wish to receive statistics. No (Defaults to last valid day) YYYY-MM-DD
statType The type of statistic you wish to receive. No (Defaults to "all") Valid types: {"all", "traffic", "listings"}

Sample Call

http://api.trulia.com/webservices.php?library=TruliaStats&function=getCityStats
&city=New York&state=NY&startDate=2007-02-06&endDate=2007-02-07&apikey=abc123

Sample Return (Truncated for clarity)

<TruliaWebServices>
   <request>
      <Parameter>
         <index>1</index>
         <name>library</name>
         <value>TruliaStats</value>
      </Parameter>
      <Parameter>
         <index>2</index>
         <name>function</name>
         <value>getCityStats</value>
      </Parameter>
      <Parameter>
         <index>3</index>
         <name>city</name>
         <value>New York</value>
      </Parameter>
      <Parameter>
         <index>4</index>
         <name>state</name>
         <value>NY</value>
      </Parameter>
      <Parameter>
         <index>5</index>
         <name>startDate</name>
         <value>2007-02-06</value>
      </Parameter>
      <Parameter>
         <index>6</index>
         <name>endDate</name>
         <value>2007-02-07</value>
      </Parameter>
      <Parameter>
         <index>7</index>
         <name>apikey</name>
         <value>abc123</value>
      </Parameter>
   </request>
   <response>
      <TruliaStats>  
         <location>
            <city>New York</city>
            <state>NY</state>
            <searchResultsURL>  
                  http://www.trulia.com/NY/New_York/  
            </searchResultsURL>
            <cityGuideURL>  
                  http://www.trulia.com/real_estate/New_York-New_York/  
            </cityGuideURL>
            <heatMapURL>  
                  http://www.trulia.com/home_prices/New_York/New_York-heat_map/  
            </heatMapURL>
         </location>
         <trafficStats>
            <trafficStat>
               <date>2007-02-06</date>
               <percentStateTraffic>11.56172407207</percentStateTraffic>
               <percentNationalTraffic>0.86764579411568</percentNationalTraffic>
            </trafficStat>
            <trafficStat>
               <date>2007-02-07</date>
               <percentStateTraffic>12.330054507863</percentStateTraffic>
               <percentNationalTraffic>0.93573479906427</percentNationalTraffic>
            </trafficStat>
         </trafficStats>
         <listingStats>
            <listingsStat>
               <weekEndingDate>2007-02-10</weekEndingDate>
               <avgListingValue>
                  <subcategory>
                     <type>All Properties</type>
                     <averageListingPrice>1707962</averageListingPrice>
                     <numberOfProperties>2921</numberOfProperties>
                  </subcategory>
                  <subcategory>
                     <type>1 Bedroom Properties</type>
                     <averageListingPrice>730219</averageListingPrice>
                     <numberOfProperties>1095</numberOfProperties>
                  </subcategory>
                  <subcategory>
                     <type>2 Bedroom Properties</type>
                     <averageListingPrice>1453855</averageListingPrice>
                     <numberOfProperties>807</numberOfProperties>
                  </subcategory>
                  ...
               </avgListingValue>
            </listingsStat>
         </listingStats>
      </TruliaStats>
   </response>
</TruliaWebServices>