Lewis Baker wrote:
> Are there any plans to release an API for ScenicOrNot, as opposed to the 
> .tsv file datadump?

I've written a script which will convert the TSV file into two database 
tables (locations and votes, as there is more than one vote per location 
so they shouldn't be stored in the same table). There's an unbelievably 
basic API available by GET'ing the following URL:

http://dev.xk7.net/scenicornot/getvotes.php?location={locationID}

{locationID} needs to be replaced by the ID of the location you want the 
votes for, e.g.

http://dev.xk7.net/scenicornot/getvotes.php?location=1

You'll get back some XML which looks like this:

<son>
<votes>
<vote>4</vote>
<vote>3</vote>
[...]
</votes>
</son>

Which represents all the votes for that particular location. If you 
don't provide a valid location, you'll get back:

<son>
<error>Error Message</error>
</son>

I'll write a simple wrapper script for the TSV->SQL code so that it is 
entirely automated and upload this at some point this week, but if 
anyone wants to see it in the meantime just give me a shout off-list. 
I'll try and extend the API to be more useful (e.g. providing all 
locations between a set of coordinates) later in the week.

Paul

P.S. Please don't hammer the API as it is running on one of my virtual 
machines. :)

-- 
Paul Waring
http://www.pwaring.com

_______________________________________________
Mailing list [email protected]
Archive, settings, or unsubscribe:
https://secure.mysociety.org/admin/lists/mailman/listinfo/developers-public

Reply via email to