1.74 UI customization

To customize the UI of the DHIS2 application you can insert custom JavaScript and CSS styles through the files resource. 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:

1.74.1 Javascript

To insert Javascript from a file called script.js you can interact with the files/script resource with a POST-request:

curl --data-binary @script.js "localhost/api/26/files/script"
  -H "Content-Type:application/javascript" -u admin:district -v

Note that we use the –data-binary option to preserve formatting of the file content. You can fetch the JavaScript content with a GET-request:

/api/26/files/script

To remove the JavaScript content you can use a DELETE-request.

1.74.2 CSS

To insert CSS from a file called style.css you can interact with the files/style resource with a POST-request:

curl --data-binary @style.css "localhost/api/26/files/style"
  -H "Content-Type:text/css" -u admin:district -v

You can fetch the CSS content with a GET-request:

/api/26/files/style

To remove the JavaScript content you can use a DELETE-e "request.