KEMBAR78
API Usage Tip Sheet | PDF | Data | Computing
0% found this document useful (0 votes)
26 views3 pages

API Usage Tip Sheet

The document provides tips for using the DHIS2 API, including how to access various resources and organization units through specific URLs. It explains how to filter and download data, as well as how to query specific data points and utilize the Indicator Dictionary module. Additional resources and documentation for further learning are also mentioned.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views3 pages

API Usage Tip Sheet

The document provides tips for using the DHIS2 API, including how to access various resources and organization units through specific URLs. It explains how to filter and download data, as well as how to query specific data points and utilize the Indicator Dictionary module. Additional resources and documentation for further learning are also mentioned.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

DHIS2 API tips for non-programmers

More information is available from:


https://docs.dhis2.org/2.22/en/developer/html/ch01.html

Getting Started

1. All URLs to the API start with:

• https://togo.dhis2.org/dhis/api/

substitute your country

2. To see all resources (categories of data) in the system:

• https://togo.dhis2.org/dhis/api/resources

3. Change the URL to select a list of desired resources:

• https://togo.dhis2.org/dhis/api/indicators
• https://togo.dhis2.org/dhis/api/dataElements (the data that goes into calculating
indicators)
• https://togo.dhis2.org/dhis/api/dataElementGroups
• https://togo.dhis2.org/dhis/api/organisationUnits - (clinics, prefectures, regions)
• https://togo.dhis2.org/dhis/api/organisationUnitGroups

4. Add ?paging=false to the end of a URL to see a full list of a specified resource (by default,
the system only shows the first 25 records). This is useful when you want to download
data.

• Ex: https://togo.dhis2.org/dhis/api/indicators?paging=false

5. Add .csv to download data directly to your computer. The .csv goes before the
?paging=false

• Ex: https://togo.dhis2.org/dhis/api/indicators.csv?paging=false

1
6. Add a backslash and the ID of a resource to get more detailed information, including
calculation methodologies, on a specific resource. For example, to get a detailed
description of indicator ID h2WK7dkENdu:

• https://togo.dhis2.org/dhis/api/indicators/h2WK7dkENdu

Organisation Units

Organisation Units represent the Country, Region, District and clinic and are organised by
level - Country (1), Region (2), District (3), clinic (4).

1. To see a list of all organisation units:

• https://togo.dhis2.org/dhis/api/organisationUnits?paging=false

2. To filter organisation units by level 4. Add the filter after the question mark.

• https://togo.dhis2.org/dhis/api/organisationUnits?filter=level:eq:4&paging=false

3. You can also specify which fields are returned in a query. For example, if you want the id,
level, name, path and coordinates, one would include:

• https://togo.dhis2.org/dhis/api/organisationUnits?filter=level:eq:4&paging=false&fie
lds=id,level,name,path,coordinates

4. The path is the hierarchy of the Organization Unit - e.g. country ID/Region ID/District ID.
You can also return the name and ID of the Organization Unit's parent (e.g. District) and
the grandparent (e.g. Region). This can be really helpful if you want to create a table of
all level four Organization Units, their District and Region.

• https://togo.dhis2.org/dhis/api/organisationUnits?filter=level:eq:4&paging=false&fie
lds=id,level,name,path,coordinates[id,name,parent]

5. Add the .csv to download a table

• https://togo.dhis2.org/dhis/api/organisationUnits.csv?filter=level:eq:4&paging=false
&fields=id,level,name,path,coordinates[id,name,parent]

6. Or add .json to return a string with all of the information well organized (useful for our
Alteryx API)

• https://togo.dhis2.org/dhis/api/organisationUnits.json?filter=level:eq:4&paging=fals
e&fields=id,level,name,path,coordinates[id,name,parent]

7. In addition, Organization Units are also part of Organization Unit Groups. These specify
the type of clinic (e.g. public or private, hospital or USP, etc).

2
• https://togo.dhis2.org/dhis/api/organisationUnitGroups

Querying Specific Data Points

1. In addition to the meta-data, you can also query specific data points.
a. First, update the URL to your country’s API endpoint. In Togo, this required
adding /api/29/analytics. Then add dimension= to specify specific dimensions
that you want (ou: organization unit IDs, dx: indicator IDs, pe: time period).
b. Use % between IDs to use more than one dimension
c. In the example below:
i. Organization Unit IDs are highlighted in purple
ii. The time period is highlighted in green
iii. The indicator IDs are highlighted in yellow

https://togo.dhis2.org/dhis/api/29/analytics.csv?dimension=ou:PgoyKuRs20z%3BObvNuNoK
i46%3BKoA5gCxrxkr%3BgYM7EHlcVxv%3Bris2jRhudfy%3BHROrwGFFFR6%3BS99zHZFkiKU%3
BPLqoLdWlKg9%3BPJUDnUoUOXC%3Bw6YTNjy898U%3BQRtRvWW1VBL%3BUbc4fWZAAz9
%3BkCD9l4Qx2WP%3BeEQIxvIsWib%3BoQandBcJt22%3Btltz80zDS85%3BRDuBzY0i1As%3BB
Y9niUgBS0k%3BPYeCQPNnSAn%3BeJtIZ3ZMkfH%3BWI3DehMC7KX%3Bk52TtOanhCc%3BSdr
xZwN9YeK%3BcoB3NqYIMOW&dimension=pe:LAST_12_MONTHS&dimension=dx:URnDxZ1b
voK%3BwJwFD420Gn1%3BdU9I7ssqQuA&displayProperty=SHORTNAME

Indicator Dictionary Module

1. The Indicator Dictionary module allows you to search indicators by name. Each indicator
has basic details, including definition, calculation, category, and date of creation.
Additionally, you can use the Data Analysis and Trend Analysis tabs for a quick look at the
data over time.

• https://togo.dhis2.org/dhis/api/apps/Indicator-Dictionary/index.html

A lot more documentation on the web API can be found online at


https://docs.dhis2.org/master/en/developer/html/webapi.html.

We also used the application PostMan to construct API requests


https://www.getpostman.com/

You might also like