DSTU2 STU 3 Candidate
This page is part of the FHIR Specification (v1.0.2: DSTU 2). The current version which supercedes this version is

This page is part of the FHIR Specification (v1.4.0: STU 3 Ballot 3). The current version which supercedes this version is 5.0.0 . For a full list of available versions, see the Directory of published versions . For a full list of available versions, see the Directory of published versions . Page versions: . Page versions: R5 R4B R4 R3 R2

6.6 6.7 Resource Binary - Content Resource Binary - Content

A binary resource can contain any content, whether text, image, pdf, zip archive, etc.
FHIR Infrastructure FHIR Infrastructure Work Group Work Group Maturity Level : 1 Maturity Level : 1 Compartments : Not linked to any defined compartments : Not linked to any defined compartments

A binary resource can contain any content, whether text, image, pdf, zip archive, etc.

6.6.1 Scope and Usage 6.7.1 Scope and Usage 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:

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:

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 or JSON, such as when including these resources in a bundle (used when it is convenient to include these in the feed directly rather than leaving them by reference).

6.6.2 Boundaries and Relationships 6.7.2 Boundaries and Relationships This resource is generally used as the target of a Document Reference or an

This resource is generally used as the target of a Document Reference or an Attachment , when a FHIR server finds it convenient to manage the content within the same overall REST framework as the other resources. , when a FHIR server finds it convenient to manage the content within the same overall REST framework as the other resources.

6.6.3 Resource Content 6.7.3 Resource Content

Structure

Name Flags Card. Type Description & Constraints Description & Constraints doco
. . Binary Σ Resource Pure binary content defined by some other format than FHIR Pure binary content defined by some other format than FHIR
. . . contentType Σ 1..1 code MimeType of the binary content MimeType of the binary content
MimeType MimeType ( ( Required )
. . . content Σ 1..1 base64Binary The actual content The actual content

Documentation for this format doco Documentation for this format

XML Template XML Template

<Binary xmlns="http://hl7.org/fhir"> doco
 <!-- from Resource: id, meta, implicitRules, and language -->
 <contentType value="[code]"/><!-- 1..1 MimeType of the binary content  -->
 <content value="[base64Binary]"/><!-- 1..1 The actual content -->
</Binary>

JSON Template JSON Template

Structure

Name Flags Card. Type Description & Constraints Description & Constraints doco
. . Binary Σ Resource Pure binary content defined by some other format than FHIR Pure binary content defined by some other format than FHIR
. . . contentType Σ 1..1 code MimeType of the binary content MimeType of the binary content
MimeType MimeType ( ( Required )
. . . content Σ 1..1 base64Binary The actual content The actual content

Documentation for this format doco Documentation for this format

XML Template XML Template

<Binary xmlns="http://hl7.org/fhir"> doco
 <!-- from Resource: id, meta, implicitRules, and language -->
 <contentType value="[code]"/><!-- 1..1 MimeType of the binary content  -->
 <content value="[base64Binary]"/><!-- 1..1 The actual content -->
</Binary>

JSON Template JSON Template

  Alternate definitions:

Alternate definitions: Schema / Schematron , Resource Profile ( , Resource Profile ( XML , , JSON ), ), Questionnaire

6.6.3.1 Terminology Bindings 6.7.3.1 Terminology Bindings

Path Definition Type Reference
Binary.contentType Binary.contentType The mime type of an attachment. Any valid mime type is allowed. The mime type of an attachment. Any valid mime type is allowed. Required BCP 13 (RFCs 2045, 2046, 2047, 4288, 4289 and 2049) BCP 13 (RFCs 2045, 2046, 2047, 4288, 4289 and 2049)

6.6.3.2 Serving Binary Resources using the RESTful API 6.7.3.2 Serving Binary Resources using the RESTful API Binary resources behave slightly differently to all other resources on the RESTful API. Specifically, when a read request is made for the binary resource that doesn't explicitly specify the FHIR content types "application/xml+fhir" or "application/json+fhir", then the content should be returned using the content type stated in the resource. e.g. if the content type in the resource is "application/pdf", then the content should be returned as a PDF directly. Note that due to the way the web infrastructure works, it is not possible to make blanket rules about the relationship between the "Accept" field in the HTTP request, and the return type, which is why there is no hard rule about this. However the intent is that unless specifically requested, the FHIR XML/JSON representation is not returned. Note that in the native binary representation, the

Binary resources behave slightly differently to all other resources on the RESTful API. Specifically, when a read request is made for the binary resource that doesn't explicitly specify the FHIR content types "application/xml+fhir" or "application/json+fhir", then the content should be returned using the content type stated in the resource. e.g. if the content type in the resource is "application/pdf", then the content should be returned as a PDF directly.

Note that due to the way the web infrastructure works, it is not possible to make blanket rules about the relationship between the "Accept" field in the HTTP request, and the return type, which is why there is no hard rule about this. However the intent is that unless specifically requested, the FHIR XML/JSON representation is not returned.

Note that in the native binary representation, the normal resource metadata is not available directly, though some of it is replicated in the HTTP response headers. is not available directly, though some of it is replicated in the HTTP response headers.

When a binary is written the server ( create / update - POST or PUT), the data is accepted as is and treated as a the binary content of a Binary , including when the content type is "application/xml+fhir" or "application/json+fhir", except for the special case where the content is actually a Binary resource.

6.6.3.3 6.7.3.3 Security Considerations Security Considerations Binary resources are not constrained, and therefore can be of any content type and encoding. Therefore extra care needs to be taken to validate the content of the Binary resource against malicious or malformed content. For more details see Security of Narrative .

Binary resources are not constrained, and therefore can be of any content type and encoding. Therefore extra care needs to be taken to validate the content of the Binary resource against malicious or malformed content. For more details see Security of Narrative .

6.6.4 Search Parameters 6.7.4 Search Parameters Search parameters for this resource. The common parameters also apply. See

Search parameters for this resource. The common parameters also apply. See Searching for more information about searching in REST, messaging, and services. for more information about searching in REST, messaging, and services.

© HL7.org 2011+. FHIR DSTU2 (v1.0.2-7202) generated on Sat, Oct 24, 2015 07:43+1100. Links: Search
Name Type Description Paths
contenttype token MimeType of the binary content MimeType of the binary content Binary.contentType