# EHRBase 0.16.5 - Create EHR error while using Postman **Category:** [Platform](https://discourse.openehr.org/c/platform-implem/7) **Created:** 2021-05-19 05:52 UTC **Views:** 1106 **Replies:** 5 **URL:** https://discourse.openehr.org/t/ehrbase-0-16-5-create-ehr-error-while-using-postman/1562 --- ## Post #1 by @Dileep_V_S I am testing the latest dev branch. I have been able to successfully build and run the server. The http://localhost:8080/ehrbase/rest/openehr/v1/ehr works fine from the integrated swagger UI. However when i am testing this from postman, I get the following error > { > "error": "Message at /archetype_node_id (/other_details/archetype_node_id): Attribute archetype_node_id of class ITEM_TREE does not match existence 1..1\nMessage at /name (/other_details/name): Attribute name of class ITEM_TREE does not match existence 1..1\nMessage at /archetype_node_id (/archetype_node_id): Attribute archetype_node_id of class EHR_STATUS does not match existence 1..1\nMessage at /name (/name): Attribute name of class EHR_STATUS does not match existence 1..1\n", > "status": "Bad Request" > } Any idea what could be happening? If I change the subject.id.type to PersonID (from the default GENERIC_ID) I get the following error { "error": "Could not resolve type id 'PersonID' as a subtype of `com.nedap.archie.base.OpenEHRBase`: no such class found\n at [Source: (String)\"{\"_type\":\"EHR_STATUS\",\"subject\":{\"external_ref\":{\"id\":{\"_type\":\"PersonID\",\"value\":\"ins01\",\"scheme\":\"id_scheme\"},\"namespace\":\"ehr_craft\",\"type\":\"PERSON\"}},\"other_details\":{\"_type\":\"ITEM_TREE\",\"items\":[]},\"is_modifiable\":\"true\",\"is_queryable\":\"true\"}\"; line: 1, column: 153] (through reference chain: com.nedap.archie.rm.ehr.EhrStatus[\"subject\"]->com.nedap.archie.rm.generic.PartySelf[\"external_ref\"]->com.nedap.archie.rm.support.identification.PartyRef[\"id\"])", "status": "Bad Request" } Are there specific values allowed for subject.id.type? (and the other input fields?) regards --- ## Post #2 by @ian.mcnicoll Hi Dileep, Can you copy the body of the POST here ? --- ## Post #3 by @thomas.beale The RM type needs to be a PartySelf for EhrStatus.subject. I think you are supplying the wrong kind of id. See the [relevant part of the RM here](https://specifications.openehr.org/releases/RM/Release-1.1.0/common.html#_overview_3). Note, in the REST API the fields of these types are not always exactly as you see in the RM. --- ## Post #4 by @Dileep_V_S This is the POST body that I used. I took it from the Swagger { "_type": "EHR_STATUS", "subject": { "external_ref": { "id": { "_type": "GENERIC_ID", "value": "ins01", "scheme": "id_scheme" }, "namespace": "ehr_craft", "type": "PERSON" } }, "other_details": { "_type": "ITEM_TREE", "items": [] }, "is_modifiable": "true", "is_queryable": "true" } --- ## Post #5 by @Dileep_V_S I am able to create EHR successfully using this example from the openEHR REST APi specs. ``` { "_type": "EHR_STATUS", "archetype_node_id": "openEHR-EHR-EHR_STATUS.generic.v1", "name": { "value": "EHR Status" }, "subject": { "external_ref": { "id": { "_type": "GENERIC_ID", "value": "ins01", "scheme": "id_scheme" }, "namespace": "examples", "type": "PERSON" } }, "is_modifiable": true, "is_queryable": true } ``` ``` But if I change the subject.id.type to something other than GENERIC_ID it fails with the following error ``` ``` BODY { "_type": "EHR_STATUS", "archetype_node_id": "openEHR-EHR-EHR_STATUS.generic.v1", "name": { "value": "EHR Status" }, "subject": { "external_ref": { "id": { "_type": "PERSON ID", "value": "333", "scheme": "personUuid" }, "namespace": "examples", "type": "PERSON" } }, "is_modifiable": true, "is_queryable": true } ``` ``` Result ``` { "error": "Could not resolve type id 'PERSON ID' as a subtype of `com.nedap.archie.base.OpenEHRBase`: no such class found\n at [Source: (String)\"{\"_type\":\"EHR_STATUS\",\"archetype_node_id\":\"openEHR-EHR-EHR_STATUS.generic.v1\",\"name\":{\"value\":\"EHR Status\"},\"subject\":{\"external_ref\":{\"id\":{\"_type\":\"PERSON ID\",\"value\":\"333\",\"scheme\":\"personUuid\"},\"namespace\":\"examples\",\"type\":\"PERSON\"}},\"is_modifiable\":true,\"is_queryable\":true}\"; line: 1, column: 238] (through reference chain: com.nedap.archie.rm.ehr.EhrStatus[\"subject\"]->com.nedap.archie.rm.generic.PartySelf[\"external_ref\"]->com.nedap.archie.rm.support.identification.PartyRef[\"id\"])", "status": "Bad Request" } So is there any constraint on subject.id.type? `` ``` regards ``` --- ## Post #6 by @ian.mcnicoll Hi Dileep, This has to be a specific RM class inherited from OBJECT_Id so GENERIC_ID works or subject: { external_ref: { id: { _type: "HIER_OBJECT_ID", value: '{{subjectId}}', }, namespace: 'examples', type: "PERSON" } } see https://specifications.openehr.org/releases/UML/latest/index.html#Diagrams___18_1_83e026d_1423749516683_383618_4776 --- **Canonical:** https://discourse.openehr.org/t/ehrbase-0-16-5-create-ehr-error-while-using-postman/1562 **Original content:** https://discourse.openehr.org/t/ehrbase-0-16-5-create-ehr-error-while-using-postman/1562