1.63 Configuration

To access configuration you can interact with the configuration resource. You can get XML and JSON responses through the Accept header or by using the .json or .xml extensions. You can GET all properties of the configuration from:

/api/26/configuration

You can send GET and POST requests to the following specific resources:

GET /api/26/configuration/systemId

GET POST DELETE /api/26/configuration/feedbackRecipients

GET POST DELETE /api/26/configuration/offlineOrganisationUnitLevel

GET POST /api/26/configuration/infrastructuralDataElements

GET POST /api/26/configuration/infrastructuralIndicators

GET POST /api/26/configuration/infrastructuralPeriodType

GET POST DELETE /api/26/configuration/selfRegistrationRole

GET POST DELETE /api/26/configuration/selfRegistrationOrgUnit

For the CORS whitelist configuration you can make a POST request with an array of URLs to whitelist as payload using “application/json” as content-type, for instance:

["www.google.com", "www.dhis2.org", "www.who.int"]

GET POST /api/26/configuration/corsWhitelist

For POST requests, the configuration value should be sent as the request payload as text. The following table shows appropriate configuration values for each property.

Configuration values
Configuration property Value
feedbackRecipients User group ID
offlineOrganisationUnitLevel Organisation unit level ID
infrastructuralDataElements Data element group ID
infrastructuralIndicators Indicator group ID
infrastructuralPeriodType Period type name (e.g. “Monthly”)
selfRegistrationRole User role ID
selfRegistrationOrgUnit Organisation unit ID
smtpPassword SMTP email server password
remoteServerUrl URL to remote server
remoteServerUsername Username for remote server authentication
remoteServerPassword Password for remote server authentication
corsWhitelist JSON list of URLs

As an example, to set the feedback recipients user group you can invoke the following curl command:

curl "localhost/api/26/configuration/feedbackRecipients" -d "wl5cDMuUhmF"
  -H "Content-Type:text/plain"-u admin:district -v