Using the single event API on DHIS2

From mn/ifi/inf5750
Revision as of 12:52, 1 November 2013 by (talk | contribs)

Jump to: navigation, search

Use /api/me to get the org unit of the logged in user. The admin user is attached to the National (Sierra Leone) org unit, where there is no single-event data to enter. The data to be entered is at the lower levels (for example Ngelehun). So to use this effectively, create a user which is attached to for example Ngelehun which you use to demo and test. When you create a user, you also need to give it access to the program and the correct permissions. The simplest is to add it to all the user roles.

To create a user, go to: and enter user details. Add all availalbe roles by pressing the '>>' button on 'Available roles'. Then select a lower org-unit. For example Ngelehun CHC.

Log in with this user in Chrome. Install a JSON formatter extension to see JSON more easily. Go to . On the bottom, you'll see organisationUnits and you can see the id of Ngelehun (DiszpKrYNg8).

Now find the program id you want to enter (or view) data for. Go to This is a list of all programs the logged in user has access to. If you can't see a program here that you're expecting, it might be a permission setting for your logged in user. Find the program id. Both geolocation and survey projects are working on programs of the type: SINGLE_EVENTS_WITHOUT_REGISTRATION. Ignore the others. The "Inpatient morbidity and mortality" program for example has id eBAyeGv0exc. To see more info about this program, go to From this JSON, you'll also see the programStages. For Single Event, there's only one programstage. You can see more info about the programstage here:

See the event analytics api documentation at:

The following URL is an example which lists a list of events (see doc-link above): 31&dimension=ou:O6uvpzGd5pu;fdc6uOvgoji&dimension=oZg33kd9taw&dimension=qrur9Dvnyt5:EQ:18For

To extract and submit individual event data, use another api. See

For example, access: