Back to Smartcitizen.me

Extended features for the API

Hey folks,
yesterday i wrote a small iOS app to draw a graph for various time ranges and thanks to the API it went really smooth and I got it running for my device within the evening. Anyway, I have some suggestions for an extended API:

  • when NOT grouping the posts, then the maximum output per request is 500 entries (starting with the first entry of the day provided via “from_date” param, if “from_date” is provided).
    It would be great go get either an optional parameter “start_at_hour=15” or an optional parameter “limit=42” so I can request the last N posts. (500 might be ‘too much information’ in most situations :wink:
    YourAPIDoc currently describes “from_date”: “Starting date YYYY-MM-DD. If not set gets a limit of 500 posts since the to date.” -> not true, if I d not provide the “from_date” param, then I get the FIRST 500 posts since the device was activated.

  • when grouping it would be great to get the min and max values for every param either always or per additional request parameter (“min_max=true” - so one has to explicitly provide that parameter to avoid unnecessary calculations on you side).

  • group_by could be extended to “week” and “month” to get an average reading about that time span. alternatively a more flexible group_by could look like this: “group_by=3hour(s)”. Furthermore it would be helpful if you describe the varying response parameters when grouping (“insert_datetime” and “timestamp” when not grouping, “date” when grouping by day, “date” and “hour” when grouping by hour).

Thank you :slight_smile:
Bastian

one more detail that you should add to the APIDoc:
I assume that all dates are GMT/UTC annotated - this should be added to the documentation as I have to:

    • calculate the correct from_date and to_date according to my local time
    • re-calculate and adjust all response values to match my local time zone.
      maybe the “source” time zone could be also added to the request as a separate parameter (“timezone=+2” / “timezone=-11”) so these calculations could be done once in the backend instead of redundantly in every client.
      Setting the time zone would be an interesting setting in the web ui or the SCK itself.

hi, I would love to see the limit on downloadable entries raised, or a feature that allows time-period to be defined. I can only seem to get from midnight to 08:30 on any specified day…?

I am following this example: http://api.smartcitizen.me/v0.0.1/6e0428e19cf2bff1a9c05d14d0400bf4/41/posts.json?from_date=2013-05-01&to_date=2013-05-31