Stream: implementers
Topic: Logical ids
Brian Reinhold (Jun 04 2019 at 18:35):
I have just been confused by a simple logical id based search. When I use getId() on a resource in HAPI FHIR I get
http://hapi.ehealthinnovation.org:8080/hapi-fhir-jpaserver/fhir/Patient/4/_history/1
where I expected
4/_history/1
Can one use the full URL in a search?
Observation?subject=http://hapi.ehealthinnovation.org:8080/hapi-fhir-jpaserver/fhir/Patient/4/_history/1
I would think not but I am a little at a loss as to why HAPI FHIR gives me the full URL.
Lloyd McKenzie (Jun 04 2019 at 18:45):
@James Agnew?
James Agnew (Jun 05 2019 at 15:12):
You can use the full URL if the server is configured to allow it- By default HAPI disables this.
You're probably looking for:
patient.getIdElement().getIdPart()
if you specifically want the string "4"
from your example above.
Brian Reinhold (Jun 05 2019 at 15:13):
You can use the full URL if the server is configured to allow it- By default HAPI disables this.
You're probably looking for:
patient.getIdElement().getIdPart()
if you specifically want the string"4"
from your example above.
As I recall the getIdElement() gave me null. I will check that again.
James Agnew (Jun 05 2019 at 15:14):
That method will never return null, it does a create-on-request if there is no value there.
Brian Reinhold (Jun 05 2019 at 15:15):
That method will never return null, it does a create-on-request if there is no value there.
Interesting ... could be a lousy debugger. I will check again because I do recall using that on the upload side.
Last updated: Apr 12 2022 at 19:14 UTC