Přeskočit obsah
For the complete DHIS2 documentation index, see llms.txt.

Nastavení a konfigurace

Nastavení systému

You can manipulate system settings by interacting with the systemSettings resource. A system setting is a simple key-value pair, where both the key and the value are plain text strings. To save or update a system setting you can make a POST request to the following URL:

/api/33/systemSettings/my-key?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 "play.dhis2.org/demo/api/33/systemSettings/my-key" -d "My long value"
  -H "Content-Type: text/plain" -u admin:district

To set system settings in bulk you can send a JSON object with a property and value for each system setting key-value pair using a POST request:

{
  "keyApplicationNotification": "Welcome",
  "keyApplicationIntro": "DHIS2",
  "keyApplicationFooter": "Read more at dhis2.org"
}

Translations for translatable Setting keys can be set by specifying locale as a query parameter and translated value which can be specified either as a query param or withing the body payload. See an example URL:

/api/33/systemSettings/<my-key>?locale=<my-locale>&value=<my-translated-value>

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 JSON or plain text) you can make a GET request to the following URL:

/api/33/systemSettings/my-key

Alternativně můžete zadat klíč jako parametr dotazu:

/api/33/systemSettings?key=my-key

If a key is not found or marked confidential then a 404 response will be returned like so:

{
    "httpStatus": "Not Found",
    "httpStatusCode": 404,
    "status": "ERROR",
    "message": "Setting does not exist or is marked as confidential",
    "errorCode": "E1005"
}

You can retrieve specific system settings as JSON by repeating the key query parameter:

curl "play.dhis2.org/demo/api/33/systemSettings?key=keyApplicationNotification&key=keyApplicationIntro"
  -u admin:district

Všechna nastavení systému můžete načíst pomocí požadavku GET:

/api/33/systemSettings

To retrieve a specific translation for a given translatable key you can specify a locale as query param:

/api/33/systemSettings/<my-key>?locale=<my-locale>

If present, the translation for the given locale is returned. Otherwise, a default value is returned. If no locale is specified for the translatable key, the user default UI locale is used to fetch the correct translation. If the given translation is not present, again, the default value is returned.

Priorita překladatelných klíčů je následující:

zadané národní prostředí > národní prostředí uživatelského rozhraní výchozího uživatele > výchozí hodnota

To delete a system setting, you can make a DELETE request to the URL similar to the one used above for retrieval. If a translatable key is used, all present translations will be deleted as well.

Chcete-li odstranit pouze konkrétní překlad přeložitelného klíče, měla by se použít stejná adresa URL jako pro přidání překladu a měla by být uvedena prázdná hodnota:

/api/33/systemSettings/<my-key>?locale=<my-locale>&value=

Dostupná nastavení systému jsou uvedena níže.

Tabulka: Nastavení systému

