CloudHealth OLAP reports API returns many data arrays that contain all "null" values
search cancel

CloudHealth OLAP reports API returns many data arrays that contain all "null" values

book

Article ID: 413404

calendar_today

Updated On:

Products

CloudHealth

Issue/Introduction

The CloudHealth REST API for OLAP reporting returns full result set JSON arrays for all selected data.  If there is no data at an index location then its array will contain all "null" values.  

In this example the data:1:1 index location has 9 (nine) arrays of two null values each.  

Environment

REST API for OLAP reporting

Cause

This is expected behavior.  


Resolution

Use the collapse_null_arrays=1 query parameter

The null arrays can be reduced to a single "Null" value.  This reduces the size of the returned data set and has the added benefit of improving API result return speed in many cases.  
To do this simply add the "&collapse_null_arrays=1" parameter to your query (see below example). 

https://chapi.cloudhealthtech.com/olap_reports/cost/history.json?interval=monthly&filters[]=time:select:2025-08&dimensions[]=AWS-Regions&dimensions[]=AWS-Service-Category&dimensions[]=AWS-Account&measures[]=cost&measures[]=cost_amortized&collapse_null_arrays=1


The returned JSON data set will have all null arrays collapsed to a single null.  Your application code should handle these nulls gracefully. 
In this example note that the arrays at data:1:1 have been reduced to a single null.  Compare to the prior example in the Introduction section above. 



Also see that that the data at data:1:0 has been reduced to 3 arrays of data where it had 9 before.