TruliaStats Library

The TruliaStats library provides statistics about locations based on Trulia's data. Documentation for these calls can be found in the TruliaStats sub-items on the right.

Notes about TruliaStats:

  • Currently, there are two available types of statistics: traffic and listings. You may specify one or the other using the statType parameter to receive a lighter XML response, or receive both by omitting the statType parameter.
  • Traffic statistics about a location currently include the percentage of that location's city/national/state traffic where applicable. For example, a city's traffic numbers will give both its percentage of state and national traffic, while a neighborhood's traffic numbers will include both of these plus a city percentage as well.
  • Traffic statistics are available per day from 2007-06-01 to the present.
  • Listings statistics about a location currently include average price data, both as an aggregate and and subdivided by number of bedrooms.
  • Listings statistics are available per week from 2007-11-10 to the present with the exception of median listing price stats, for which the earliest possible date has a weekEndingDate of 2007-01-05. The API will return any week which has a day within the date range specified in the call.

Functions

Function Name Action
getCityStats Retrieves statistics about a city
getCountyStats Retrieves statistics about a county
getNeighborhoodStats Retrieves statistics about a neighborhood
getStateStats Retrieves statistics about a state
getZipCodeStats Retrieves statistics about a ZIP code

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>
         </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>