Why my dataInputPeriods returning an empty array when pulling dataset data from the API

I am trying to access a datasets data input periods using the API but the response i am getting is just an array of dataInputPeriod which is empty as shown in the screenshot attached

@Yambanso_Kausiwa Do you see anything in the UI for dataInputPeriods button for that dataset?

2 Likes

Hi @Yambanso_Kausiwa

The dataInputPeriods need to be specifically defined for each dataSet. Having the periodType doesn’t automatically generate the periods.

You can do so in the DHIS2 Interface > Maintenance app > Data Set > [your dataset] > Data input periods. After saving the dataset, you should see them return in the API.

However, this is not necessarily a best practice. What are you trying to achieve by getting these returned?

We use this code to calculate them client-side: