Add a composition to a folder via openEHR REST API

Since the Directory endpoint always updates the whole structure you simple put it in the Folder structure which represents the directory .

So call EHR API openEHR specs

with

{
  "_type": "FOLDER",
  "name": {
    "_type": "DV_TEXT",
    "value": "root"
  },
  "archetype_node_id": "openEHR-EHR-FOLDER.generic.v1",
  "folders": [
    {
      "_type": "FOLDER",
      "name": {
        "_type": "DV_TEXT",
        "value": "history"
      },
      "archetype_node_id": "openEHR-EHR-FOLDER.generic.v1",
      "folders": [
        {
          "_type": "FOLDER",
          "name": {
            "_type": "DV_TEXT",
            "value": "family"
          },
          "archetype_node_id": "openEHR-EHR-FOLDER.generic.v1",
          "items": [
            {
          		"id": {
          			"_type": "HIER_OBJECT_ID",
          			"value": "d936409e-901f-4994-8d33-ed104d46015b"
          		},
          		"namespace": "my.system.id",
          		"type": "VERSIONED_COMPOSITION"
          	}
          ]
        }
      ]
    }
  ]
}

see also https://github.com/ehrbase/integration-tests/blob/main/tests/robot/DIRECTORY_TESTS/UPDATE_DIRECTORY/H.1__EHR_with_directory.robot

2 Likes