apirestcosm

How to retrieve all data points in a Cosm datastream?


Given a datastream like https://api.cosm.com/v2/feeds/61916/datastreams/random5.json, I'd expect to be able to page through all the datapoints in a feed like so:

GET ?start=1970-01-01T00:00:00Z&interval=0&offset=0&limit=1000
GET ?start=1970-01-01T00:00:00Z&interval=0&offset=1000&limit=1000
GET ?start=1970-01-01T00:00:00Z&interval=0&offset=2000&limit=1000
...

But there does not appear to be an offset parameter, and Cosm requires a start and an end parameter that are no further than 6h apart. Do I really need to issue thousands of requests (i.e. one or more for each 6h interval, starting from the beginning of time), or is there a better way?


Solution

  • At the moment, the way to paginate through every point is, as you say, to use interval=0, with the max per_page of 1000 and to split the request up into 6 hour chunks.

    We're looking at increasing these limits now that our back end storage can handle it.

    Sorry I can't give a better answer right now, but this should improve.