设置和配置¶
当前用户信息¶
为了获取有关当前已验证用户的信息和 它与其他资源的关联,您可以使用 me 资源 (您也可以通过其旧名称 currentUser 来引用它)。目前 用户相关资源为您提供有用的信息 构建客户端,例如用于数据输入和用户管理。这 下面描述了这些资源及其用途。
提供有关您当前登录的用户的基本信息 in as,包括用户名、用户凭据、分配的组织 单位:
不
提供有关当前未读消息和解释的信息:
/ api / me / dashboard
为了更改密码,此端点可用于验证 新输入的密码。密码验证将基于 系统中配置的 PasswordValidationRules。这个端点支持 POST 和密码字符串应在 POST 正文中发送。
/ api / me / validatePassword
更改密码时,此端点(支持 POST)可用于 验证旧密码。密码字符串应在 POST 正文中发送。
/ api / me / verifyPassword
返回授予当前用户的权限集:
/ api / me / authorization
返回 true 或 false,表示当前用户是否已被 授予给定的<auth>授权:
/ api / me / authorization / <auth>
给出与当前用户相关的数据批准级别:
/ api / me / dataApprovalLevels
提供当前用户可以访问的数据批准工作流。 对于每个工作流程,显示用户可能看到的数据批准级别,以及 他们在每个级别上具有什么权限:
/ api / me / dataApprovalWorkflows
Settings and configuration
系统设置 { #webapi_system_settings }
您可以通过与 系统设置*资源。系统设置是一个简单的键值对, 其中键和值都是纯文本字符串。保存或 更新系统设置,您可以向以下 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 请求:
| To send an email with an HTML body, you can simply provide the HTML content in the message parameter. The email client should interpret the HTML and render it accordingly. Note that the Content-Type header in the curl command should be application/x-www-form-urlencoded, as the data is sent as URL-encoded form data. The following example shows how to send an email with a simple HTML table: | Parameter name | / 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" } | Program notification template | | bash curl "play.dhis2.org/demo/api/33/systemSettings?key=keyApplicationNotification&key=keyApplicationIntro" -u admin:district | 您可以使用GET请求检索所有系统设置: | Program notification template | | Table: User settings | / api / 33 / systemSettings / json { "name": "Case notification", "notificationTrigger": "ENROLLMENT", "subjectTemplate": "Case notification V{org_unit_name}", "displaySubjectTemplate": "Case notification V{org_unit_name}", "notifyUsersInHierarchyOnly": false, "sendRepeatable": false, "notificationRecipient": "ORGANISATION_UNIT_CONTACT", "notifyParentOrganisationUnitOnly": false, "displayMessageTemplate": "Case notification A{h5FuguPFF2j}", "messageTemplate": "Case notification A{h5FuguPFF2j}", "deliveryChannels": [ "EMAIL" ] } | | 不 | keyDbLocale | json { "name": "Case notification", "notificationTrigger": "ENROLLMENT", "subjectTemplate": "Case notification V{org_unit_name}", "displaySubjectTemplate": "Case notification V{org_unit_name}", "notifyUsersInHierarchyOnly": false, "sendRepeatable": false, "notificationRecipient": "ORGANISATION_UNIT_CONTACT", "notifyParentOrganisationUnitOnly": false, "displayMessageTemplate": "Case notification A{h5FuguPFF2j}", "messageTemplate": "Case notification A{h5FuguPFF2j}", "deliveryChannels": [ "EMAIL" ] } | | 不 | keyAnalysisDisplayProperty | json { "name": "Case notification", "notificationTrigger": "ENROLLMENT", "subjectTemplate": "Case notification V{org_unit_name}", "displaySubjectTemplate": "Case notification V{org_unit_name}", "notifyUsersInHierarchyOnly": false, "sendRepeatable": false, "notificationRecipient": "ORGANISATION_UNIT_CONTACT", "notifyParentOrganisationUnitOnly": false, "displayMessageTemplate": "Case notification A{h5FuguPFF2j}", "messageTemplate": "Case notification A{h5FuguPFF2j}", "deliveryChannels": [ "EMAIL" ] } | | 不 | keyAnalysisDigitGroupSeparator | json { "name": "Case notification", "notificationTrigger": "ENROLLMENT", "subjectTemplate": "Case notification V{org_unit_name}", "displaySubjectTemplate": "Case notification V{org_unit_name}", "notifyUsersInHierarchyOnly": false, "sendRepeatable": false, "notificationRecipient": "ORGANISATION_UNIT_CONTACT", "notifyParentOrganisationUnitOnly": false, "displayMessageTemplate": "Case notification A{h5FuguPFF2j}", "messageTemplate": "Case notification A{h5FuguPFF2j}", "deliveryChannels": [ "EMAIL" ] } | | 不 | keyCurrentDomainType | json { "name": "Case notification", "notificationTrigger": "ENROLLMENT", "subjectTemplate": "Case notification V{org_unit_name}", "displaySubjectTemplate": "Case notification V{org_unit_name}", "notifyUsersInHierarchyOnly": false, "sendRepeatable": false, "notificationRecipient": "ORGANISATION_UNIT_CONTACT", "notifyParentOrganisationUnitOnly": false, "displayMessageTemplate": "Case notification A{h5FuguPFF2j}", "messageTemplate": "Case notification A{h5FuguPFF2j}", "deliveryChannels": [ "EMAIL" ] } | | 不 | keyTrackerDashboardLayout | Program notification template | | 不 | 应用项目标题 | Program notification template | | 是的 | keyApplicationIntro | Program notification template | | 是的 | 关键应用项目通知 | Program notification template | | 是的 | keyApplicationFooter | Program notification template | | 是的 | keyApplicationRightFooter | Program notification template | | 是的 | keyFlag | Program notification template | | 不 | keyFlagImage | Program notification template | | 不 | startModule | Program notification template | | 不 | startModuleEnableLightweight | Program notification template | | 不 | factorDeviation | Program notification template | | 不 | keyEmailHostName | Program notification template | | 不 | keyEmailPort | Program notification template | | 不 | keyEmailTls | Program notification template | | 不 | keyEmailSender | Program notification template | | 不 | keyEmailUsername | Program notification template | | 不 | keyEmailPassword | Program notification template | | 不 | minPasswordLength | Program notification template | | 不 | maxPasswordLength | Program notification template | | 不 | keySmsSetting | Program notification template | | 不 | keyCacheStrategy | Program notification template | | 不 | keyCacheability | Program notification template | | 不 | phoneNumberAreaCode | Program notification template | | 不 | keyAccountRecovery | Program notification template | | 不 | keyLockMultipleFailedLogins | Program notification template | | 不 | googleAnalyticsUA | Program notification template | | 不 | credentialsExpires | Program notification template | | 不 | credentialsExpiryAlert | Program notification template | | 不 | credentialsExpiresReminderInDays | Program notification template | | 不 | accountExpiryAlert | Program notification template | | 不 | accountExpiresInDays | Program notification template | | 不 | keySelfRegistrationNoRecaptcha | Program notification template | | 不 | recaptchaSecret | Program notification template | | 不 | recaptchaSite | Program notification template | | 不 | keyCanGrantOwnUserAuthorityGroups | Program notification template | | 不 | keySqlViewMaxLimit | Program notification template | | 不 | keyDataQualityMaxLimit | Program notification template | | 不 | 设置财务年度开始时间。选项:financial_year_february、financial_year_april、financial_year_july、inancial_year_august、financial_year_september、financial_year_october。默认值:财务年度_10 月 | Program notification template | | 分析每周开始 | 设置每周相对周期开始日。选项WEEKLY(周一)、WEEKLY_WEDNESDAY、WEEKLY_THURSDAY、WEEKLY_FRIDAY、WEEKLY_SATURDAY、WEEKLY_SUNDAY。默认值:周一 | Program notification template | | 不 | keySkipDataTypeValidationInAnalyticsTableExport | Program notification template | | 不 | keyCustomLoginPageLogo | Program notification template | | 不 | keyCustomTopMenuLogo | Program notification template | | 不 | globalShellEnabled | Program notification template | | 不 | keyCacheAnalyticsDataYearThreshold | Program notification template | | 不 | analyticsFinancialYearStart | Program notification template | | 不 | keyIgnoreAnalyticsApprovalYearThreshold | Program notification template | | 不 | keyAnalyticsMaxLimit | Program notification template | | 不 | KeyTrackedEntityMaxLimit | Program notification template | | 不 | keyAnalyticsMaintenanceMode | Program notification template | | 不 | keyAnalyticsPeriodYearsOffset | Program notification template | | 不 | keyDatabaseServerCpus | Program notification template | | 不 | keyLastSuccessfulAnalyticsTablesRuntime | Program notification template | | 不 | keyLastSuccessfulLatestAnalyticsPartitionRuntime | Program notification template | | 不 | keyLastMonitoringRun | Program notification template | | 不 | keyLastSuccessfulDataSynch | Program notification template | | 不 | keyLastSuccessfulEventsDataSynch | Program notification template | | 不 | keyLastCompleteDataSetRegistrationSyncSuccess | Program notification template | | 不 | syncSkipSyncForDataChangedBefore | Program notification template | | 不 | keyLastSuccessfulAnalyticsTablesUpdate | Program notification template | | 不 | keyLastSuccessfulLatestAnalyticsPartitionUpdate | Program notification template | | 不 | keyLastSuccessfulResourceTablesUpdate | Program notification template | | 不 | keyLastSuccessfulSystemMonitoringPush | Program notification template | | 不 | keyLastSuccessfulMonitoring | Program notification template | | 不 | keyNextAnalyticsTableUpdate | Program notification template | | 不 | helpPageLink | Program notification template | | 不 | keyAcceptanceRequiredForApproval | Program notification template | | Where to email system notifications || Program notification template | | Where to email system notifications | 不 | Program notification template | | Default relative period for analysis. Default: "LAST_12_MONTHS" | 不 | Program notification template | | Require authority to add to view object lists. Default: "false" | 不 | Program notification template | | Allow assigning object to related objects during add or update. Default: "false" | 不 | Program notification template | | Enables the usage of a custom logo on the front page. Default: "false" | 不 | Program notification template | | Enables the usage of a custom banner on the website. Default: "false" | 不 | Program notification template | | 不 | keyDataImportStrictPeriods(关键数据严格导入期 | Program notification template | | 不 | keyDataImportStrictDataElements | Program notification template | | 不 | keyDataImportStrictCategoryOptionCombos | Program notification template | | 不 | keyDataImportStrictOrganisationUnits | Program notification template | | 不 | keyDataImportStrictAttributeOptionsCombos | Program notification template | | 不 | keyDataImportStrictDataSetApproval | Program notification template | | 不 | keyDataImportStrictDataSetLocking | Program notification template | | 不 | keyDataImportStrictDataSetInputPeriods | Program notification template | | 不 | keyDataImportRequireCategoryOptionCombo | Program notification template | | 不 | keyDataImportRequireAttributeOptionCombo | Program notification template | | 不 | keyCustomJs | Program notification template | | 不 | keyCustomCss | Program notification template | | 不 | keyCalendar | Program notification template | | 不 | keyDateFormat | Program notification template | | 不 | keyStyle | Program notification template | | 不 | keyRemoteInstanceUrl | Program notification template | | 不 | keyRemoteInstanceUsername | Program notification template | | 不 | keyRemoteInstancePassword | Program notification template | | 不 || Program notification template | | Google Maps API key || Program notification template | | keyGoogleCloudApiKey | Google Cloud API key | Program notification template | | keyLastMetaDataSyncSuccess | Keeps timestamp of last successful metadata synchronization | Program notification template | | keyVersionEnabled | Enables metadata versioning | Program notification template | | keyMetadataFailedVersion | Keeps details about failed metadata version sync | Program notification template | | keyMetadataLastFailedTime | Keeps timestamp of last metadata synchronization failure | Program notification template | | keyLastSuccessfulScheduledProgramNotifications | 不 | Program notification template | | 不 | keyRemoteMetadataVersion | Program notification template | | 不 | keySystemMetadataVersion | Program notification template | | 不 | keyStopMetadataSync | Program notification template | | 不 || Program notification template | | 确定与已删除或更新的值相关联的文件资源保留的时间长度。NONE,THREE_MONTHS,ONE_YEAR或FOREVER。 | 不 | Program notification template | | Specifies how many times the availability of remote server will be checked before synchronization jobs fail. || Program notification template | | syncMaxAttempts || Program notification template | | 不 | syncDelayBetweenRemoteServerAvailabilityCheckAttempts | Program notification template | | 不 | lastSuccessfulDataStatistics | Program notification template | | 不 | keyHideDailyPeriods | json { "name": "Case notification", "notificationTrigger": "ENROLLMENT", "subjectTemplate": "Case notification V{org_unit_name}", "displaySubjectTemplate": "Case notification V{org_unit_name}", "notifyUsersInHierarchyOnly": false, "sendRepeatable": false, "notificationRecipient": "ORGANISATION_UNIT_CONTACT", "notifyParentOrganisationUnitOnly": false, "displayMessageTemplate": "Case notification A{h5FuguPFF2j}", "messageTemplate": "Case notification A{h5FuguPFF2j}", "deliveryChannels": [ "EMAIL" ] } | | 不 | keyHideWeeklyPeriods | json { "name": "Case notification", "notificationTrigger": "ENROLLMENT", "subjectTemplate": "Case notification V{org_unit_name}", "displaySubjectTemplate": "Case notification V{org_unit_name}", "notifyUsersInHierarchyOnly": false, "sendRepeatable": false, "notificationRecipient": "ORGANISATION_UNIT_CONTACT", "notifyParentOrganisationUnitOnly": false, "displayMessageTemplate": "Case notification A{h5FuguPFF2j}", "messageTemplate": "Case notification A{h5FuguPFF2j}", "deliveryChannels": [ "EMAIL" ] } | | keyHideBiWeeklyPeriods | Boolean flag used to hide/show bi-weekly periods | json { "name": "Case notification", "notificationTrigger": "ENROLLMENT", "subjectTemplate": "Case notification V{org_unit_name}", "displaySubjectTemplate": "Case notification V{org_unit_name}", "notifyUsersInHierarchyOnly": false, "sendRepeatable": false, "notificationRecipient": "ORGANISATION_UNIT_CONTACT", "notifyParentOrganisationUnitOnly": false, "displayMessageTemplate": "Case notification A{h5FuguPFF2j}", "messageTemplate": "Case notification A{h5FuguPFF2j}", "deliveryChannels": [ "EMAIL" ] } | | keyHideMonthlyPeriods | 不 | json { "name": "Case notification", "notificationTrigger": "ENROLLMENT", "subjectTemplate": "Case notification V{org_unit_name}", "displaySubjectTemplate": "Case notification V{org_unit_name}", "notifyUsersInHierarchyOnly": false, "sendRepeatable": false, "notificationRecipient": "ORGANISATION_UNIT_CONTACT", "notifyParentOrganisationUnitOnly": false, "displayMessageTemplate": "Case notification A{h5FuguPFF2j}", "messageTemplate": "Case notification A{h5FuguPFF2j}", "deliveryChannels": [ "EMAIL" ] } | | 不 | keyGatherAnalyticalObjectStatisticsInDashboardViews | Program notification template | | 不 | keyCountPassiveDashboardViewsInUsageAnalytics | Program notification template | | 不 | keyDashboardContextMenuItemSwitchViewType | Program notification template | | 是的 | keyDashboardContextMenuItemOpenInRelevantApp | Program notification template | | 是的 | keyDashboardContextMenuItemShowInterpretationsAndDetails | Program notification template | | 是的 | keyDashboardContextMenuItemViewFullscreen | Program notification template |
是的¶
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
不
jobsCleanupAfterMinutes
A "run once" job is deleted when this amount of minutes has passed since it finished successful or unsuccessful
不
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
不
jobsLogDebugBelowSeconds
A job with an execution interval below this number of seconds logs its information on debug rather than info
不
keyParallelJobsInAnalyticsTableExport
Returns the number of parallel jobs to use for processing analytics tables. It takes priority over "keyDatabaseServerCpus". Default: -1
不
/ api / 33 / systemSettings / <my-key>?locale = <my-locale>&value = <my-translated-value>
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
| To send an email with an HTML body, you can simply provide the HTML content in the message parameter. The email client should interpret the HTML and render it accordingly. Note that the Content-Type header in the curl command should be application/x-www-form-urlencoded, as the data is sent as URL-encoded form data. The following example shows how to send an email with a simple HTML table: | 用户设置 { #webapi_user_settings } | Parameter name | |---|---|---| | 不 | 用户未设置的用户设置,将回退到等效的 系统设置。只返回用户明确设置的值, 您可以将 ?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 |
Database content locale.¶
keyAnalysisDisplayProperty
name | shortName
在分析应用项目中显示元数据的属性。
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
all | aggregate | tracker
Data element domain type to display in lists.
keyAutoSaveCaseEntryForm
false | true
Save case entry forms periodically.
| keyAutoSaveTrackedEntityForm | json { "object": { "publicAccess": "rw------", "externalAccess": false, "user": {}, "userAccesses": [], "userGroupAccesses": [ { "id": "hj0nnsVsPLU", "access": "rw------" }, { "id": "qMjBflJMOfB", "access": "r-------" } ] } } | |---|---| | 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 /配置 | | 数据输出周期类型 | 周期类型名称的 JSON 列表(如 "月度"、"季度"、"年度 "等) | | 您可以将 GET 和 POST 请求发送到以下特定 资源: | 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 |
Data element group ID
infrastructuralIndicators
Indicator group ID¶
infrastructuralPeriodType
Period type name (e.g. "Monthly")¶
selfRegistrationRole
User role ID
selfRegistrationOrgUnit
Organisation unit ID
| 指标组 | Parameter name |
|---|---|
| remoteServerUrl | URL to remote server |
| remoteServerUsername | Username for remote server authentication |
| remoteServerPassword | Password for remote server authentication |
corsAllowlist
JSON list of URLs¶
例如,要设置反馈接收者用户组,您可以调用 以下 curl 命令:
curl "localhost/api/33/configuration/feedbackRecipients" -d "wl5cDMuUhmF"
-H "Content-Type:text/plain"-u admin:district
代币 { #webapi_tokens }
| To send an email with an HTML body, you can simply provide the HTML content in the message parameter. The email client should interpret the HTML and render it accordingly. Note that the Content-Type header in the curl command should be application/x-www-form-urlencoded, as the data is sent as URL-encoded form data. The following example shows how to send an email with a simple HTML table: | Parameter name | |---|---| | 您可以使用以下命令检索 Google 服务帐户 OAuth 2.0 访问令牌 对以下资源的 GET 请求。 | GET /api/tokens/google | | 令牌将在一定时间内有效,之后 必须从此资源请求另一个令牌。响应 包含匹配令牌到期的缓存控制标头。这 响应将包含以下 JSON 格式的属性。 | Table: Token response |
Property
描述
access_token
The OAuth 2.0 access token to be used when authentication against Google services.
expires_in
The number of seconds until the access token expires, typically 3600 seconds (1 hour).
client_id
The Google service account client id.
- 假定已为DHIS2设置并配置了Google服务帐户。请查阅安装指南以获取更多信息。
静态内容 { #webapi_static_content }
-
staticContent 资源允许您上传和检索自定义 DHIS2 中使用的徽标。该资源允许用户上传带有 关联的密钥,稍后可以使用密钥检索。只有 PNG 文件受支持,只能上传到
logo_banner和logo_front键。/ api / 33 / staticContent
Table: Static content keys
键
描述
logo_banner
应用项目左侧顶部菜单中的徽标。¶
logo_front
Logo on the login-page above the login form.
要上传文件,请将带有 POST 请求的文件发送至:
-
POST / api / 33 / staticContent /
请求将logo.png上传到 logo_front键的示例: -
```bash 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
使用相同的密钥上传多个文件将覆盖现有的 文件。这样,检索任何给定键的文件只会返回 最新上传的文件。 - 要检索徽标,您可以*获取*以下内容: GET /api/33/staticContent/<key> ## Example of requests to retrieve the file stored for `logo_front`: 将“Accept: text/html”添加到 HTTP 标头。*__ 在这种情况下,如果未定义任何内容,端点将返回默认图像。找到自定义或默认图像时将返回图像流。 ```bash 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, 将提供默认徽标。