LocationInfo.getCitiesInState

Description

Retrieves all cities in a state, as well as the longitude and latitude of the center point of each city.

Function Parameters

Parameter Description Required Format
apikey Your TruliaAPI key Yes
state The state you wish to find cities in. Yes 2-letter postal code

Sample Call

http://api.trulia.com/webservices.php?library=LocationInfo&function=getCitiesInState
&state=CA&apikey=abc123

Sample Return (Truncated for clarity)

<TruliaWebServices>
  <request>
    <Parameter>
      <index>1</index>
      <name>library</name>
      <value>LocationInfo</value>
    </Parameter>
    <Parameter>
      <index>2</index>
      <name>function</name>
      <value>getCitiesInState</value>
    </Parameter>
    <Parameter>
      <index>3</index>
      <name>state</name>
      <value>CA</value>
    </Parameter>
    <Parameter>
      <index>4</index>
      <name>apikey</name>
      <value>abc123</value>
    </Parameter>
  </request>
  <response>
    <LocationInfo>
      <state>CA</state>
      <city>
        <id>00212</id>
        <name>Acton</name>
        <longitude>123.456</longitude>
        <latitude>123.456</latitude>
      </city>
      <city>
        <id>00696</id>
        <name>Adelanto</name>
        <longitude>123.456</longitude>
        <latitude>123.456</latitude>
      </city>
      ...       
    </LocationInfo>
  </response>
</TruliaWebServices>