How to call events analytics in useDataQuery() hook

Hi,

I was able to prepare aggregate pivot table query to fetch data using the useDataQuery() hook. but I was not able to call event analytics in the same format. can any help me on this. following are my both queries.

Aggregate analytics query:

const query= {
results: {
resource: “analytics”,
params:{ dimension:[
“ou:LEVEL-5;Nasfuph3Pqw”,
“pe:THIS_YEAR”
],
filter:“dx:h2lRF6KvfW6”,
displayProperty:“SHORTNAME”,
outputIdScheme:“NAME”
}
}
};

Event analytics:

  const query={
        result:{
            resource:"analytics",
            params:{
                dimension:[
                    "pe:LAST_12_MONTHS",
                    "ou:Nasfuph3Pqw",
                    "jQb2gaUTsIF.TR1hHNeyROj",
                ],
                displayProperty:"SHORTNAME",
                outputType:"EVENT",
                outputIdScheme:"NAME",
                stage:"jQb2gaUTsIF"
            }
        }
  };

Hi @baktash.salehi, sorry for the delayed response - event analytics have their own endpoint in the DHIS2 API, so you need to change the resource to analytics/events and follow the specification of that api which can be found at docs.dhis2.org