Unfiltered access to metadata export requires super user

Getting this 409 error when I call an API to pull lastUpdated organisationUnits from DHIS2 version 2.35.5:

{"httpStatus":"Conflict","httpStatusCode":409,"status":"ERROR","message":"Unfiltered access to metadata export requires super user or 'F_METADATA_EXPORT' authority."}

Just recently started coming up , likely after the DHIs2 version was updated.

Is it that the user I am using to pull the data via the api does not have the F_METADATA_EXPORT authority?

Welcome to the community @ndethi!

Most probably yes, would you please check if the user you are using has the authority or not? Check your_Instance_URL/api/me?fields=authorities

1 Like

Thank you @Gassim . Yes indeed the user I am using does not have that F_METADATA_EXPORT authority in their list of authorities. This means I either use a super user account to grant this current user this authority or use the su account credentials for the data pull?

Also what does unfiltered access mean in this case, as I see there is a filter in the api call that filters by the lastUpdated date?

Yes, indeed! :+1:

There is a parameter called ‘filter’; for example, filter=metadataObject:eq:value, and this filter means it will not retrieve all information at once but only those that match the filter whereas the lastUpdated is used to order not “filter”. It will retrieve all data by the order of lastUpdated without filter.

Hope this helps! :+1:

Thank you @Gassim this sheds some light into the api call particulars.

Say I was to implement a filter that replicates the function of the order by lastUpdated parameter in the call

filter=lastUpdated:gt:{todaysDate}

would this fly?

Thank you for your patience @ndethi! I was experimenting on my own and reading through the docs but then a quick search in the community of practice I found that a similar question has been asked before with a solution: