FHIR Chat · Ampersand in values · implementers

Stream: implementers

Topic: Ampersand in values


view this post on Zulip Karol Trojan (Aug 10 2017 at 12:40):

I would like to get an example of a FHIR search query with and ampersand in value and a sort specified. The exact resource of this sample query does not matter to me, I just want to know what kind of input I should expect if I would like to implement the standard. A perfect example would include 2 search fields, like patient firstname Al&Ewa and Lastname Lost sorted first by Lastname and then Firstname

view this post on Zulip Michel Rutten (Aug 10 2017 at 13:15):

Url parameters values should be url-encoded. Ampersand characters are encoded as %26.

view this post on Zulip frank cao (Jan 11 2019 at 21:02):

Is encoding necessary or can I just escape it as explained in https://www.hl7.org/fhir/search.html#escaping? If I just escape it by adding a backward slash in front of it, would that work?

view this post on Zulip Lloyd McKenzie (Jan 11 2019 at 21:10):

& isn't a special character. The 'special' rules are to allow embedding of certain characters that FHIR uses within search strings. & isn't one of those - we just use the default HTTP behavior there, which means that if it needs to be escaped, you use the HTTP escaping mechanism.

view this post on Zulip Ken Sinn (Jan 11 2019 at 21:45):

Consider the query http://abc.org/Organization?name=jack&jill&customparam=bestintown!
How does a server know to parse the parameters as:
parameter 1: "name"="jack&jill" and parameter 2: "customparam"="bestintown!"
as opposed to
parameter1: "name"="jack" and parameter 2: "jill" is a badly-formed parameter-value pair?

view this post on Zulip Michele Mottini (Jan 11 2019 at 21:50):

For the first case the & should be URL-encoded

view this post on Zulip Michele Mottini (Jan 11 2019 at 21:51):

normal HTTP rules


Last updated: Apr 12 2022 at 19:14 UTC