1.58 User settings

You can manipulate user settings by interacting with the userSettings resource. A user setting is a simple key-value pair, where both the key and the value are plain text strings. The user setting will be linked to the user who is authenticated for the Web API request. To return a list of all user settings, you can send a GET request to the following URL:

/api/26/userSettings

User settings not set by the user, will fall back to the equivalent system setting. To only return the values set explicitly by the user, you can append ?useFallback=false to the above URL, like this:

/api/26/userSettings?useFallback=false

To save or update a setting for the currently authenticated user you can make a POST request to the following URL:

/api/26/userSettings/my-key?value=my-val

You can specify the user for which to save the setting explicitly with this syntax:

/api/26/userSettings/my-key?user=username&value=my-val

Alternatively, you can submit the setting value as the request body, where content type is set to “text/plain”. As an example, you can use curl like this:

curl "https://play.dhis2.org/demo/api/26/userSettings/my-key" -d "My long value"
  -H "Content-Type: text/plain" -u admin:district -v

As an example, to set the UI locale of the current user to French you can use the following command.

curl "https://play.dhis2.org/demo/api/26/userSettings/keyUiLocale?value=fr" -X POST -u admin:district -v

You should replace my-key with your real key and my-val with your real value. To retrieve the value for a given key in plain text you can make a GET request to the following URL:

/api/26/userSettings/my-key

To delete a user setting, you can make a DELETE request to the URL similar to the one used above for retrieval.

The available system settings are listed below.

User settings
Key Options Description
keyStyle light_blue/light_blue.css | green/green.css | vietnam/vietnam.css User interface stylesheet.
keyMessageEmailNotification false | true Whether to send email notifications.
keyMessageSmsNotification false | true Whether to send SMS notifications.
keyUiLocale Locale value User interface locale.
keyDbLocale Locale value Database content locale.
keyAnalysisDisplayProperty name | shortName Property to display for metadata in analysis apps.
keyCurrentDomainType all | aggregate | tracker Data element domain type to display in lists.
keyAutoSaveCaseEntryForm false | true Save case entry forms periodically.
keyAutoSaveTrackedEntityForm false | true Save person registration forms periodically.
keyAutoSaveDataEntryForm false | true Save aggregate data entry forms periodically.
keyTrackerDashboardLayout false | true Tracker dasboard layout.