-
Hi, I have this POST request
to write some PDF content: <DocumentReference xmlns="http://hl7.org/fhir">
<type>
<!-- type information -->
</type>
<category>
<!-- category -->
</category>
<subject id="Patient/Patient-3">
<reference value="Patient/Patient-3"/>
<display value="TestAppointment"/>
</subject>
<content>
<attachment>
<contentType value="application/pdf"/>
<data value="[BASE64 encoded pdf content]"/>
</attachment>
</content>
</DocumentReference> How can I post this request with firely API? |
Beta Was this translation helpful? Give feedback.
Answered by
elvetian
Jul 2, 2021
Replies: 1 comment 2 replies
-
Here's how I did it: var categories = new List<CodeableConcept>();
categories.Add(new CodeableConcept(system:"http://myURI/fhir/ValueSet/documentreference-class",
code:"[some code]", display:"[some value]", text:"[some text]"));
var docType = new CodeableConcept(system:"http://myURI/fhir/ValueSet/documentreference-type",
code:"[some code]", display:"[some value]", text:"[some text]");
var attachment = new Attachment()
{
ContentType = "application/pdf",
Data = Encoding.ASCII.GetBytes(["BASE64 encoded pdf content"])
};
var content = new DocumentReference.ContentComponent()
{
Attachment = attachment
};
var contents = new List<DocumentReference.ContentComponent>();
contents.Add(content);
var documentReference = new DocumentReference()
{
Status = DocumentReferenceStatus.Current,
Content= contents,
Type = docType,
Category = categories,
Subject = new ResourceReference("Patient/Patient-XY")
};
var document = fhirClient.Create<DocumentReference>(documentReference); |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
elvetian
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's how I did it: