FHIR Chat · Set Response status 202 in FHIR · implementers

Stream: implementers

Topic: Set Response status 202 in FHIR


view this post on Zulip Sateesh (Jan 18 2018 at 14:32):

I was trying to implement Full Bulk Data Export From a FHIR Open EndPoint.
When client request for a bulk data export (Patient/$everything) with the below headers
Accept: application/fhir+ndjson
Prefer: respond-async

Server has to respond with 202(accepted) status, but it is returning with 200.

On server setting the HttpServletResponse(using java, HAPI 1.6 dstu2 version) status code to 202 but it is returning 200.

    response.setStatus(HttpStatus.SC_ACCEPTED);
    response.setHeader("Content-Location", uri+"/bulkdata/"+responseBDR.getRequestId());

Can anyone help me out to set Response status(202/Accepted).

view this post on Zulip Grahame Grieve (Jan 19 2018 at 10:14):

@James Agnew

view this post on Zulip Michael Lawley (May 11 2018 at 04:58):

Does this work for you?

throw new UnclassifiedServerFailureException(HttpStatus.SC_ACCEPTED, "Accepted", outcome)
            .addResponseHeader(HttpHeaders.CONTENT_LOCATION, location);

Last updated: Apr 12 2022 at 19:14 UTC