跳转至
For the complete DHIS2 documentation index, see llms.txt.

设置和配置

系统设置

您可以通过与 系统设置*资源。系统设置是一个简单的键值对, 其中键和值都是纯文本字符串。保存或 更新系统设置,您可以向以下 URL 发出 *POST 请求:

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

或者,您可以将设置值作为请求正文提交, 其中内容类型设置为“文本/纯文本”。例如,您可以使用 像这样卷曲:

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

要批量设置系统设置,您可以发送带有 使用 POST 请求的每个系统设置键值对的属性和值:

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

可以通过指定语言环境来设置可翻译设置键的翻译 可以指定的查询参数和翻译值 作为查询参数或与正文有效负载一起使用。查看示例网址:

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

您应该将 my-key 替换为您的真实密钥,并将 my-val 替换为您的真实密钥 价值。检索给定键的值(以 JSON 或纯文本形式) 您可以向以下 URL 发出 GET 请求:

/ api / 33 / systemSettings / my-key

或者,您可以将键指定为查询参数:

/ api / 33 / systemSettings?key =我的密钥

/ api / me / authorization / <auth>

给出与当前用户相关的数据批准级别:

您可以通过重复键以 JSON 形式检索特定的系统设置 查询参数:

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

您可以使用GET请求检索所有系统设置:

/ api / 33 / systemSettings

要检索给定可翻译键的特定翻译,您可以指定 作为查询参数的语言环境:

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

如果存在,则返回给定语言环境的翻译。否则默认 值被返回。如果没有为可翻译键指定语言环境,则用户默认 UI 语言环境用于获取正确的翻译。如果给定的翻译不是 现在,再次返回默认值。

可翻译键的优先级如下:

指定的区域设置>用户的默认UI区域设置> defaut值

要删除系统设置,您可以向 URL 发出 DELETE 请求 类似于上面用于检索的那个。如果一个可翻译的键是 使用,所有现有的翻译也将被删除。

仅删除可翻译键的特定翻译,相同的 URL 至于添加翻译应该使用,空值应该是 假如:

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

可用的系统设置在下面列出。

您应该将 my-key 替换为您的真实密钥,并将 my-val 替换为您的真实密钥 价值。检索给定键的值(以 JSON 或纯文本形式) 您可以向以下 URL 发出 GET 请求:

