What is send should look like:
https://syntheticmass.mitre.org/v1/fhir/Condition?code=http://snomed.info/sct|44054006&apikey=<APIKEY>
So I tried the following:
hapiFhirClient = ctx.newRestfulGenericClient(base);
if(base.equals("
https://syntheticmass.mitre.org/v1/fhir")) {
AdditionalRequestHeadersInterceptor interceptor = new AdditionalRequestHeadersInterceptor();
logger.debug("Using AdditionalRequestHeadersInterceptor with apikey = " + syntheaKey);
interceptor.addHeaderValue("apikey", syntheaKey);
hapiFhirClient.registerInterceptor(interceptor);
}
Bundle bundle = null;
try {
IQuery query = (IQuery)hapiFhirClient.search().forResource(Condition.class)
.where(
new TokenClientParam("code").exactly().systemAndCode("http://snomed.info/sct", "44054006")
);
Object obj = query.execute();
logger.debug("obj = " + obj);
if(obj instanceof Bundle) bundle = (Bundle)obj;
} catch (Exception e) {
System.out.println("Error - message = " + e.getMessage());
System.out.println("Error - cause = " + e.getCause());
}
which results in an exception error:
"Response contains no Content-Type"'
With other FHIR servers that do not require an API key to be added to the request, it works wonderful.
So I wonder: for IQuery, is there a way to see how the query string (as URL) looks like? So that I can see what is exactly send to the server.
Any other suggestions are of course welcome!
Many thanks in advance,
Jozef