Matt Gauthier

API Results for when there is "No Data"

Recommended Posts

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.

  • Upvote 1

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now