FHIR Chat · fhir-net-api · implementers

Stream: implementers

Topic: fhir-net-api


view this post on Zulip Muhammad Abubakar Ikram (Mar 29 2017 at 11:47):

I am using fhir-net-api STU3. I am simply returning a CapabilityStatement object from an api action method like this

    public IActionResult MetaData()
    {
        CapabilityStatement capabilityStatement = new CapabilityStatement();
        CapabilityStatement.SoftwareComponent softwareComponent = new CapabilityStatement.SoftwareComponent();
        softwareComponent.Name = "Test Fhir Server";
        capabilityStatement.Software = softwareComponent;

        return Ok(capabilityStatement);
    }

It is fairly returning json response if I set (_format=json) in url but it gives error “406 Not Acceptable” if I set xml in url.

If I use any simple object say list of strings then it is returning both xml and json.

I don’t know how to resolve it.

I shall be very thankful for the help

view this post on Zulip Lloyd McKenzie (Mar 29 2017 at 14:13):

There are a bunch of required elements you're missing (status, date, fhirVersion, etc.) Why the API is happy in JSON but not in XML is a bit weird though. @James Agnew ?

view this post on Zulip Igor Sirkovich (Mar 29 2017 at 14:27):

I believe the question is about .Net rather than HAPI. Maybe @Brian Postlethwaite can help with this question? @Muhammad Abubakar, please note that there is a "dotnet" stream dedicated to FHIR .Net implementations.

view this post on Zulip Muhammad Abubakar Ikram (Mar 29 2017 at 14:38):

@Igor Sirkovich I searched that but I didn'nt found that stream kindly put the link I'll post there.
The problem is that other objects are returning response in both json and xml problem is only with fhir resources that are in fhir net api stu3

@Lloyd McKenzie I'll look into that

view this post on Zulip Brian Postlethwaite (Mar 29 2017 at 20:12):

IActionResult is from MVC right?
The fhir-net-api is does not work with the default .net serializers, you need to use the fhir serializers provided in the library.
Servers like Spark and my sqlonfhir server use WebApi instead of MVC.
http://stackoverflow.com/questions/40242939/custom-async-mediatypeformatter-returning-cannot-access-a-closed-stream/40838823?noredirect=1#comment69332848_40838823
There is also https://github.com/furore-fhir/spark/tree/dstu2/develop which is a DSTU2 implementation, and there is a NuGet package https://www.nuget.org/packages?q=Spark.Engine which has the infrastructure parts of this in it.

view this post on Zulip Muhammad Abubakar Ikram (Mar 30 2017 at 05:42):

Oh alright. Sqlonfhir is open source?

view this post on Zulip Brian Postlethwaite (Mar 30 2017 at 05:52):

Spark is (reference to Github project above), sqlonfhir isn't


Last updated: Apr 12 2022 at 19:14 UTC