Klíč Popis Přeložitelný
keyUiLocale Národní prostředí pro uživatelské rozhraní Ne
keyDbLocale Národní prostředí pro databázi Ne
keyAnalysisDisplayProperty Vlastnost, která se má zobrazit v analýze. Výchozí: "jméno" Ne
keyAnalysisDigitGroupSeparator Oddělovač slouží k oddělení skupin číslic Ne
keyCurrentDomainType Zatím nepoužívané Ne
keyTrackerDashboardLayout Používá se k zachycení trackeru Ne
applicationTitle Název aplikace. Výchozí: „DHIS2“ Ano
keyApplicationIntro Úvod do aplikace Ano
keyApplicationNotification Oznámení aplikace Ano
keyApplicationFooter Zápatí aplikace vlevo Ano
keyApplicationRightFooter Zápatí aplikace vpravo Ano
keyFlag Příznak aplikace Ne
keyFlagImage Příznak použitý v nabídce ovládacího panelu Ne
startModule Úvodní stránka aplikace. Výchozí: "dhis-web-dashboard-integration" Ne
startModuleEnableLightweight Aplikace pro úvodní stránku k vykreslení odlehčené vstupní stránky. Výchozí: "false" Ne
factorDeviation Faktor standardní odchylky analýzy dat. Výchozí: "2d" Ne
keyEmailHostName Název hostitele e-mailového serveru Ne
keyEmailPort Port e-mailového serveru Ne
keyEmailTls Použijte TLS. Výchozí: "true" Ne
keyEmailSender Odesílatel e-mailu Ne
keyEmailUsername Uživatelské jméno e-mailového serveru Ne
keyEmailPassword Heslo k e-mailovému serveru Ne
minPasswordLength Minimální délka hesla Ne
maxPasswordLength Maximální délka hesla Ne
keySmsSetting Konfigurace SMS Ne
keyCacheStrategy Strategie mezipaměti. Výchozí: „CACHE_6AM_TOMORROW“ Ne
keyCacheability PUBLIC nebo PRIVATE. Určuje, zda mají proxy servery povoleno ukládat data do mezipaměti nebo ne. Ne
phoneNumberAreaCode Předčíslí telefonního čísla Ne
keyAccountRecovery Povolit obnovení uživatelského účtu. Výchozí: "false" Ne
keyLockMultipleFailedLogins Povolit uzamčení přístupu po více neúspěšných přihlášeních Ne
googleAnalyticsUA Klíč Google Analytic UA pro sledování používání webu Ne
credentialsExpires Vyžadovat změnu hesla uživatelského účtu. Výchozí: "0" (nikdy) Ne
credentialsExpiryAlert Povolit upozornění, když se pověření blíží datu vypršení platnosti Ne
credentialsExpiresReminderInDays Number of days the credential expiry alert should be send in advance of the actual expiry. Default: 28 Ne
accountExpiryAlert Odeslat e-mail s upozorněním uživatelům, jejichž účet brzy vyprší kvůli nastavenému datu vypršení platnosti. Výchozí: "false" Ne
accountExpiresInDays Počet dní, po které by mělo být upozornění na vypršení platnosti účtu odesláno před skutečným vypršením platnosti. Výchozí: 7 Ne
keySelfRegistrationNoRecaptcha Nevyžadujte recaptcha pro vlastní registraci. Výchozí: "false" Ne
recaptchaSecret Tajemství recaptcha rozhraní Google API. Výchozí: tajné API instance dhis2 play, ale to bude fungovat pouze na vaší místní instanci a ne ve výrobě. Ne
recaptchaSite Web Google API pro recaptcha. Výchozí: dhis2 play instance API site, ale to bude fungovat pouze na vaší místní instanci a ne v produkci. Ne
keyCanGrantOwnUserAuthorityGroups Povolit uživatelům udělovat vlastní uživatelské role. Výchozí: "false" Ne
keySqlViewMaxLimit Maximální limit pro zobrazení SQL Ne
keyDataQualityMaxLimit Max limit for data quality results. Must be between zero and 50,000. Ne
keyRespectMetaDataStartEndDatesInAnalyticsTableExport Když je hodnota „true“, analytika vynechá data, která nespadají do počátečního a koncového data možnosti kategorie. Výchozí: "false" Ne
keySkipDataTypeValidationInAnalyticsTableExport Přeskočí ověření datového typu v exportu analytické tabulky Ne
keyCustomLoginPageLogo Logo pro vlastní přihlašovací stránku Ne
keyCustomTopMenuLogo Logo pro vlastní horní menu Ne
globalShellEnabled When this property is enabled (set to true), apps will be displayed as iframes within a global shell. This global shell provides a consistent header bar across the system which has expanded functionalities compared to the original header bar. Default: true. Ne
keyCacheAnalyticsDataYearThreshold Data Analytics starší než tato hodnota (v letech) budou vždy uložena do mezipaměti. "0" toto nastavení deaktivovalo. Výchozí: 0 Ne
analyticsFinancialYearStart Set financial year start. Options: FINANCIAL_YEAR_FEBRUARY, FINANCIAL_YEAR_APRIL, FINANCIAL_YEAR_JULY, INANCIAL_YEAR_AUGUST, FINANCIAL_YEAR_SEPTEMBER, FINANCIAL_YEAR_OCTOBER. Default: FINANCIAL_YEAR_OCTOBER Ne
analyticsWeeklyStart Set weekly relative period start day. Options: WEEKLY (Monday), WEEKLY_WEDNESDAY, WEEKLY_THURSDAY, WEEKLY_FRIDAY, WEEKLY_SATURDAY, WEEKLY_SUNDAY. Default: WEEKLY (Monday) Ne
keyIgnoreAnalyticsApprovalYearThreshold "0" kontrola schválení pro všechna data. "-1" deaktivuje kontrolu schválení. "1" nebo vyšší kontroluje schválení pro všechna data, která jsou novější než "1" rok. Ne
keyAnalyticsMaxLimit Maximum number of analytics records. Default: "50000" Ne
KeyTrackedEntityMaxLimit Maximum number of tracked entities that are returned by /tracker/trackedEntities. More info here. Default: "50000" Ne
keyAnalyticsMaintenanceMode Přepne analytiku do režimu údržby. Výchozí: "false" Ne
keyAnalyticsPeriodYearsOffset Defines the years' offset to be used in the analytics export process. If the year of a respective date is out of the offset the system sends back a warning message during the process. At this point, the period generation step is skipped. ie.: suppose the system user sets the offset value to 5, and we are in the year 2023. It means that analytics will accept exporting dates from 2018 (inclusive) to 2028 (inclusive). Which translates to: [2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028]. NOTE: The offset will have a significant influence on resource usage. Higher values will trigger higher usage of memory RAM/HEAP and CPU. Setting negative numbers to this key will disable any kind of validation (which means no warnings) and the internal range of years will be used (1970 to current year plus 10) Default: 22 Ne
keyDatabaseServerCpus Počet CPU databázového serveru. Výchozí: "0" (automaticky) Ne
keyLastSuccessfulAnalyticsTablesRuntime Uchovává časové razítko posledních úspěšných spuštěných analytických tabulek Ne
keyLastSuccessfulLatestAnalyticsPartitionRuntime Uchovává časové razítko posledního úspěšného posledního spuštění analytického oddílu Ne
keyLastMonitoringRun Uchovává časové razítko posledního sledování Ne
keyLastSuccessfulDataSynch Udržuje časové razítko poslední úspěšné synchronizace datových hodnot Ne
keyLastSuccessfulEventsDataSynch Udržuje časové razítko poslední úspěšné synchronizace dat programů událostí Ne
keyLastCompleteDataSetRegistrationSyncSuccess Uchovává časové razítko poslední úspěšné synchronizace úplnosti Ne
syncSkipSyncForDataChangedBefore Určuje časové razítko používané k přeskočení synchronizace všech dat změněných před tímto časovým okamžikem Ne
keyLastSuccessfulAnalyticsTablesUpdate Uchovává časové razítko poslední úspěšné aktualizace analytických tabulek Ne
keyLastSuccessfulLatestAnalyticsPartitionUpdate Uchovává časové razítko poslední úspěšné aktualizace analytického oddílu Ne
keyLastSuccessfulResourceTablesUpdate Uchovává časové razítko poslední úspěšné aktualizace tabulek zdrojů Ne
keyLastSuccessfulSystemMonitoringPush Udržuje časové razítko posledního úspěšného systému monitorování push Ne
keyLastSuccessfulMonitoring Uchovává časové razítko posledního úspěšného monitorování Ne
keyNextAnalyticsTableUpdate Uchovává časové razítko příští aktualizace analytické tabulky Ne
helpPageLink Odkaz na stránku nápovědy. Výchozí: "https://dhis2.github.io/dhis2-docs/master/en/user/html/dhis2_user_manual_en.html Ne
keyAcceptanceRequiredForApproval Před schválením je vyžadováno přijetí. Výchozí: "false" Ne
keySystemNotificationsEmail Kam zasílat e-mailová systémová upozornění Ne
keyAnalysisRelativePeriod Výchozí relativní období pro analýzu. Výchozí: „LAST_12_MONTHS“ Ne
keyRequireAddToView K zobrazení seznamů objektů vyžadovat přidání oprávnění. Výchozí: "false" Ne
keyAllowObjectAssignment Povolit přiřazení objektu k souvisejícím objektům během přidávání nebo aktualizace. Výchozí: "false" Ne
keyUseCustomLogoFront Umožňuje použití vlastního loga na přední straně. Výchozí: "false" Ne
keyUseCustomLogoBanner Umožňuje použití vlastního banneru na webu. Výchozí: "false" Ne
keyDataImportStrictPeriods Ne
keyDataImportStrictPeriods Vyžadovat období, aby odpovídalo typu období souboru dat. Výchozí: "false" Ne
keyDataImportStrictDataElements Vyžadovat, aby datové prvky byly součástí datové sady. Výchozí: "false" Ne
keyDataImportStrictCategoryOptionCombos Vyžadovat kombinace možností kategorií, aby odpovídaly kombinaci kategorií datového prvku. Výchozí: "false" Ne
keyDataImportStrictOrganisationUnits Vyžadovat, aby organizační jednotky odpovídaly přiřazení souboru dat. Výchozí: "false" Ne
keyDataImportStrictAttributeOptionsCombos Vyžadovat kombinaci možností atributu, aby odpovídala kombinaci kategorií sady dat. Výchozí: "false" Ne
keyDataImportStrictDataSetApproval true: If an already approved dataset exists for a given data value entry is not permitted; false: If a not yet approved dataset exists for a given data value entry is permitted. Default: "true" Ne
keyDataImportStrictDataSetLocking true: If a dataset exists for which entry expired without lock exception for a given data value entry is not permitted; false: If a dataset exists for which entry is not expired or a lock exception applies for a given data value entry is permitted. Default: "true" Ne
keyDataImportStrictDataSetInputPeriods true: If a dataset exists for which the input period is closed for a given data value entry is not permitted; false: If a dataset exists for which data the input period is open for a given data value entry is permitted. Default: "true" Ne
keyDataImportRequireCategoryOptionCombo Vyžadovat zadání kombinace možností kategorie. Výchozí: "false" Ne
keyDataImportRequireAttributeOptionCombo Vyžadovat zadání kombinace možností atributu. Výchozí: "false" Ne
keyCustomJs Vlastní JavaScript pro použití na webu Ne
keyCustomCss Vlastní CSS pro použití na webu Ne
keyCalendar Typ kalendáře. Výchozí: "iso8601". Ne
keyDateFormat Formát, ve kterém se mají zobrazovat data. Výchozí: "yyyy-MM-dd". Ne
keyStyle The style used by the DHIS2 Android app. Default: "light_blue/light_blue.css". Ne
keyRemoteInstanceUrl Adresa URL použitá pro připojení ke vzdálené instanci Ne
keyRemoteInstanceUsername Uživatelské jméno používané pro připojení ke vzdálené instanci DHIS2 Ne
keyRemoteInstancePassword Heslo používané pro připojení ke vzdálené instanci DHIS2 Ne
keyGoogleMapsApiKey Google Maps API key Ne
keyGoogleCloudApiKey Google Cloud API key Ne
keyLastMetaDataSyncSuccess Uchovává časové razítko poslední úspěšné synchronizace metadat Ne
keyVersionEnabled Umožňuje správu verzí metadat Ne
keyMetadataFailedVersion Uchovává podrobnosti o neúspěšné synchronizaci verze metadat Ne
keyMetadataLastFailedTime Uchovává časové razítko posledního selhání synchronizace metadat Ne
keyLastSuccessfulScheduledProgramNotifications Ne
keyLastSuccessfulScheduledDataSetNotifications Ne
keyRemoteMetadataVersion Podrobnosti o verzi metadat vzdálené instance Ne
keySystemMetadataVersion Podrobnosti o verzi metadat systému Ne
keyStopMetadataSync Příznakem zastavit synchronizaci metadat Ne
keyFileResourceRetentionStrategy Určuje, jak dlouho se uchovávají souborové prostředky spojené s odstraněnými nebo aktualizovanými hodnotami. NONE, THREE_MONTHS, ONE_YEAR nebo FOREVER. Ne
syncMaxRemoteServerAvailabilityCheckAttempts Určuje, kolikrát bude zkontrolována dostupnost vzdáleného serveru, než se úlohy synchronizace nezdaří. Ne
syncMaxAttempts Určuje maximální počet pokusů pro úlohy synchronizace Ne
syncDelayBetweenRemoteServerAvailabilityCheckAttempts Prodleva mezi kontrolami dostupnosti vzdáleného serveru Ne
lastSuccessfulDataStatistics Uchovává časové razítko poslední úspěšné analýzy dat Ne
keyHideDailyPeriods Nepoužívané Ne
keyHideWeeklyPeriods Ne
keyHideBiWeeklyPeriods Booleovský příznak používaný ke skrytí / zobrazení dvoutýdenních období Ne
keyHideMonthlyPeriods Ne
keyHideBiMonthlyPeriods Ne
keyGatherAnalyticalObjectStatisticsInDashboardViews Zda se mají shromažďovat analytické statistiky o objektech, když jsou zobrazeny na ovládacím panelu Ne
keyCountPassiveDashboardViewsInUsageAnalytics Počítá „pasivní“ zobrazení ovládacího panelu (bez výběru konkrétního ovládacího panelu) v analýze využití Ne
keyDashboardContextMenuItemSwitchViewType Umožnit uživatelům přepínat mezi oblíbenými typy zobrazení ovládacího panelu Ano
keyDashboardContextMenuItemOpenInRelevantApp Umožněte uživatelům otevírat oblíbené položky na ovládacím panelu v relevantních aplikacích Ano
keyDashboardContextMenuItemShowInterpretationsAndDetails Umožněte uživatelům zobrazit interpretace a podrobnosti oblíbených položek na ovládacím panelu Ano
keyDashboardContextMenuItemViewFullscreen Umožněte uživatelům zobrazit oblíbené položky na ovládacím panelu na celé obrazovce Ano
jobsRescheduleAfterMinutes If a job is in state RUNNING for this amount of minutes or longer without making progress in form of updating its lastAlive timestamp the job is considered stale and reset to SCHEDULED state Ne
jobsCleanupAfterMinutes A "run once" job is deleted when this amount of minutes has passed since it finished successful or unsuccessful Ne
jobsMaxCronDelayHours A CRON expression triggered job will only trigger in the window between its target time of the day and this amount of hours later. If it wasn't able to run in that window the execution is skipped and next execution according to the CRON expression is the next target execution Ne
jobsLogDebugBelowSeconds A job with an execution interval below this number of seconds logs its information on debug rather than info Ne
keyParallelJobsInAnalyticsTableExport Returns the number of parallel jobs to use for processing analytics tables. It takes priority over "keyDatabaseServerCpus". Default: -1 Ne
orgUnitCentroidsInEventsAnalytics If true, the analytics event tables are created with a centroid value for each Data Element or TEA of type OU or OU Geometry. Default: false Ne

