safe2pee api (JSON output) v1.0 updated 6/13/09. All queries to retreive data do not require an api key, if you want to add listings you can email us for one and use it in your apps! info at safe2pee dot org USAGE TERMS: Not for profit, please credit safe2pee. If you will be querying at a super high volume let us know so we can figure something out! All data has been supplied by users, we cannot confirm the validity of supplied information.

citylist.php (e.g. city=lansing&state=mi)

returns listing of bathrooms by city/state, province

sample output

{ "status":"success", "city":"kansas city", "state":"mo", "tally":"2", "bathrooms": [ { "bid":"MTQ4MyBTMlA=", "name": "Hall\'s", "lat":"39.041428", "long":"-94.589769", "street":"211 Nichols Rd.", "city":"Kansas City", "state":"MO", "postal":"64112-1524", "gendered":"1", "accessible":"0", "availability":"1", "directions":"Basement level.", "comment":"The most finely appointed department store toilets I have ever seen." }, { "bid":"MTQ2OCBTMlA=", "name": "Commerce Arcade", "lat":"39.102183", "long":"-94.582075", "street":"1000 Walnut", "city":"Kansas City", "state":"MO", "postal":"64106-2107", "gendered":"0", "accessible":"0", "availability":"1", "directions":"2nd floor to the left of the escalator.", "comment":"Open business hours." } ] }

proxlist.php (location=castro+at+market+san+francisco%2Cca&distance=2&access=1)

find bathrooms nearby

sample output

{ "status":"success", "location":"37.762640,-122.435159", "radius":"1", "tally":"45", "bathrooms": [ { "bid":"MTIgUzJQ", "name": "Mission Creek Cafe", "lat":"37.757358", "long":"-122.421330", "dist":"0.839", "street":"968 Valencia Street", "city":"San Francisco", "state":"CA", "postal":"94110-2322", "gendered":"0", "accessible":"0", "availability":"0", "directions":"Head straight back. behind a divider.", "comment":"no key" }, { "bid":"MTYgUzJQ", "name": "Coffee To The People", "lat":"37.770064", "long":"-122.445174", "dist":"0.75", "street":"1206 Masonic St", "city":"San Francisco", "state":"CA", "postal":"94117-2917", "gendered":"0", "accessible":"1", "availability":"0", "directions":"towards the rear of the coffee shop.", "comment":"usually clean" } ] }

commentlist.php (bid=ODI3IFMyUA==)

display comments of a particular listing

sample output

{ "status":"success", "bid":"ODI3IFMyUA==", "tally":"10", "comments":[ { "name": "JIFFI STOP", "date":"2007-04-23 00:00:00", "comment":"Michigan Dept of Transanitation JIFFI website: http://www.xanga.com/JIFFI_STOP" } , { "name": "anon", "date":"2007-04-27 00:00:00", "comment":"I don't buy it. I think this is a joke." } ] }

queries that require a key

addlisting.php (key=SAMPLE&name=YourPlace&street=24th+and+Valencia&city=San+Francisco&state=CA&lat=37.7521&long=-122.4208&access=1&type=0&avail=3&comment=good food&directions=in back )

add a listing (api key required). at the moment all values must be derived from the client app. in the future this function will be able to reverse geocode automatically.

Sample output

{ "status":"success","message":"added!" } { "status":"failed", "message":"invalid key" }

addcomment.php (key=SAMPLE&bid=ODI3IFMyUA==&comment=hi there&name=me)

{ "status":"success","message":"added!" } { "status":"failed", "message":"invalid key" } { "status":"failed", "message":"database issue" }

--------

state/province code array

AG|Aguascalientes
AL|Alabama
AK|Alaska
AB|Alberta
AZ|Arizona
AR|Arkansas
BJ|Baja California
BS|Baja California Sur
BC|British Columbia
CA|California
CP|Campeche
CH|Chiapas
CI|Chihuahua
CU|Coahuila
CL|Colima
CO|Colorado
CT|Connecticut
DE|Delaware
DC|District of Columbia
DF|Distrito Federal
DG|Durango
FL|Florida
GA|Georgia
GJ|Guanajuato
GR|Guerrero
HI|Hawaii
HG|Hidalgo
ID|Idaho
IL|Illinois
IN|Indiana
IA|Iowa
JA|Jalisco
KS|Kansas
KY|Kentucky
LA|Louisiana
MB|Manitoba
ME|Maine
MD|Maryland
MA|Massachusetts
EM|Mexico
MI|Michigan
MH|Michoacan
MN|Minnesota
MS|Mississippi
MO|Missouri
MT|Montana
MR|Morelos
NA|Nayarit
NB|New Brunswick
NE|Nebraska
NV|Nevada
NH|New Hampshire
NJ|New Jersey
NL|Nuevo Leon
NF|Newfoundland/Labrador
NM|New Mexico
NY|New York
NC|North Carolina
ND|North Dakota
NS|Nova Scotia
NT|Northwest Territories
NU|Nunavut
OA|Oaxaca
OH|Ohio
OK|Oklahoma
ON|Ontario
OR|Oregon
PA|Pennsylvania
PU|Puebla
QA|Queretaro
QC|Quebec
QR|Quintana Roo
PE|P. Edward Island
RI|Rhode Island
SL|San Luis Potosi
SI|Sinaloa
SO|Sonora
SC|South Carolina
SD|South Dakota
SK|Saskatchewan
TA|Tabasco
TM|Tamaulipas
TN|Tennessee
TX|Texas
TL|Tlaxcala
UT|Utah
VZ|Veracruz
VT|Vermont
VA|Virginia
WA|Washington
WV|West Virginia
WI|Wisconsin
WY|Wyoming
YC|Yucatan
YT|Yukon
ZT|Zacatecas