# How to delete templates? **Category:** [Community](https://discourse.openehr.org/c/community/10) **Created:** 2024-12-17 17:46 UTC **Views:** 220 **Replies:** 10 **URL:** https://discourse.openehr.org/t/how-to-delete-templates/6045 --- ## Post #1 by @Btalex99 Following the guide, I uploaded a template to my local server. Now I would like to delete it but I can't find the delete on the Restapi. --- ## Post #2 by @ian.mcnicoll It on the admin ali https://docs.ehrbase.org/api/hip-ehrbase/admin --- ## Post #3 by @birger.haarbrandt Please see https://docs.ehrbase.org/api/hip-ehrbase/admin#tag/Template/operation/deleteTemplate Be aware that you need to enable the Admin API. Please see https://github.com/ehrbase/ehrbase/blob/develop/configuration/src/main/resources/application.yml for available parameters. Please see also https://discourse.openehr.org/t/list-of-available-override-the-application-properties-like-database-settings-in-ehrbase/1580 how to overwrite configurations when using Docker. --- ## Post #4 by @Btalex99 Thank you for the clarification. I am using Docker, where can I find the application.yml file? I apologize in advance for the basic questions, but I am still inexperienced. --- ## Post #5 by @ian.mcnicoll of note here in the config you see ``` template: # Allows to override templates using POST allow-overwrite: false ``` We routinely set this to `true` in non-production settings to more easily delete and overwrite templates in development. If you are using Docker-compose, you can setup a .env file in the same folder which will overwrite the default settings ``` SERVER_NODENAME=freshehr.ehrbase.org SYSTEM_ALLOW_TEMPLATE_OVERWRITE=true ADMINAPI_ACTIVE=true ``` --- ## Post #6 by @Btalex99 I can't find the application.yml file, so I don't understand which folder I should put the .env file in. What can I do? Thanks in advance. --- ## Post #7 by @ian.mcnicoll Hi Alex, You cannot access the application.yml file directly as it lives inside the Docker container, but you can override some of the settings via Environment variables. To do this create a file called .env.ehrbase alin the same folder as the docker-compose.yml file and add these items (our preference) - you can change the SERVER_NODENAME you whatever you prefer. ``` SERVER_NODENAME=ehrbase.freshehr.com SECURITY_AUTHTYPE=BASIC SECURITY_AUTHUSER=ehrbase-user SECURITY_AUTHPASSWORD=SuperSecretPassword SECURITY_AUTHADMINUSER=ehrbase-admin SECURITY_AUTHADMINPASSWORD=EvenMoreSecretPassword SECURITY_OAUTH2USERROLE=USER SECURITY_OAUTH2ADMINROLE=ADMIN SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUERURI= MANAGEMENT_ENDPOINTS_WEB_EXPOSURE=env,health,info,metrics,prometheus MANAGEMENT_ENDPOINTS_WEB_BASEPATH=/management MANAGEMENT_ENDPOINT_ENV_ENABLED=false MANAGEMENT_ENDPOINT_HEALTH_ENABLED=false MANAGEMENT_ENDPOINT_HEALTH_DATASOURCE_ENABLED=false MANAGEMENT_ENDPOINT_INFO_ENABLED=false MANAGEMENT_ENDPOINT_METRICS_ENABLED=false MANAGEMENT_ENDPOINT_PROMETHEUS_ENABLED=false MANAGEMENT_ENDPOINT_HEALTH_PROBES_ENABLED=false SYSTEM_ALLOW_TEMPLATE_OVERWRITE=true ADMINAPI_ACTIVE=true ``` If you look at the Ddocker-compose .yml file you will see that it contains the lines ``` env_file: - .env.ehrbase ``` This is what tells the Docker container where to find your environment variables. --- ## Post #8 by @Btalex99 Where can I find the folder of the 'docker-compose.yml' file? --- ## Post #9 by @ian.mcnicoll The easiest way to do this is to clone the ehrbase git repository locally. Yiu will see the docker compose file in the root folder. The env file need to be in the same folder. --- ## Post #10 by @Btalex99 I managed to enable admin permissions, but I saw that in the APIs I should enter an {adminApiUrlPath}, but I can't figure out what it is curl -X DELETE "[http://localhost:8080/ehrbase/rest/openehr/v1/ehr/8849182c-82ad-4088-a07f-48ead4180515"](http://localhost:8080/ehrbase/rest/openehr/v1/ehr/8849182c-82ad-4088-a07f-48ead4180515%22) \ -H "Prefer: return=representation" (base) alessandrodimatteo@MacBook-Pro-di-alessandro-5 ~ % curl -X POST "[http://localhost:8080/ehrbase/rest/openehr/v1/ehr"](http://localhost:8080/ehrbase/rest/openehr/v1/ehr%22) \ -H "Content-Type: application/json" \ -H "Prefer: return=representation" \ -d '{ "archetype_node_id": "openEHR-EHR-EHR_STATUS.generic.v1", "name": { "value": "EHR status" }, "uid": { "_type": "OBJECT_VERSION_ID", "value": "8849182c-82ad-4088-a07f-48ead4180515::openEHRSys.example.com::1" }, "subject": { "_type": "PARTY_SELF" }, "is_queryable": true, "is_modifiable": true, "_type": "EHR_STATUS" }' | jq . As example i insert this EHR, and now, i don't know the correct delete request i tried this request: curl -X DELETE "[http://localhost:8080/ehrbase/rest/openehr/v1/ehr/13b5ac2c-cd6e-415d-bac6-29b60c2776a7"](http://localhost:8080/ehrbase/rest/openehr/v1/ehr/13b5ac2c-cd6e-415d-bac6-29b60c2776a7%22) {"error":"Method Not Allowed","message":"Request method 'DELETE' is not supported"} but it returns this message every time, what it the mistake? As example i insert this EHR, and now, i don't know the correct delete request i tried this request: curl -X DELETE "[http://localhost:8080/ehrbase/rest/openehr/v1/ehr/13b5ac2c-cd6e-415d-bac6-29b60c2776a7"](http://localhost:8080/ehrbase/rest/openehr/v1/ehr/13b5ac2c-cd6e-415d-bac6-29b60c2776a7%22) {"error":"Method Not Allowed","message":"Request method 'DELETE' is not supported"} but it returns this message every time, what it the mistake? specifically, i don't understand what is the https://{ehrbaseUrl}/{adminApiUrlPath}/ehr/{ehr_id} {adminAPiUrlPath} that I shell use --- ## Post #11 by @vidi42 The EHR delete is only an admin function in EHRbase. If you have `ADMINAPI_ACTIVE=true` as @ian.mcnicoll suggested, then you will find the admin REST API at the default context `/rest/admin` So you're delete cURL should look something like this: ``` curl --request DELETE \ --url http://localhost:8080/ehrbase/rest/admin/ehr/8849182c-82ad-4088-a07f-48ead4180515 \ --header 'accept: application/json' ``` --- **Canonical:** https://discourse.openehr.org/t/how-to-delete-templates/6045 **Original content:** https://discourse.openehr.org/t/how-to-delete-templates/6045