Uživatelské nastavení

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/33/userSettings

Uživatelská nastavení, která uživatel nenastaví, se vrátí k ekvivalentnímu systémovému nastavení. Chcete-li vrátit pouze hodnoty explicitně nastavené uživatelem, můžete k výše uvedené adrese URL připojit ?useFallback=false, například takto:

/api/33/userSettings?useFallback=false

Chcete-li uložit nebo aktualizovat nastavení pro aktuálně ověřeného uživatele, můžete zadat požadavek POST na následující adresu URL:

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

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

/api/33/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/33/userSettings/my-key" -d "My long value"
  -H "Content-Type: text/plain" -u admin:district

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/33/userSettings/keyUiLocale?value=fr"
  -X POST -u admin:district

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/33/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.

Dostupná nastavení systému jsou uvedena níže.

Tabulka: Uživatelská nastavení

Klíč Možnosti Popis
keyStyle light_blue/light_blue.css | green/green.css | vietnam/vietnam.css Styly uživatelského rozhraní.
keyMessageEmailNotification false | true Zda se mají odesílat e-mailová upozornění.
keyMessageSmsNotification false | true Zda se mají odesílat upozornění SMS.
keyUiLocale Hodnota národního prostředí Národní prostředí uživatelského rozhraní.
keyDbLocale Hodnota národního prostředí Národní prostředí obsahu databáze.
keyAnalysisDisplayProperty name | shortName Vlastnost, která se má zobrazit pro metadata v analytických aplikacích.
keyCurrentDomainType vše | agregát | tracker Typ domény datového prvku k zobrazení v seznamech.
keyAutoSaveCaseEntryForm false | true Pravidelně ukládat formuláře pro zadání případů.
keyAutoSaveTrackedEntityForm false | true Pravidelně ukládat registrační formuláře osob
keyAutoSaveDataEntryForm false | true Pravidelně ukládat formuláře pro zadávání souhrnných dat.
keyTrackerDashboardLayout false | true Rozložení ovládacího panelu trackeru.

