FHIR Chat · POST document by FHIR · hapi

Stream: hapi

Topic: POST document by FHIR


view this post on Zulip Ihor Shylo (May 02 2019 at 14:10):

Hi, all.
I'm trying to implement document save on fhir server, using hapi.
I read fhir documentation https://www.hl7.org/fhir/documents.html and tried to use @Transaction according hapi docs (http://hapifhir.io/doc_rest_operations.html)

My providers look like this

public class CompositionProvider implements IResourceProvider {

private final WmedClient wmedClient;

@Override
public Class<Composition> getResourceType() {
    return Composition.class;
}

@Read
public Composition getResourceById(@IdParam IdType theId) {
    return null;
}


@Transaction
public Bundle transaction(@TransactionParam Bundle theInput) {
    for (Bundle.BundleEntryComponent nextEntry : theInput.getEntry()) {
        // Process entry
    }

    Bundle retVal = new Bundle();
    // Populate return bundle
    return retVal;
}

}

Also i tried like this

public class BundleProvider implements IResourceProvider
{

private final WmedClient wmedClient;

@Override
public Class<Bundle> getResourceType() {
    return Bundle.class;
}

@Read
public Bundle getResourceById(@IdParam IdType theId) {
    return null;
}


@Transaction
public Bundle transaction(@TransactionParam Bundle theInput) {
    for (Bundle.BundleEntryComponent nextEntry : theInput.getEntry()) {
        // Process entry
    }

    Bundle retVal = new Bundle();
    // Populate return bundle
    return retVal;
}

}

I tried to send POST methods on [base]/Bundle and [base]/Composition . But it doesn't work. Does anyone know how to handle this issue?


Last updated: Apr 12 2022 at 19:14 UTC