_search with Content-Type: application/x-www-form-urlencoded

105 views
Skip to first unread message

Andrew Guselnikov

unread,
Sep 14, 2022, 3:10:02 AM9/14/22
to HAPI FHIR
Hello, 

I'm stuck with the following case. 
I'm trying to search for Patients with help of POST request


POST [Base]/Patient/_search
Content-Type: application/x-www-form-urlencoded
Request Body
  1.  name: "Lara"
As a result I'm getting all possible patients. Seems like parameters in request body are just ignored. 

Btw when these parameters are used in the URL POST [Base]/Patient/_search?name=Lara - correct result is returned.

Kevin Dougan

unread,
Sep 14, 2022, 8:49:34 AM9/14/22
to HAPI FHIR
There are many search examples here and most use GET requests:

This GET request works for me and returns 38 results:

Is there any reason why you cannot use a GET request?

Thanks,
Kevin

Andrew Guselnikov

unread,
Sep 14, 2022, 9:03:11 AM9/14/22
to HAPI FHIR
I could not expose search parameters as URL params and found that spec allows to use POST with  seach params as a body and a  Content-Type: application/x-www-form-urlencoded 


but when using HAPI  results were as I described in my initial post

среда, 14 сентября 2022 г. в 15:49:34 UTC+3, kevin....@smilecdr.com:

Kevin Dougan

unread,
Sep 14, 2022, 9:11:18 AM9/14/22
to HAPI FHIR
OK, in that case, I have used this POST Request and it also returns 38 results:

HEADER:
Content-Type: application/x-www-form-urlencoded
BODY:
name=Peter

I have not tried this on a HAPI-FHIR Server though...
Kevin

Andrew Guselnikov

unread,
Sep 14, 2022, 11:11:32 AM9/14/22
to HAPI FHIR
Thank you Kevin.

Possibly this is because of my version of HAPI  - I'm using 5.4. Will try on the latest one. 

Thanks,
Andrew

среда, 14 сентября 2022 г. в 16:11:18 UTC+3, kevin....@smilecdr.com:
Reply all
Reply to author
Forward
0 new messages