Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Status 417: Expectation Failed Returned when using no parameters or _revinclude/_include #18

Open
LaMMMy opened this issue Dec 21, 2018 · 6 comments
Assignees

Comments

@LaMMMy
Copy link

LaMMMy commented Dec 21, 2018

When calling a GET to [Base]/Organization?_include=Practitioner:organization a FHIRStarter implementation returns "417 Expectation Failed". This also happens when no parameters are provided. According to:

http://hl7.org/fhir/2018Sep/search.html#revinclude

[Base]/Organization?_include=Practitioner:organization is a valid request.

@LaMMMy
Copy link
Author

LaMMMy commented Dec 21, 2018

My bad, after cloning and stepping through the code, the 417 error looks to be as designed. I traced it back to FHIR .Net line 336/337 where it is treating the _include and _revinclude as a separate type of parameter and doesn't add them to the main parameters.

I don't know for sure this is valid FHIR or not.

I would suggest maybe instead of a 417, that some kind of error message be returned with and explanation as to why it's being received.

@verzada
Copy link
Owner

verzada commented Dec 21, 2018

Hi @LaMMMy
My suggestion would be to look at the output from the file log. The output from the service to a browser is much shorter.

I'm as annoyed as you are when it comes to OperationOutcome, it should contain more information, but often lacks details when an unwarranted exception occurs in underlying libraries.

What I often do to figure out what causes an error, is to download the FhirStarter source code and use it directly instead of the nuget packages. Often it is an expectation that is wrong or a library that shouldn't have been updated (that happens a lot).

Your request url looks correct though since you are asking for a :. Which is a valid FHIR request. The only difference between _include and _revinclude, is what is regarded as the first element in the list.

@LaMMMy
Copy link
Author

LaMMMy commented Dec 21, 2018

Hi @verzada
I'm wondering though, in terms of REST, having no parameters or just _revinclude is a valid request. Should we not be allowing just a full list of Organizations for example? We are wanting it to use for an "address book" download between systems.

@verzada
Copy link
Owner

verzada commented Dec 21, 2018

@LaMMMy
It is a valid request.
The _include parameter is used to tell your service to add referenced resources into the FHIR response.
In this case you are asking to return all Organization resources with Practitioners organization.
You can have as many _includes as you like.

I'm not sure what you are trying to do though, I'm wondering if you mean to return Practitioners with the Organization resource added to the Bundle.

Have you copied the template project and started working from it?
https://github.com/verzada/FhirStarter.STU3/wiki/Getting-started
And seen the project working before you started adding a new IFhirService?

@LaMMMy
Copy link
Author

LaMMMy commented Dec 21, 2018

I'm wondering if mean to return Practitioners with the Organization resource added to the Bundle.

This is exactly what we're trying to do. I have used the Template project both directly out of the Git repo just now to see if the 417 still occurs and it does for the included Patient service.

I've also used the template to create my own services. None of them will accept the [Base]/Organization?_include=Practitioner:organization request without returning at 417. They all require that there is some kind of filter on the query.

I'm thinking we can get away with using the history query but I would still love to see just a default request work, with no parameters 😄

@verzada
Copy link
Owner

verzada commented Dec 21, 2018

Found an unintended bug when searching with no parameters in the FhirController.
If you don't have a parameter and only an _include, you'll get an exception.

Fixing it now.

Test and see if you can make it work now by updating the bonfire and flare nuget package.

@verzada verzada self-assigned this Dec 21, 2018
verzada added a commit that referenced this issue Dec 21, 2018
… be possible to search directly on a Resource
verzada added a commit that referenced this issue Dec 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants