Performing an interaction on an unknown FHIR resource results in 400, not 404 as per FHIR spec #539

Closed
CarthageKing opened this Issue Jan 16, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@CarthageKing

CarthageKing commented Jan 16, 2017

Hi,

When performing an interaction against an unknown resource (e.g. [baseurl]/Patent) (i.e. Patient that was misspelled), HAPI will return 400 instead of 404. AEGIS Touchstone thinks FHIR servers should return 404 in these cases, probably because of the following:
http://hl7.org/fhir/2017Jan/http.html#create

404 Not Found - resource type not supported, or not a FHIR end-point

also in http://hl7.org/fhir/2017Jan/http.html#2.44.0.10.1.

I would think that in RestfulServer.determineResourceMethod(), changing "if(resourceBinding==null)" to throw a ResourceNotFoundException instead of an InvalidRequestException should solve this problem.

		} else {
			resourceBinding = myResourceNameToBinding.get(resourceName);
			if (resourceBinding == null) {
				throw new InvalidRequestException("Unknown resource type '" + resourceName + "' - Server knows how to handle: " + myResourceNameToBinding.keySet());
			}
		}

Tested with HAPI 2.2 and master.

Best Regards,

@CarthageKing CarthageKing changed the title from Performing an interaction on an unknown FHIR resource results in 400, not 404 as per FHIR spec (2.2) to Performing an interaction on an unknown FHIR resource results in 400, not 404 as per FHIR spec Jan 16, 2017

@jamesagnew

This comment has been minimized.

Show comment
Hide comment
@jamesagnew

jamesagnew Jan 20, 2017

Owner

Hi @CarthageKing , thanks for the PR! Looks good, merging it now.

Owner

jamesagnew commented Jan 20, 2017

Hi @CarthageKing , thanks for the PR! Looks good, merging it now.

jamesagnew added a commit that referenced this issue Jan 20, 2017

@jamesagnew jamesagnew closed this in #540 Jan 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment