FHIR Chat · STU2 Client - Return Resource after create · dotnet

Stream: dotnet

Topic: STU2 Client - Return Resource after create


view this post on Zulip Harald Sømnes Hanssen (Sep 06 2016 at 08:58):

I'm wondering if the DSTU2 core client version 0.90.6.26409 can receive an object from the FHIR server, other than the resource type the client originally sent. The reason why we want to receive a different resource type is to get an Id and perhaps some other information which can be used to retrieve the data which was created, at a later point in time.

If we on the client side write something like this:
var returns = _client.Create(communicationRequest);

and on the fhir server replies with this where result is a resource type of Communication,

return new FhirResponse(HttpStatusCode.Created, result);

The client will however automatically respond with an nullpointer exception.
If we look at the rest response, the reply from the server is correct, but the client can't handle a response other than the type it expects.

Is this intended?

view this post on Zulip Grahame Grieve (Sep 06 2016 at 20:14):

so the server responds to a create with a non-standard response?

view this post on Zulip Harald Sømnes Hanssen (Sep 07 2016 at 07:43):

Should probably have clarified what happens on the client side a bit better.

When the client receives the response from the server, where the server has put a different resource object in the response compared to the request from the client, the client will cast an nullpointer exception. Is this intended?

view this post on Zulip Brian Postlethwaite (Sep 07 2016 at 07:50):

The server wouldn't be FHIR conformant if it did that.

view this post on Zulip Mirjam Baltus (Sep 07 2016 at 07:50):

If you perform a Create of a CommunicationRequest, the data created on the server should be that CommunicationRequest resource. So any result you would get is either the created resource, or no body (if your Prefer header was set to minimal). In this last case, the API will set your returns variable to null.

view this post on Zulip Mirjam Baltus (Sep 07 2016 at 07:51):

You can check _client.LastResult to see what the response was: an error, success, upon success the Location of the newly created resource.

view this post on Zulip Mirjam Baltus (Sep 07 2016 at 07:53):

If you need your server to send back a Communication resource when your client sends a CommunicationRequest, you should implement an operation to do so, to be FHIR/REST compliant.

view this post on Zulip Brian Postlethwaite (Sep 07 2016 at 07:59):

+1 on that.
http://hl7.org/fhir/dstu2/http.html#2.1.0.5.2
Is where the return results are specified, and it is expected to be the resource that was created/updated.
The note that says may be different to the client sent refers to that the server may update it from what the client sent for several reasons (like security or other local processing) but specifically the meta tags for the version id and update date will definitely but updated.

view this post on Zulip Harald Sømnes Hanssen (Sep 07 2016 at 08:27):

Your help is much appreciated. I think I have enough to get things along :)

view this post on Zulip Brian Postlethwaite (Sep 07 2016 at 09:45):

:)


Last updated: Apr 12 2022 at 19:14 UTC