# REST: POST EHR directory twice, what happens?

**URL:** https://discourse.openehr.org/t/rest-post-ehr-directory-twice-what-happens/432
**Category:** ITS
**Tags:** rest-apis
**Created:** [9 March 2020 06:12 UTC](https://discourse.openehr.org/t/rest-post-ehr-directory-twice-what-happens/432 "2020-03-09T06:12:39Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![matijap](https://discourse.openehr.org/user_avatar/discourse.openehr.org/matijap/32/233_2.png) [@matijap](https://discourse.openehr.org/u/matijap)
#### Post date: [9 March 2020 06:12 UTC](https://discourse.openehr.org/t/rest-post-ehr-directory-twice-what-happens/432/1 "2020-03-09T06:12:39Z")

</div>

What should happen in the EHR directory is created (POST) twice? PUT is used for updates and requires `If-Match` to prevent conflicting concurrent updates. POST should probably return 409 Conflict if EHR already has a directory?

[https://specifications.openehr.org/releases/ITS-REST/latest/ehr.html#directory-directory-post](https://specifications.openehr.org/releases/ITS-REST/latest/ehr.html#directory-directory-post)

---

<div class="post-metadata">

### Author: ![sebastian.iancu](https://discourse.openehr.org/user_avatar/discourse.openehr.org/sebastian.iancu/32/31_2.png) [@sebastian.iancu](https://discourse.openehr.org/u/sebastian.iancu)
#### Post date: [9 March 2020 15:54 UTC](https://discourse.openehr.org/t/rest-post-ehr-directory-twice-what-happens/432/2 "2020-03-09T15:54:05Z")

</div>

Yes, I think you are right

---

<div class="post-metadata">

### Author: ![matijap](https://discourse.openehr.org/user_avatar/discourse.openehr.org/matijap/32/233_2.png) [@matijap](https://discourse.openehr.org/u/matijap)
#### Post date: [11 March 2020 12:23 UTC](https://discourse.openehr.org/t/rest-post-ehr-directory-twice-what-happens/432/3 "2020-03-11T12:23:09Z")

</div>

I filed an issue for that: [https://openehr.atlassian.net/projects/SPECITS/issues/SPECITS-44](https://openehr.atlassian.net/projects/SPECITS/issues/SPECITS-44)

I set fixVersion to 1.1.0, although this is actually more of a “bug fix”, so if there ever is a 1.0.2 version released, it should go there.

---

<div class="post-metadata">

### Author: ![birger.haarbrandt](https://discourse.openehr.org/user_avatar/discourse.openehr.org/birger.haarbrandt/32/24_2.png) [@birger.haarbrandt](https://discourse.openehr.org/u/birger.haarbrandt)
#### Post date: [3 August 2020 10:00 UTC](https://discourse.openehr.org/t/rest-post-ehr-directory-twice-what-happens/432/4 "2020-08-03T10:00:31Z")

</div>

A bit late to the party here, but we independently did this exactly as described (409 Conflict) in EHRbase.
