Stream: implementers
Topic: FullUrl for "PUT" in Transaction
emilio (Jan 30 2018 at 18:24):
In the REST API documentation, in the section about transactions and FullUrls it says that:
"For updates, the server performs a mapping between the fullUrl specified and the local URL the server knows that instance as, if possible. If the server does not have a mapping for the fullUrl, the server ignores the base URL and attempts an update assuming the base is the same as the server base. "
I can't understand what it means.
Could someone please explain it?
source: https://www.hl7.org/fhir/http.html#2.21.0.17.2
Lloyd McKenzie (Jan 30 2018 at 20:52):
@Ewout Kramer
Christiaan Knaap (Jan 31 2018 at 12:56):
Let's say you send a Transaction bundle to server http://fhirserver.com, containing an entry for an update on Patient/123. You may expect that the fullUrl of it has to be http://fhirserver.com/Patient/123. The first line says that the server will try to map this fullUrl to it's own location of Patient/123, and in this case they match perfectly.
But if you want to send this same Transaction to another server - http://differentfhirserver.com - you'd have to adjust the Transaction bundle first: change the fullUrl of the update to http://differentfhirserver.com/Patient/123, so with the base of the other server.
This is inconvenient. Therefore the second line says that the other server is allowed to ignore the base altogether and thus interpret the original 'http://fhirserver.com/Patient/123 as a relative link to it's own Patient/123 endpoint.
Hopefully now the last line of that paragraph makes sense to you: "This allows the same transaction bundle to be sent to multiple systems without changing the fullUrls for each target."
Note that the fullUrl is not used to determine which resource to update. The resource.entry.url is used for that, and that is supposed to be relative, so it does not have this problem.
The fullUrl can be understood as the location of the resource after performing the request in the entry. As such you can use it in other entries to reference to the result of the request. Because the server may assign a new id, it will keep a map internally from the fullUrl you specified to the actual location of the resource after processing the request. And use that map for resolving subsequent references in other entries in the bundle.
But altogether I think this paragraph can be simpler: Since the server is allowed to ignore the base of the fullUrl, it may as well always do so (in the context of a PUT request entry).
emilio (Jan 31 2018 at 17:23):
@Christiaan Knaap thank you!
emilio (Jan 31 2018 at 17:32):
@Christiaan Knaap Antoher question about this. You wrote that:
"Because the server may assign a new id, it will keep a map internally from the fullUrl you specified to the actual location of the resource after processing the request. And use that map for resolving subsequent references in other entries in the bundle."
So, do I have to check all the references
in all the entries and, if it has a corresponding value on my internal map, replace it before saving it?
And, can these replacing values in the map be relative? Or do they have to have the fullUrl format?
cc @Grahame Grieve @Lloyd McKenzie
Christiaan Knaap (Jan 31 2018 at 21:12):
Yes, you have to replace the references, otherwise you won't be able to resolve them afterwards. We return the references as absolute urls, so you can follow them as they are. But that does not neccessarily mean you have to store them that way.
Last updated: Apr 12 2022 at 19:14 UTC