DHIS2 Data Store


Docs here:https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-238/data-store.html#query-api

Highlighting some DHIS 2 data store API improvements which came out in DHIS 2.38. These make the data store a much more viable backend for web apps, and allows for more complex querying of data, similar to how the metadata APIs work.

  • Field filtering: Allows you to return only specific keys and values of entries in the data store using the fields parameter. Works similar to fields filtering in the metadata API. The filtering takes place at the namespace level and is useful when a client needs to list many entries with specific keys/values in a single query.
  • GET /api/dataStore/<namespace>?fields=name,description,type

  • Paging: In query responses, paging is supported and enabled by default. You can specify paging explicitly with the page and pageSize parameters. Paging is useful to work with namespaces with high numbers of entries.

  • GET /api/dataStore/<namespace>?fields=.&page=2&pageSize=10

  • Entry filtering: Allows you to match and filter entries in a namespace based on a variety of operators, such as eq, lt, le, gt, ge, like, null, using the filter parameter. Works similar to object filtering in the metadata API. The filtering is useful when a client wants to list many entries which match one or many criteria.

  • GET /api/dataStore/<namespace>?fields=.&filter=name:eq:Luke

  • Sorting: Allows you to sort entries in a namespace ascending or descending based on a specific key/value using the order parameter. This is useful when clients have specific requirements for sorting a list of entries.

  • GET /api/dataStore/<namespace>?fields=name&order=name:desc