Konfigurace

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/33/configuration

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

GET /api/33/configuration/systemId

GET POST DELETE /api/configuration/feedbackRecipients

GET POST DELETE /api/configuration/offlineOrganisationUnitLevel

GET POST /api/configuration/infrastructuralDataElements

GET POST /api/configuration/infrastructuralIndicators

GET POST /api/configuration/infrastructuralPeriodType

GET POST /api/configuration/dataOutputPeriodTypes

GET POST DELETE /api/configuration/selfRegistrationRole

GET POST DELETE /api/configuration/selfRegistrationOrgUnit

GET POST /api/facilityOrgUnitGroupSet

GET POST /api/facilityOrgUnitLevel

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

["www.google.com", "www.dhis2.org", "www.who.int"]
GET POST /api/33/configuration/corsAllowlist

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.

Tabulka: Hodnoty konfigurace

Vlastnost konfigurace Hodnota
feedbackRecipients ID skupiny uživatelů
offlineOrganisationUnitLevel ID úrovně organizační jednotky
infrastructuralDataElements ID skupiny datových prvků
infrastructuralIndicators ID skupiny indikátorů
infrastructuralPeriodType Název typu období (např. „Měsíčně“)
dataOutputPeriodTypes JSON list of period type name (e.g. "Monthly", "Quarterly", "Yearly", etc.)
selfRegistrationRole ID uživatelské role
selfRegistrationOrgUnit ID organizační jednotky
smtpPassword Heslo e-mailového serveru SMTP
remoteServerUrl URL na vzdálený server
remoteServerUsername Uživatelské jméno pro ověření vzdáleného serveru
remoteServerPassword Heslo pro ověření vzdáleného serveru
corsAllowlist JSON seznam URL

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

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

