Skip to content
jhilden edited this page Sep 13, 2010 · 9 revisions

base url = http://app.talking-points.org

/locations/by_coordinates/lat;lng.format [?within=0.5&units=kms]

parameters:

  • latitude and longitude as floats (decimal point “.” needs to be replaced by a comma “,” to make the URL work for Rails
    separated by a semicolon “;”)
  • format: xml, json

[optional parameters:]

  • units: “kms” (if you want kilometers instead of the default units, which is miles)
  • within: number (the radius in within to search, default = 1)

returns:

a hash of the locations within 1 mile radius. with the following info for each location:
tpid
lng
lat
distance from the specified coordinates
bluetooth_mac

example:

GET http://app.talking-points.org/locations/by_coordinates/42,291930;-83,715724.xml

RESPONSE


<hash>
<location-2>
<tpid type="integer">2</tpid>
<lng>-83.736012</lng>
<bluetooth-mac nil="true"/>
<lat>42.275309</lat>
<distance type="float">27.1182779194122</distance>
</location-2>

...

</hash>

/locations/id/get_nearby.format [?within=0.5&units=kms]

parameters:

  • id (tpid, bluetooth_mac)
  • format: xml, json

[optional parameters:]

  • units: “kms” (if you want kilometers instead of the default units, which is miles)
  • within: number (the radius in within to search, default = 1)

returns:

a hash of the locations within 1 mile radius. with the following info for each location:
tpid
lng
lat
distance from the give location
bluetooth_mac

example:

GET http://app.talking-points.org/locations/1/get_nearby.xml

or

GET http://app.talking-points.org/locations/00194fa4e272/get_nearby.xml

RESPONSE


<records type="array">
  <record>
    <name>Test location</name>
    <tpid type="integer">4</tpid>
    <lng>23.0000</lng>
    <bluetooth-mac>0007809437a2</bluetooth-mac>
    <lat>-12.0000</lat>
    <distance type="float">0.0</distance>
  </record>
</records>
...

/locations/get_address/lat;lng

parameters:

latitude and longitude as floats
decimal point “.” needs to be replaced by a comma “,” to make the URL work for Rails
separated by a semicolon “;”
there are no formats such as (xml, json) the return value is just a string

returns:

tries to find an address for the current coordinates. if it finds an address it is returned as a string, if not it returns “error”

example:

GET http://test.talking-points.org/locations/get_address/42,282736;-83,747134

RESPONSE

200-224 N 4th Ave, Ann Arbor, MI 48104, USA 

/locations/tpid.format

parameters:

tpid (Talking-Points database ID) of the location
formats: .xml, .json

returns:

a hash with all the information about this location

example:

GET http://app.talking-points.org/locations/1.xml

RESPONSE


<hash>
<city>Ann Arbor</city>
<name>Espresso Royale</name>
<status>Currently open for another 4 hours until 11pm</status>
<updated-at>2009-04-08 11:14:25 -0400</updated-at>
<postal-code>48104</postal-code>
<tpid type="integer">1</tpid>
<hide type="boolean">false</hide>
<sections>
	<Accessibility>beware of the steps going to the basement</Accessibility>
	<Hours>
	Mon through Fri from 6 am to 10 pm
	Saturday and Sunday from 7 am to 10 pm
	</Hours>
	<Comments>
		<comment-2>
			<datetime-in-words>27 days ago</datetime-in-words>
			<text>
			All the Espresso Royale cafes are pretty nice. For a chain, they try to make each location unique and not too corporate looking.
			</text>
			<title>Comment 1</title>
			<username>tichou</username>
			<id type="integer">2</id>
			<user-id type="integer">3</user-id>
			<datetime>2009-03-16 21:17:34 -0400</datetime>
		</comment-2>
....

/locations/show_by_bluetooth_mac/bluetooth_mac.format

parameters:

bluetooth_mac of the location with no colons inbetween the character pairs (e.g. “00:19:4f:a4:e2:72” becomes “00194fa4e272”)
format: .xml, .json

returns:

A hash with all the information about the location with the passed in bluetooth_mac or a 404 status code if no location can be found.

example:

GET http://app.talking-points.org/locations/show_by_bluetooth_mac/00194fa4e272.xml

RESPONSE


<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <city>Ann Arbor</city>
  <name>Espresso Royale</name>
  <created-at type="datetime">2010-02-06T10:05:48-05:00</created-at>
  <hide type="boolean">false</hide>
  <country nil="true"></country>
  <updated-at type="datetime">2010-02-06T10:05:48-05:00</updated-at>

  <postal-code>48104</postal-code>
  <tpid type="integer">3</tpid>
  <url>http://www.espressoroyale.com/location.php?id=20</url>
  <sections>
    <section-2>
      <name>test</name>
      <text>test</text>

    </section-2>
    <comments>
      <comment-2>
        <title>test</title>
        <text>test</text>
        <username>jhilden</username>
        <id type="integer">2</id>

        <user-id type="integer">5</user-id>
        <datetime type="datetime">2010-02-06T10:10:47-05:00</datetime>
        <datetime-in-words>less than a minute ago</datetime-in-words>
      </comment-2>
    </comments>
  </sections>
  <street>1101 S. University St.</street>

  <lng>-83.735580</lng>
  <location-type>Coffee shop</location-type>
  <phone>734.327.0740</phone>
  <bluetooth-mac>00194fa4e272</bluetooth-mac>
  <description>Free wi-fi. Inside there are several distinct seating areas to chat and study. 
$2 latte special for any size latte on Wednesday.</description>
  <lat>42.275082</lat>

  <wifi-mac nil="true"></wifi-mac>
  <status>Currently open for another 4 hours until 11pm</status>
  <state>MI</state>
</hash>