Stream: implementers
Topic: Trailing slash at resource endpoints
Ken Sinn (May 08 2020 at 19:10):
Hi all,
Wondering if there has been any general guidance on handling of trailing slashes at a FHIR resource endpoint.
"http://[base]/Practitioner/" -- is this considered:
1) bad syntax resulting in a 400 (unable to interpret intent of request)
2) missing resource id (assumes the intent was [base]/Practitioner/134 but id was left off)
3) 404 (similar to missing resource id)
4) some other behaviour?
Lloyd McKenzie (May 08 2020 at 19:15):
@Josh Mandel @Grahame Grieve
Ken Sinn (May 08 2020 at 19:21):
I believe the HAPI implementation drops the forward slash and interprets it as "[base]/Practitioner" i.e. a request for all resources at the endpoint. http://hapi.fhir.org/baseR4/Patient/
Grahame Grieve (May 08 2020 at 19:41):
so does test.fhir.org
Grahame Grieve (May 08 2020 at 19:41):
and I think it's the least unreasonable behavior
Vassil Peytchev (May 08 2020 at 20:02):
Should it be codified as required, or at least preferred behavior?
Grahame Grieve (May 08 2020 at 23:56):
yes it probably should be clarified
Lloyd McKenzie (May 08 2020 at 23:57):
Change request anyone? :)
Ken Sinn (May 11 2020 at 13:59):
I can create the CR. Is the guidance that a trailing forward slash should be dropped, and interpreted as above? Is the guidance that this is a preferred behaviour, rather than a Must?
Lloyd McKenzie (May 11 2020 at 19:37):
It's certainly preferred. I'm not sure we can make it SHALL anymore
Ken Sinn (May 11 2020 at 21:43):
Are there any conformance rules requiring a server return all Patient resources against an "http://hapi.fhir.org/baseR4/Patient" endpoint (or your insert your favourite resource)? I'm trying to scour through the HTTP and Search pages, and while that's the typical behaviour, i.e. a criteria-less search (as seen on many test servers), we would like to return an HTTP error, due to potential privacy concerns.
Michele Mottini (May 11 2020 at 21:45):
No, there is no such rule. Most 'real' servers reject those kind of requests
Ken Sinn (May 11 2020 at 21:56):
What is the typical error returned for such requests? 400 Bad request (poor syntax), 403 Forbidden, 405 Method Not Allowed, 422 Unprocessable Entity?
Grahame Grieve (May 12 2020 at 00:23):
I would recommend 422 - it's a business rule that you don't support a search like that
Ken Sinn (May 13 2020 at 18:22):
CR created - https://jira.hl7.org/browse/FHIR-27113
Could the expected behaviour of "http://[base]/[resourceType]" also be clarified, along with the recommendation of "422" as noted above for most production implementations? Should this be a separate CR, or appended as a comment to the CR above?
Last updated: Apr 12 2022 at 19:14 UTC