xively

Is the array of channels/datastreams in a xively feed always ordered the same way?


When retrieving historical data of a feed on xively I get JSON including an array of datastreams, each containing an array of values (called datapoints). Each datastream has an id, for example CO_00-00-aa-e8-a1-b8_1 (redacted). Instead of using this long-form id is it safe to use the array index? I.e. will the first channel in datastreams always be the first channel in datastreams?


Solution

  • The general answer is no. You should not presume the order of datastreams.

    From what I remember they were sorted either alphabetically or based on update timestamp. I know it's a little tricky with the AQE, as the datastream names contain MAC addresses... You might find the AQE app source code quite helpful.