private static IGenericClient clientGeneric;
MethodOutcome out = clientGeneric.operation()
.onType (Binary.class)
.named ("upload")
.withNoParameters (Parameters.class)
.returnMethodOutcome().execute();
But I did not find a way to pass the reference to the file. There is no way to define the body of the POST operation.
Does anyone have an idea?
Thanks,
Mike
MethodOutcome out = clientGeneric.operation()
.onType (Binary.class)
.named ("upload")
...
--
You received this message because you are subscribed to a topic in the Google Groups "HAPI FHIR" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hapi-fhir/UTveVC148jY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hapi-fhir+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/281d1bbe-1c54-425d-a7d1-d43a6c183413n%40googlegroups.com.
Blessed Tabvirwa
HealthIT Developer, #PHASA2018 Ambassador
BSc Computer Science, Certified Azure Architect,
MCSE Data Mgt & Analytics, MCSA, MCPD, FHIR
// Define your FHIR server URL
String baseUrl = "https://.../Binary";
String operationName = "upload";
// Construct the complete URL for the custom operation
String operationUrl = baseUrl + "/$" + operationName;
// Create the HTTP POST request
HttpPost httpPost = new HttpPost(operationUrl);
httpPost.setHeader("Content-Type", "application/pdf"); // Set the appropriate content type
FileBody fileBody = new FileBody (new File ("test.pdf"));
MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create().setMode(HttpMultipartMode.BROWSER_COMPATIBLE ).addPart("file", fileBody);
HttpEntity entity = entityBuilder.build();
httpPost.setEntity(entity);
// Create an HttpClient instance and execute the request
HttpClient httpClient = HttpClients.createDefault();
HttpResponse response = httpClient.execute(httpPost);
But I would rather stick with the hapi-fhir-api.