Search code examples
hl7-fhir

Cannot save a very simple fhir patient bundle


I am trying to save this very simple fhir patient bundle against https://vonk.fire.ly/Bundle, by doing a PUT using Postman, however I am not able to get it working. When I simply copy the inner Patient resource data and do a PUT directly to the https://vonk.fire.ly/Patient endpoint it works just fine (for example - I just did it to this url https://vonk.fire.ly/Patient/deb7338181).

Can someone please please point me in the direction of what exactly it is going wrong here in this bundle??

{
"resourceType": "Bundle",
"id": "b6ec685a-26a2-4bb3-814b-841fba6a6edb",
"meta": {
    "lastUpdated": "2018-05-29T23:45:32Z"
}
"type": "transaction",
"entry": [
    {
        "resource": {
            "resourceType": "Patient",
            "id": "deb73381811",
            "text": {
                "status": "generated",
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Some narrative</div>"
            },
            "active": true,
            "name": [
                {
                    "use": "official",
                    "family": "Chalmers1",
                    "given": [
                        "Peter1",
                        "James1"
                    ]
                }
            ],
            "gender": "male",
            "birthDate": "1974-12-25"
        },
        "request": {
            "method": "POST",
            "url": "Patient"
        }
    }
]
}

Solution

  • If you want to send a transaction to a FHIR server, you do a POST of the transaction Bundle to the endpoint, just like you mention in your comment. Within the transaction, for each entry you have to set the request part to the kind of request you want.

    For your Patient entry you have asked the server to do a POST, which means a create with a server assigned ID. If you want the server to use your own ID, you should instruct it to perform a PUT, which is usually an update, but can also be used for create with your own ID. The syntax for the update request is:

    "request": {
                "method": "PUT",
                "url": "Patient/<my_patient_id>"
               }
    

    Please note that although it is a valid FHIR request and Vonk allows it, not all servers will.