infinitesunrise / carsinbikelanes

A browsable geographic database for crowdsourced traffic violation reporting
GNU General Public License v3.0
64 stars 18 forks source link

Public API #3

Closed infinitesunrise closed 7 years ago

infinitesunrise commented 7 years ago

The site is currently a mess of javascript and PHP calling GET requests on itself without any sort of standard and is a total black box. It needs to have an API not only to clean up it's own internal workings but to give users and other developers an alternate means to submit entries and alternate means of reading data. I'm pretty fresh to JSON-based APIs but they seem simple enough for the relatively small number of features that would need to be communicated. I don't expect this database to become a hulking beast so something lightweight like that should be sufficient. After the API is working then the interface can be re-written to implement it.

At minimum:

/api/upload

/api/search

I'm not sure of the best way to represent an entry in JSON, but I guess a simple flat group of 8 properties is best? Image would be expressed as a URL suffix, like /2016/09/21/1.jpg. Well I guess the API could add on the http://domain/images part. And I guess the upload would have to assume formData because of the image?

infinitesunrise commented 7 years ago

Fixed in 9dbc52b8504d92f4579536f0ebefdb66c398e316