FHIR Chat · POST search, queryString vs formData · implementers

Stream: implementers

Topic: POST search, queryString vs formData


view this post on Zulip Muhammad Abubakar Ikram (May 17 2018 at 11:07):

In the following sections described that there is also a search endpoint using POST HTTP method.
1. https://www.hl7.org/fhir/http.html#search
2. https://www.hl7.org/fhir/search.html#2.21.1.2

the URL pattern for the POST search from the spec is
POST [base]/[type]/_search{?[parameters]{&_format=[mime-type]}}

In the detail, to this URL pattern, the following statements are written in the spec respective to the above-referred sections from the spec

1. "This has exactly the same semantics as the equivalent GET command. All these search interactions take a series of parameters that are a series of name=value pairs encoded in the URL (or as an application/x-www-form-urlencoded submission for a POST). (See W3C HTML forms )."

2. "For this RESTful search (see definition in RESTful API), the parameters are a series of name=[value] pairs encoded in the URL or as an application/x-www-form-urlencoded submission for a POST:"

In both the sections in URL pattern, we can see that there is a placeholder "[parameters]" for the query strings
And
Also in the detail of this endpoint, it is mentioned that parameters will be encoded in the URL or as an application/x-www-form-urlencoded submission for a POST.

My question is if we will define parameters in the querystring and also application/x-www-form-urlencoded parameters would be there then WHAT SHOULD HAPPEN?

should server merge both the parameters? (also handle duplication)
should server take only application/x-www-form-urlencoded parameters?

view this post on Zulip Michel Rutten (May 17 2018 at 11:43):

@Christiaan Knaap?

view this post on Zulip Christiaan Knaap (May 17 2018 at 11:47):

As it is not specified to exclude either of them, I think the server should accept all. And that is what Vonk does.

view this post on Zulip Lloyd McKenzie (May 17 2018 at 11:52):

@Muhammad Abubakar Can you raise a change request for us to clarify expectations on this?

view this post on Zulip Muhammad Abubakar Ikram (May 17 2018 at 11:54):

@Lloyd McKenzie sure.

view this post on Zulip Muhammad Abubakar Ikram (May 17 2018 at 12:01):

@Lloyd McKenzie here you go, https://gforge.hl7.org/gf/project/fhir/tracker/?action=TrackerItemEdit&tracker_item_id=17226

view this post on Zulip Lloyd McKenzie (May 17 2018 at 12:09):

Thanks

view this post on Zulip Muhammad Abubakar Ikram (May 17 2018 at 12:36):

What I would recommend and suggest that, as query strings are permitted in GET method and in POST method we can add form-urlencoded parameters then there is no point to have query strings parameter too on POST method.

view this post on Zulip Michael Donnelly (May 18 2018 at 07:48):

I agree strongly with @Muhammad Abubakar . The whole point of POST searches is not to have query parameters in the URL.

view this post on Zulip Grahame Grieve (May 18 2018 at 18:47):

there's forms that mix both. I always detest them.

view this post on Zulip Muhammad Abubakar Ikram (Nov 13 2018 at 09:07):

Which value should a server consider if there is an identical parameter but with different values in the URL and in the post body? what I could guess it would be better to consider the parameter in the post body.

view this post on Zulip Lloyd McKenzie (Nov 13 2018 at 10:17):

You're free to treat it as an error. If you pick one, be sure to declare what you actually used in the self link.

view this post on Zulip Yunwei Wang (Nov 13 2018 at 15:14):

I pick the POST body and ignores URL parameters

view this post on Zulip Brian Postlethwaite (Nov 13 2018 at 21:58):

You could just 'and' them as though they were repeated, which they are.
Observation?component-code=a&component-code=trial


Last updated: Apr 12 2022 at 19:14 UTC