Please use /api/dataSets.json?paging=false&fields=id,name,code,dataSetElements[dataElement[dataElementGroups[id,name,dataElement[id,name,attributeValues[id,name]]]]]
@rithvik thanks a lot. The api you sent return each dataelements and their associated groups which is a bit different from what I want. But that gave me a clue to know that I can place DEGroup inside DE. So I make small change to this one below and it gives me something I can use JS to desctructure.
Datasets contains dataElements. Also, dataElements are part of different dataElementGroups. If you keenly observe, there is no direct relationship between datasets and dataElementGroups. So, it is not possible to fetch the data you are expecting.
The current result is as follows:
data set [ DEs part of the data set [All DE groups the DE is part of ]]
I already noticed. That’s why I suggest that it would be better if dataElementGroup have the higher relationship to dataset so that when we fetch the data it can be nested as dataset>dataElementGroup>dataElement. That way it well be easy to destructure it. I am still trying to work around it.
I am working on an existing solution that I develop with this top to bottom hierarchy for fetching DE before I know about DHIS2.