Tokeny

Prostředek tokeny poskytuje přístupové tokeny k různým službám.

Účet služby Google

You can retrieve a Google service account OAuth 2.0 access token with a GET request to the following resource.

GET /api/tokens/google

The token will be valid for a certain amount of time, after which another token must be requested from this resource. The response contains a cache control header which matches the token expiration. The response will contain the following properties in JSON format.

Tabulka: Odezva tokenu

Vlastnictví Popis
access_token Přístupový token OAuth 2.0, který se má použít při ověřování proti službám Google.
expires_in Počet sekund do vypršení platnosti přístupového tokenu, obvykle 3600 sekund (1 hodina).
client_id ID klienta servisního účtu Google.

To předpokládá, že účet služby Google byl nastaven a nakonfigurován pro DHIS2. Další informace najdete v instalační příručce.

Statický obsah

The staticContent resource allows you to upload and retrieve custom logos used in DHIS2. The resource lets the user upload a file with an associated key, which can later be retrieved using the key. Only PNG files are supported and can only be uploaded to the logo_banner and logo_front keys.

/api/33/staticContent

Tabulka: Klíče statického obsahu

Klíč Popis
logo_banner Logo v horním menu aplikace na levé straně.
logo_front Logo na přihlašovací stránce nad přihlašovacím formulářem.

