# Cannot Delete Deployment in REST API

**URL:** <https://forum.flowable.org/t/cannot-delete-deployment-in-rest-api/3625>\
**Category:** Flowable Engine\
**Created:** [March 25, 2019, 11:46am UTC](https://forum.flowable.org/t/cannot-delete-deployment-in-rest-api/3625 "2019-03-25T11:46:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bihan](https://avatars.discourse-cdn.com/v4/letter/b/4da419/32.png) [@Bihan](https://forum.flowable.org/u/Bihan)\
**Post date:** [March 25, 2019, 11:46am UTC](https://forum.flowable.org/t/cannot-delete-deployment-in-rest-api/3625/1 "2019-03-25T11:46:30Z")

</div>

I am going through flowable docs and testing REST API. Then when I tried to delete the deployment using  
curl -X DELETE --user rest-admin:test [http://localhost:8080/flowable-rest/service/repository/deployments/617f5c54-462d-11e9-97b9-68a86d35f4ac](http://localhost:8080/flowable-rest/service/repository/deployments/617f5c54-462d-11e9-97b9-68a86d35f4ac)

it gives ERROR as

{“message”:“Internal server error”,“exception”:"\n### Error updating database. Cause: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: “ACT\_FK\_EXE\_PROCDEF: PUBLIC.ACT\_RU\_EXECUTION FOREIGN KEY(PROC\_DEF\_ID\_) REFERENCES PUBLIC.ACT\_RE\_PROCDEF(ID\_) (‘holidayRequest:2:61ae5b96-462d-11e9-97b9-68a86d35f4ac’)”; SQL statement:\ndelete from ACT\_RE\_PROCDEF where DEPLOYMENT\_ID\_ = ? [23503-197]\n### The error may involve org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntityImpl.deleteProcessDefinitionsByDeploymentId-Inline\n### The error occurred while setting parameters\n### SQL: delete from ACT\_RE\_PROCDEF where DEPLOYMENT\_ID\_ = ?\n### Cause: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: “ACT\_FK\_EXE\_PROCDEF: PUBLIC.ACT\_RU\_EXECUTION FOREIGN KEY(PROC\_DEF\_ID\_) REFERENCES PUBLIC.ACT\_RE\_PROCDEF(ID\_) (‘holidayRequest:2:61ae5b96-462d-11e9-97b9-68a86d35f4ac’)”; SQL statement:\ndelete from ACT\_RE\_PROCDEF where DEPLOYMENT\_ID\_ = ? [23503-197]"}

However when i use get deployment command it works.

Note: I have not changed anything. Everything is as per the docs and example process model

---

<div class="post-metadata">

**Author:** ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)\
**Post date:** [March 25, 2019, 12:24pm UTC](https://forum.flowable.org/t/cannot-delete-deployment-in-rest-api/3625/2 "2019-03-25T12:24:02Z")

</div>

It seems that there is still process instance which points to this definition.

Martin

---

<div class="post-metadata">

**Author:** ![anujpandey](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@anujpandey](https://forum.flowable.org/u/anujpandey)\
**Post date:** [January 15, 2021, 11:21am UTC](https://forum.flowable.org/t/cannot-delete-deployment-in-rest-api/3625/3 "2021-01-15T11:21:19Z")

</div>

You are need to pass the cascade = true to delete all the foreign key references
