Metadata object filter & lastUpdatedBy

I’m working on mastering use of the API metadata object filter (working on a version 2.30 system; also tested on play server play.dhis2.org/2.31.5), and I’ve come across a possible bug, but I’m not sure if I’m interpreting the documentation correctly.

Under the developer documentation 1.7 Metadata object filter:
The format of the filter itself is straight-forward and follows the pattern property:operator:value , where property is the property on the metadata you want to filter on, operator is the comparison operator you want to perform and value is the value to check against (not all operators require value). Please see the schema section to discover which properties are available.

I am able to get most of the metadata objects to work as expected, but I am getting an error when I try to filter by lastUpdatedBy, ie: /api/indicators?filter=lastUpdatedBy:eq:UID
I don’t experience any problem including lastUpdatedBy in the Metadata field filter, and lastUpdatedBy is listed under /api/schemas/indicator.xml

I’d appreciate any insight if I’m missing something in the schema that indicates that this object is not available for filtering. If this is a bug, I will submit it to JIRA.

2 Likes

Hi @sean.leland.dryer!

lastUpdatedBy is a reference to user object, which has property ‘id’, so to filter on it, you want to try something like /api/indicators?filter=lastUpdatedBy.id:eq:UID.

However, this should be handled better and you shouldn’t get an error, so I registered a bug in jira.

Hope my answer helps :slight_smile:

/ Gintare

1 Like

That works perfectly. Thank you very much for the clarification!

2 Likes