Chcete-li nahrát soubor, odešlete soubor s požadavkem POST na adresu:

POST /api/33/staticContent/<key>

Příklad požadavku na nahrání logo.png do klíče logo_front:

curl -F "file=@logo.png;type=image/png" "https://play.dhis2.org/demo/api/33/staticContent/logo_front"
  -X POST -H "Content-Type: multipart/form-data" -u admin:district

Nahrání více souborů se stejným klíčem přepíše stávající soubor. Tímto způsobem se při načtení souboru pro daný klíč vrátí pouze poslední nahraný soubor.

To retrieve a logo, you can GET the following:

GET /api/33/staticContent/<key>

Příklad požadavků na načtení souboru uloženého pro logo_front:

  • Adding "Accept: text/html" to the HTTP header.*__ In this case, the endpoint will return a default image if nothing is defined. Will return an image stream when a custom or default image is found.
curl "https://play.dhis2.org/demo/api/33/staticContent/logo_front"
  -H "Accept: text/html" -L -u admin:district
  • Adding "Accept: application/json" to the HTTP header.*__ With this parameter set, the endpoint will never return a default image if the custom logo is not found. Instead, an error message will be returned. When the custom image is found this endpoint will return a JSON response containing the path/URL to the respective image.
curl "https://play.dhis2.org/demo/api/33/staticContent/logo_front"
  -H "Accept: application/json" -L -u admin:district

