esgibter/fandomstats — pull request #17 by esgibter (2014-08-02 05:56:08+00:00)
Title: Get stats for any list of params

This adds support for a new api endpoint at
```
/api/v1.0/stats
```
Any list of search parameters can be added to this endpoint, e.g.:
```
/api/v1.0/stats?tag_id=Harry+Potter&complete=1&character_ids=1589&character_ids=1048&sort_direction=desc&page=2
```
And the Tag Stats data is returned.

What the code does in AO3url model is convert the URL params into the filters object, which is then sent into the URL creator.

Design notes:
* I chose to do URL parameters, like the example above, and consume them as the response arguments, instead of sending it via HTTP data params (like the example here: http://flask-restless.readthedocs.org/en/latest/searchformat.html) Technically it's easier for us to support it as a data param, but I thought that was more opaque if our goal was to enable other folks to consume our API. Take a look - if this doesn't seem like the right way to go I can turn it into data params pretty easily, or we could support both.
* With the addition of the `/stats` API, we could choose to do away with the `/stats/tag/` API completely. `/stats/tag/`is now just a more specific version of `/stats` and is now redundant. Opinions welcome on this - I don't know if just the tag search by itself will be very useful - I'm pretty sure we'll want to add filters pretty early on in the UI, which would mean consuming `/stats` instead of `/stats/tag/`.