FHIR Chat · URL encoding search modifiers in AWS · implementers

Stream: implementers

Topic: URL encoding search modifiers in AWS


view this post on Zulip John Carter (Jan 03 2018 at 23:26):

We are experiencing a problem using AWS API Gateway and the FHIR standard for search modifiers. We are trying to support the 'exact' and 'contains' modifiers for string search terms. So, we want to be able to search in the following way:

http://fhir.example.com/ParactitionerRole?practitioner.family:exact=smith

However, the colon character between the parameter and the modifier is giving us problems and seems not to be supported by the AWS API Gateway that we are using to serve our API.

Has anyone else come across this issue?

view this post on Zulip Max Tuzzolino (Jan 04 2018 at 00:46):

This is us trying to meet the requirements of string-based search as defined here: https://www.hl7.org/fhir/search.html#string
There is no problem with the default prefix based search behaviour. Rather the problem arises when introducing the colons for search modifiers.

Some further information is that Amazon has got back to us saying that colons are not permitted under a query parameter name due to it being a reserved character as per https://tools.ietf.org/html/rfc3986#section-2.2

There is no problem putting a colon in the value of a query parameter, rather it's a problem with having them as a part of the query parameter name itself.

Example for valid/invalid query param names for AWS API Gateway:
practitioner.given --> VALID
practitioner.given:exact --> INVALID
practitioner.given:contains --> INVALID

view this post on Zulip Lloyd McKenzie (Jan 04 2018 at 01:48):

You'll need to escape them - all URL characters in the search portion of the string need to be escaped when necessary. So for ":", you'll need to use %3A

view this post on Zulip Max Tuzzolino (Jan 04 2018 at 01:59):

Is anyone doing this through exposing their API through AWS API Gateway?

Since you have to explicitly tell the gateway which parameters you are expecting, it complains upon entry:

This happens with both : and %3A because colons and percentages are not valid characters.
It's looking like something we need to bring back to Amazon.

image.png

view this post on Zulip Grahame Grieve (Jan 04 2018 at 07:26):

my read of that section (again) is that percent encoding is ok. I don't know where it says that parameters are URL components or subcomponents that can't contain ":" ("URI producing applications should percent-encode data octets that correspond to characters in the reserved set unless these characters are specifically allowed by the URI scheme to represent data in that component")


Last updated: Apr 12 2022 at 19:14 UTC