Úspěšné a chybové zprávy budou vypadat takto:

{
  "images": {
    "png": "http://localhost:8080/dhis/api/staticContent/logo_front"
  }
}
{
  "httpStatus": "Not Found",
  "httpStatusCode": 404,
  "status": "ERROR",
  "message": "No custom file found."
}

To use custom logos, you need to enable the corresponding system settings by setting it to true. If the corresponding setting is false, the default logo will be served.

Přizpůsobení uživatelského rozhraní

To customize the UI of the DHIS2 application you can insert custom JavaScript and CSS styles through the files resource.

POST GET DELETE /api/33/files/script
POST GET DELETE /api/33/files/style

The JavaScript and CSS content inserted through this resource will be loaded by the DHIS2 web application. This can be particularly useful in certain situations:

  • Overriding the CSS styles of the DHIS2 application, such as the přihlašovací stránka nebo hlavní stránka.

  • Defining JavaScript functions which are common to several custom formuláře pro zadávání dat a zprávy založené na HTML.

  • Including CSS styles which are used in custom data entry forms and HTML-based reports.

Login App customization

The Settings App allows users to define a variety of elements (text, logo, flag) that can be used to customize the login page of DHIS2. Additionally, it is possible to choose between two preconfigured layouts (the default and a sidebar layout).

If needed, the login app's styling and layout can be further customized by uploading an HTML template (also definable in the settings app). This HTML template replaces certain elements (based on ID); the reserved IDs are listed in the table below. In this way, it is possible to combine custom styling (using css) and custom layout (using HTML) to change the look of the login app. The custom template does not support custom scripts, and script tags will be removed from any uploaded template.

To create a custom template, it is recommended to start with one of the existing templates (these are available for download from within the login app at the extension dhis-web-login/#download).

ID Replaced by
login-box The main login dialog, which prompts the user to enter their username/password. This must be included for the login app to work as intended.
application-title Text for the application title.
application-introduction Text for the application introduction.
flag The selected flag.
logo The logo (DHIS2 logo is used if custom logo is not defined).
powered-by A link to DHIS2.org.
application-left-footer Text for the left-side footer.
application-right-footer Text for the right-side footer.
language-select Selection to control the language of the login app.

The appearance of the login dialog can also be modified by defining css variables within the HTML template. The following css variables are available for customization:

--form-container-margin-block-start
--form-container-margin-block-end
--form-container-margin-inline-start, auto
--form-container-margin-inline-end
--form-container-default-width
--form-container-padding
--form-container-background-color
--form-container-box-border-radius
--form-container-box-shadow
--form-container-font-color
--form-title-font-size
--form-title-font-weight
--form-container-title-color

You can reset the login page theme using the API by making a POST request to /api/41/systemSettings/loginPageLayout including the loginPageLayout DEFAULT or SIDEBAR value in the request body, where content type is set to "text/plain". As an example, you can use curl like this:

curl "play.im.dhis2.org/stable-2-41-0/api/41/systemSettings/loginPageLayout" -d "DEFAULT" -H "Content-Type: text/plain" -u admin:district