Binary | Medplum
A resource that represents the data of a single raw artifact as digital content accessible in its native format. A Binary resource can contain any content, whether text, image, pdf, zip archive, etc.
Elements
| Name | Required | Type | Description |
|---|---|---|---|
| contentType | ✓ | code | MimeType of the binary content Details MimeType of the binary content represented as a standard MimeType (BCP 13). |
| securityContext | Reference |
Identifies another resource to use as proxy when enforcing access control Details This element identifies another resource that can be used as a proxy of the security sensitivity to use when deciding and enforcing access control rules for the Binary resource. |
|
| data | base64Binary | The actual content Details The actual content, base64 encoded. If the content type is itself base64 encoding, then this will be base64 encoded twice - what is created by un-base64ing the content must be the specified content type. |
|
| url | url | Uri where the data can be found Details A location where the data can be accessed. |
Search Parameters
None
Inherited Elements
| Name | Required | Type | Description |
|---|---|---|---|
| id | string | Logical id of this artifact Details The logical id of the resource, as used in the URL for the resource. |
|
| meta | Meta | Metadata about the resource Details The metadata about the resource. |
|
| implicitRules | uri | A set of rules under which this content was created Details A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content. |
|
| language | code | Language of the resource content Details The base language in which the resource is written. |
There are situations where it is useful or required to handle pure binary content using the same framework as other resources. Typically, this is when the binary content is referred to from other FHIR Resources. Using the same framework means that the existing servers, security arrangements, code libraries, etc. can handle additional related content. Typically, Binary resources are used for handling content such as:
- CDA Documents (i.e. with XDS)
- PDF Documents
- Images
A binary resource can contain any content, whether text, image, pdf, zip archive, etc. These resources are served in their native form on the rest interface, but can also be represented in XML, JSON, or other formats, such as when including these resources in a Bundle (used when it is convenient to include these in the response directly rather than leaving them by reference).
The DocumentReference and Media resources allow conveying binary content (via attachment) or pointing to one (as a Binary or non-FHIR URI) along with the metadata around that resource, and as such are searchable. Binary resources do not support 'search'.
While CDA and PDF documents are conveyed as Binary (because they cannot be expressed natively in FHIR), FHIR Documents do not need to be similarly encoded and can be sent natively in FHIR using Bundle. However, in some situations FHIR Documents may be sent as a Binary if there is a need to treat them the same as other types of documents or binary files.
The Binary resource does not convey context of the file. If the context (information such as author, procedure, technique, etc.) should be conveyed, Media or DocumentReference resources are appropriate. The Binary resource may be used to convey actual binary file content conveyed by those resources.
The Media resource is preferred for handling images, but this is not possible when the content is already binary (e.g. in some uses of IHE XDS).