Forum Discussion

Matt_Gauthier's avatar
8 years ago

API Results for when there is "No Data"

I discovered that when making REST API calls if there is no data available for the period requested, then the output is blank as in nothing.  This should be revised to No Data, or some other value to indicate.  Especially when requesting data in a CSV format - there should at least be the correct number of ',' in the output to - if there are 5 rows of no data in the output, it should result in ',,,,' or 'no data,no data,no data,no data,no data' as the output.

  • Sarah_Terry's avatar
    Sarah_Terry
    Icon for Product Manager rankProduct Manager

    Hi Matt -

    Thanks for posting.  Currently, the REST API returns an empty array for time periods where there are no available datapoints (e.g. values = []) and returns an array of "no data" values for time periods where the collection for the DataSource in question occurred but resulted in no values (e.g. values = ["no data","no data"].  This matches the behavior of the UI, where the first scenario results in empty data & the second scenario results in No Data values.  This behavior allows differentiation of no data due to issues with data collection & no data due to environment issues (e.g. time period is set to before the device is added).  Does that make sense?

    Thanks,
    Sarah

  • Thanks for the response, Sarah - yes, it does make sense.  I think it would be helpful, at least in the case of csv output, to have an empty record like ',,,,' if there is no data for the requested time period, and 'no data, no data, no data, no data, no data' if the datasource polled but no data was returned in response.  That doesn't make sense for JSON output but maybe a different indicator or something could used there if needed.