FHIR Chat · Hl7.Fhir.Rest.FhirOperationException · implementers

Stream: implementers

Topic: Hl7.Fhir.Rest.FhirOperationException


view this post on Zulip Ali Mohammed Ebraheem (Jul 21 2020 at 19:49):

10:47 PM

Hello
I have a problem with REST API. When I use
var createdObservation = client.Create(observation);
I get an exception [Hl7.Fhir.Rest.FhirOperationException: 'Operation was unsuccessful because of a client error (Forbidden). Body has no content.']
I did not find any documentation about what might cause this problem.

view this post on Zulip Michele Mottini (Jul 21 2020 at 19:53):

The server you are connecting to is not accepting that request ('Forbidden') - possibly because it does not support creation, or due to permissions of the user you are using to connect

view this post on Zulip Ali Mohammed Ebraheem (Jul 22 2020 at 10:59):

It turned out that I need to add authentication in the header of the http request. I checked members of FhirClient and could not know how to do that. I use Aidbox as endpoint.

view this post on Zulip Michele Mottini (Jul 22 2020 at 12:40):

Use the the OnBeforeRequest event to pre-process each request, something like this:
private void BeforeRequest( object sender, FhirRest.BeforeRequestEventArgs e )
{
e.RawRequest.Headers[ HttpRequestHeader.Authorization ] = "Bearer " + _authorization.Token;
}

view this post on Zulip Paul S (Jun 13 2021 at 03:45):

We are already adding the Authorization Bearer in the headers of the FhirClient. Any suggestions? Thanks.


Last updated: Apr 12 2022 at 19:14 UTC