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.
|logo_banner||Logo in the application top menu on the left side.|
|logo_front||Logo on the login-page above the login form.|
To upload a file, send the file with a POST request to:
Example request to upload logo.png to the logo_front key:
curl -F "firstname.lastname@example.org;type=image/png" "https://play.dhis2.org/demo/api/26/staticContent/logo_front" -X POST -H "Content-Type: multipart/form-data" -u admin:district -v
Uploading multiple files with the same key will overwrite the existing file. This way, retrieving a file for any given key will only return the latest file uploaded.
To retrieve a logo, you can GET the following:
Example request to retrieve the file stored for logo_front:
curl "https://play.dhis2.org/demo/api/26/staticContent/logo_front" -L -X GET -u admin:district -v
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.