Class: get

Adaptor.get(resourceType, query, optionsopt, callbackopt) → {Operation}

new get(resourceType, query, optionsopt, callbackopt) → {Operation}

Get data. Generic helper method for getting data of any kind from DHIS2. - This can be used to get `DataValueSets`,`events`,`trackedEntityInstances`,`etc.`
Parameters:
Name Type Attributes Description
resourceType string The type of resource to get(use its `plural` name). E.g. `dataElements`, `trackedEntityInstances`,`organisationUnits`, etc.
query Object A query object that will limit what resources are retrieved when converted into request params.
options Object <optional>
Optional `options` to define URL parameters via params beyond filters, request configuration (e.g. `auth`) and DHIS2 api version to use.
callback function <optional>
Optional callback to handle the response
Source:
Returns:
state
Type
Operation
Examples

all data values for the 'pBOMPrpg1QX' dataset

get('dataValueSets', {
  dataSet: 'pBOMPrpg1QX',
  orgUnit: 'DiszpKrYNg8',
  period: '201401',
  fields: '*',
});

all programs for an organization unit

get('programs', { orgUnit: 'TSyzvBiovKh', fields: '*' });

a single tracked entity instance by a unique external ID

get('trackedEntityInstances', {
  ou: 'DiszpKrYNg8',
  filter: ['flGbXLXCrEo:Eq:124', 'w75KJ2mc4zz:Eq:John'],
});