描述 / api / 33 / systemSettings?key =我的密钥
例如,要将当前用户的 UI 语言环境设置为法语,您
可以使用以下命令。 ```json
{
"httpStatus": "Not Found",
"httpStatusCode": 404,
"status": "ERROR",
"message": "Setting does not exist or is marked as confidential",
"errorCode": "E1005"
}
```
```bash
curl "play.dhis2.org/demo/api/33/systemSettings?key=keyApplicationNotification&key=keyApplicationIntro"
-u admin:district
``` 您可以使用GET请求检索所有系统设置:
Table: User settings / api / 33 / systemSettings / ?locale =
可翻译键的优先级如下: 指定的区域设置>用户的默认UI区域设置> defaut值
描述 / api / 33 / systemSettings / ?locale = &value =
User interface locale.
应用项目标题 应用项目标题。默认:"DHIS2 是的
keyDbLocale 是的
关键应用项目通知 keyAnalysisDisplayProperty 是的
应用项目左页脚 是的
应用项目右页脚 是的
keyTrackerDashboardLayout
应用项目标题
是的 应用项目的起始页。默认:"dhis-web-dashboard-integration
是的 渲染轻量级着陆页的起始页应用项目。默认值:"false
是的 keyApplicationFooter
是的 keyApplicationRightFooter
是的 keyFlag
keyFlagImage
startModule
startModuleEnableLightweight
factorDeviation
keyEmailHostName
keyEmailPort
keyEmailTls
keyEmailSender
keyEmailUsername
keyEmailPassword
多组织单位表格 启用多组织单位表格。默认值:"false
keyConfig
minPasswordLength
maxPasswordLength
keySmsSetting
keyCacheStrategy
keyCacheability
phoneNumberAreaCode
keyAccountRecovery
keyLockMultipleFailedLogins
googleAnalyticsUA
credentialsExpires
credentialsExpiryAlert
credentialsExpiresReminderInDays
accountExpiryAlert
accountExpiresInDays
keySelfRegistrationNoRecaptcha
recaptchaSecret
recaptchaSite
keyCanGrantOwnUserAuthorityGroups
keyDataQualityMaxLimit
keyRespectMetaDataStartEndDatesInAnalyticsTableExport
keySkipDataTypeValidationInAnalyticsTableExport
keyCustomLoginPageLogo
keyCustomTopMenuLogo
globalShellEnabled
keyCacheAnalyticsDataYearThreshold
analyticsFinancialYearStart
keyIgnoreAnalyticsApprovalYearThreshold
keyAnalyticsMaxLimit
KeyTrackedEntityMaxLimit
keyAnalyticsMaintenanceMode
保存上次成功同步事件项目数据的时间戳
keyDatabaseServerCpus
keyLastSuccessfulAnalyticsTablesRuntime
keyLastSuccessfulLatestAnalyticsPartitionRuntime
keyLastMonitoringRun
keyLastSuccessfulDataSynch
keyLastSuccessfulEventsDataSynch
keyLastCompleteDataSetRegistrationSyncSuccess
syncSkipSyncForDataChangedBefore
keyLastSuccessfulAnalyticsTablesUpdate
keyLastSuccessfulLatestAnalyticsPartitionUpdate
keyLastSuccessfulResourceTablesUpdate
keyLastSuccessfulSystemMonitoringPush
keyLastSuccessfulMonitoring
keyNextAnalyticsTableUpdate
helpPageLink
keyAcceptanceRequiredForApproval
Where to email system notifications
Where to email system notifications
Default relative period for analysis. Default: "LAST_12_MONTHS"
Require authority to add to view object lists. Default: "false"
Allow assigning object to related objects during add or update. Default: "false"
Enables the usage of a custom logo on the front page. Default: "false"
Enables the usage of a custom banner on the website. Default: "false"
keyDataImportStrictPeriods(关键数据严格导入期
keyDataImportStrictDataElements
keyDataImportStrictCategoryOptionCombos
keyDataImportStrictOrganisationUnits
keyDataImportStrictAttributeOptionsCombos
keyDataImportStrictDataSetApproval
keyDataImportStrictDataSetLocking
keyDataImportStrictDataSetInputPeriods
DHIS2 网页使用的样式。默认值:"light_blue/light_blue.css"。
keyDataImportRequireAttributeOptionCombo
keyCustomJs
keyCustomCss
keyCalendar
keyDateFormat
keyStyle
keyRemoteInstanceUrl
keyRemoteInstanceUsername
keyRemoteInstancePassword
Google Maps API key
keyGoogleCloudApiKey Google Cloud API key
keyLastMetaDataSyncSuccess Keeps timestamp of last successful metadata synchronization
keyVersionEnabled Enables metadata versioning
keyMetadataFailedVersion 确定与已删除或更新的值相关联的文件资源保留的时间长度。NONE,THREE_MONTHS,ONE_YEAR或FOREVER。
keyMetadataLastFailedTime Keeps timestamp of last metadata synchronization failure
keyLastSuccessfulScheduledProgramNotifications
keyRemoteMetadataVersion
keySystemMetadataVersion
keyStopMetadataSync
确定与已删除或更新的值相关联的文件资源保留的时间长度。NONE,THREE_MONTHS,ONE_YEAR或FOREVER。
Specifies how many times the availability of remote server will be checked before synchronization jobs fail.
syncMaxAttempts
syncDelayBetweenRemoteServerAvailabilityCheckAttempts
lastSuccessfulDataStatistics
keyHideDailyPeriods 是的
允许用户在相关应用项目中打开仪表板收藏夹 是的
keyHideBiWeeklyPeriods Boolean flag used to hide/show bi-weekly periods 是的
keyHideMonthlyPeriods 是的
keyGatherAnalyticalObjectStatisticsInDashboardViews
keyCountPassiveDashboardViewsInUsageAnalytics
keyDashboardContextMenuItemSwitchViewType
是的 keyDashboardContextMenuItemOpenInRelevantApp
是的 keyDashboardContextMenuItemShowInterpretationsAndDetails

用户设置

您可以通过与 userSettings 交互来操作用户设置 资源。用户设置是一个简单的键值对,其中键 并且值是纯文本字符串。用户设置将链接到 已针对 Web API 请求进行身份验证的用户。返回列表 在所有用户设置中,您可以向以下 URL 发送 GET 请求:

/ api / 33 / userSettings

用户未设置的用户设置,将回退到等效的 系统设置。只返回用户明确设置的值, 您可以将 ?useFallback=false 附加到上述 URL,如下所示:

/ api / 33 / userSettings?useFallback = false

要为当前经过身份验证的用户保存或更新设置,您可以 向以下 URL 发出 POST 请求:

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

您可以指定要为其显式保存设置的用户 这个语法:

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

或者,您可以将设置值作为请求正文提交, 其中内容类型设置为“文本/纯文本”。例如,您可以使用 像这样卷曲:

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

例如,要将当前用户的 UI 语言环境设置为法语,您 可以使用以下命令。

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

您应该将 my-key 替换为您的真实密钥,并将 my-val 替换为您的真实密钥 价值。要以纯文本形式检索给定键的值,您可以 对以下 URL 的 GET 请求:

/ api / 33 / userSettings / my-key

要删除用户设置,您可以向 URL 发出 DELETE 请求 类似于上面用于检索的那个。

可用的系统设置在下面列出。

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

选项 描述
用户未设置的用户设置,将回退到等效的
系统设置。只返回用户明确设置的值,
您可以将 ?useFallback=false 附加到上述 URL,如下所示: / api / 33 / userSettings?useFallback = false
要为当前经过身份验证的用户保存或更新设置,您可以
向以下 URL 发出 POST 请求: 您可以指定要为其显式保存设置的用户
这个语法:
/ api / 33 / userSettings / my-key?user = username&value = my-val ```bash
curl "https://play.dhis2.org/demo/api/33/userSettings/my-key" -d "My long value"
-H "Content-Type: text/plain" -u admin:district
```
例如,要将当前用户的 UI 语言环境设置为法语,您
可以使用以下命令。 要删除用户设置,您可以向 URL 发出 DELETE 请求
类似于上面用于检索的那个。 您应该将 my-key 替换为您的真实密钥,并将 my-val 替换为您的真实密钥
价值。要以纯文本形式检索给定键的值,您可以
对以下 URL 的 GET 请求:
```bash
curl "play.dhis2.org/demo/api/33/systemSettings?key=keyApplicationNotification&key=keyApplicationIntro"
-u admin:district
``` 要删除用户设置,您可以向 URL 发出 DELETE 请求
类似于上面用于检索的那个。 可用的系统设置在下面列出。
Table: User settings 在分析应用项目中显示元数据的属性。
描述 keyStyle light_blue/light_blue.css | green/green.css | vietnam/vietnam.css
User interface stylesheet. false | true
Whether to send email notifications. false | true
Whether to send SMS notifications. Locale value
User interface locale. Locale value

组态

要访问配置,您可以与 configuration 交互 资源。您可以通过 Accept 标头获取 XML 和 JSON 响应 或使用 .json 或 .xml 扩展名。你可以*GET*所有属性 配置来自:

/ api / 33 /配置

您可以将 GETPOST 请求发送到以下特定 资源:

keyCurrentDomainType

all | aggregate | tracker

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

keyAutoSaveCaseEntryForm

对于 POST 请求,配置值应作为请求发送 有效载荷为文本。下表显示了适当的配置 每个属性的值。

Save case entry forms periodically.

keyAutoSaveTrackedEntityForm
Save person registration forms periodically. keyAutoSaveDataEntryForm
false | true Save aggregate data entry forms periodically.
keyTrackerDashboardLayout false | true
Tracker dasboard layout. 组态 { #webapi_configuration }
要访问配置,您可以与 configuration 交互
资源。您可以通过 Accept 标头获取 XML 和 JSON 响应
或使用 .json 或 .xml 扩展名。你可以*GET*所有属性
配置来自: / api / 33 /配置
您可以将 GETPOST 请求发送到以下特定
资源: 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 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: | json ["www.google.com", "www.dhis2.org", "www.who.int"] | | GET POST /api/33/configuration/corsAllowlist | 对于 POST 请求,配置值应作为请求发送 有效载荷为文本。下表显示了适当的配置 每个属性的值。 | | Table: Configuration values | Configuration property | | 值 | feedbackRecipients | | User group ID | offlineOrganisationUnitLevel | | Organisation unit level ID | infrastructuralDataElements |

例如,要设置反馈接收者用户组,您可以调用 以下 curl 命令:

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

代币

tokens 资源提供对各种服务的访问令牌。

Google服务帐号

您可以使用以下命令检索 Google 服务帐户 OAuth 2.0 访问令牌 对以下资源的 GET 请求。

User role ID

令牌将在一定时间内有效,之后 必须从此资源请求另一个令牌。响应 包含匹配令牌到期的缓存控制标头。这 响应将包含以下 JSON 格式的属性。

Organisation unit ID

指标组 描述
access_token URL to remote server
expires_in Username for remote server authentication
client_id Password for remote server authentication

假定已为DHIS2设置并配置了Google服务帐户。请查阅安装指南以获取更多信息。

静态内容

staticContent 资源允许您上传和检索自定义 DHIS2 中使用的徽标。该资源允许用户上传带有 关联的密钥,稍后可以使用密钥检索。只有 PNG 文件受支持,只能上传到logo_bannerlogo_front 键。

/ api / 33 / staticContent

代币 { #webapi_tokens }

描述
logo_banner 应用项目左侧顶部菜单中的徽标。
令牌将在一定时间内有效,之后
必须从此资源请求另一个令牌。响应
包含匹配令牌到期的缓存控制标头。这
响应将包含以下 JSON 格式的属性。 Table: Token response

要上传文件,请将带有 POST 请求的文件发送至:

POST / api / 33 / staticContent / <key>

请求将logo.png上传到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

使用相同的密钥上传多个文件将覆盖现有的 文件。这样,检索任何给定键的文件只会返回 最新上传的文件。

要检索徽标,您可以*获取*以下内容:

client_id

Example of requests to retrieve the file stored for logo_front:

  • 将“Accept: text/html”添加到 HTTP 标头。*__ 在这种情况下,如果未定义任何内容,端点将返回默认图像。找到自定义或默认图像时将返回图像流。
curl "https://play.dhis2.org/demo/api/33/staticContent/logo_front" 
  -H "Accept: text/html" -L -u admin:district
  • 将“Accept: application/json”添加到 HTTP 标头。*__ 设置此参数后,如果未找到自定义徽标,端点将永远不会返回默认图像。相反,将返回一条错误消息。找到自定义图像后,此端点将返回一个 JSON 响应,其中包含相应图像的路径/URL。
curl "https://play.dhis2.org/demo/api/33/staticContent/logo_front" 
  -H "Accept: application/json" -L -u admin:district

成功和错误消息将如下所示:

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

要使用自定义标志,您需要启用相应的系统 通过将其设置为 true 来设置。如果相应的设置为false, 将提供默认徽标。

用户界面定制

要自定义 DHIS2 应用程序的 UI,您可以插入自定义 JavaScript 和 CSS 样式通过 files 资源。

POST删除后/ api / 33 / files / script
POST GET DELETE / api / 33 / files / style

通过此资源插入的 JavaScript 和 CSS 内容将由 DHIS2 网络应用程序。这在某些情况下特别有用:

  • 覆盖 DHIS2 应用程序的 CSS 样式,例如 登录页面或主页。

  • 定义几个自定义的通用 JavaScript 函数 数据输入表单和基于 HTML 的报告。

  • 包括用于自定义数据输入表单的 CSS 样式和 基于 HTML 的报告。

登录应用项目定制{ #login_app_customization }

设置应用项目允许用户定义各种元素(文本、徽标、旗帜),用于定制 DHIS2 的登录页面。此外,用户还可以选择两种预设布局(默认布局和侧边栏布局)。

如有需要,可通过上传 HTML 模板(也可在设置项目中定义)进一步定制登录项目的样式和布局。该 HTML 模板会替换某些元素(基于 ID);下表列出了保留的 ID。通过这种方式,可以结合自定义样式(使用 css)和自定义布局(使用 HTML)来改变登录应用项目的外观。自定义模板不支持自定义脚本,任何上传的模板都将删除脚本标记。

要创建自定义模板,建议从现有模板开始(这些模板可在登录应用项目的扩展 dhis-web-login/#download 中下载)。

curl "https://play.dhis2.org/demo/api/33/staticContent/logo_front" 
  -H "Accept: application/json" -L -u admin:district

成功和错误消息将如下所示:

{
  "images": {
    "png": "http://localhost:8080/dhis/api/staticContent/logo_front"
  }
}