FHIR Chat · Conditional PUT not working · hapi

Stream: hapi

Topic: Conditional PUT not working


view this post on Zulip Dexter (Jul 05 2021 at 04:51):

My apologies, I created this thread in implementers without checking.

How do I specify resource ID in PUT request of a bundle?

{
    "resourceType": "Bundle",
    "type": "transaction",
    "entry": [
        {
            "resource": {
                "resourceType": "Group",
                "id": "4812",
                // other fields
            },
            "request": {
                "method": "PUT",
                "url": "Group?identifier=3.5"
            }
        }
    ]
}

But this updates the resource which has the identifier3.5 (4809). My intention is up update 4812 when there's no other resource that has the identifier 3.5.

I expected this to have happened

One Match, resource id provided but does not match resource found:
The server returns a 400 Bad Request error indicating the client id specification was a problem preferably with an OperationOutcome

I just noticed that normal PUT request doesn't work too. GET to /Group?identifier=3.5 returns 1 resource with ID 4809.

I'm trying to update resource 4812 only if there's no other resource with identifier 3.5.

PUT to /Group?identifier=3.5 updates 4809, even though a group with that identifier exists (4809)

Body is

{
    "resourceType": "Group",
    "id": "4812",
    // other fields
}

view this post on Zulip Dexter (Jul 05 2021 at 13:26):

This fails too, conditional PATCH.

{
    "resourceType": "Bundle",
    "type": "transaction",
    "entry": [
        {
            "fullUrl": "urn:uuid:ad46ecad-dd94-11eb-af49-e0946771098e",
            "resource": {
                "resourceType": "Patient",
                // patient info
            },
            "request": {
                "method": "POST",
                "ifNoneExist": "telecom=testuser@gmail.com"
            }
        },
        {
            "resource": {
                "resourceType": "CareTeam",
                "identifier": [
                    {
                        "value": "CT33426163",
                        "system": "EXSYS"
                    }
                ],
                "subject": {
                    "reference": "urn:uuid:ad46ecad-dd94-11eb-af49-e0946771098e",
                    "type": "Patient"
                },
                // other data
            },
            "request": {
                "method": "POST",
                "ifNoneExist": "subject.telecom=testuser@gmail.com"
            }
        }
    ]
}
"Failed to call access method: org.springframework.dao.InvalidDataAccessApiUsageException:
 Invalid match URL format (must match "[resourceType]?[params]");
nested exception is java.lang.IllegalArgumentException:
Invalid match URL format (must match "[resourceType]?[params]")"

I'm facing this issue on all query parameters that use conditionals in all transactions. This is causing all major endpoints on our API to fail, what do I do?

view this post on Zulip Dexter (Jul 06 2021 at 06:33):

Kindly help, thanks :)

view this post on Zulip Mirjam Baltus (Jul 07 2021 at 13:54):

You say 'conditional PATCH', but your http verb is POST. In your request, the 'ifNoneExist' is can be used on a POST (not PUT or PATCH), so maybe you actually meant to do a conditional POST. But you do not have a url listed, which the server will need to check for the type you want to create.


Last updated: Apr 12 2022 at 19:14 UTC