Skip to main content

Binary Resource

The FHIR Binary resource stores the raw contents of a file that cannot be represented directly as a standard FHIR resource. This may include PDF reports, images, text files, structured documents, or other file types.

Within AdvaPACS, a Binary resource is commonly used together with a DocumentReference. The Binary resource contains the file itself, while the DocumentReference provides the clinical and administrative information needed to describe, classify, and associate the file with a patient, study, or order. For full information on the Binary resource, refer to the FHIR standard.

Supported Transactions

AdvaPACS supports the following transactions for the Binary resource:

FunctionMethodEndpointDescription
Get BinaryGET/Binary/{id}Retrieves a specific Binary resource by its logical ID.
Create BinaryPOST/BinaryCreates a new Binary resource containing the supplied file contents.
Delete BinaryDELETE/Binary/{id}Deletes an existing Binary resource.

Examples

The following examples show how to create, retrieve, and delete Binary resources using the AdvaPACS FHIR API. These examples are intended to help you understand how binary file content is represented within FHIR and how it can be referenced by other resources such as DocumentReference.

Create a Binary

Create a new FHIR Binary resource by submitting the file contents encoded as Base64. The Binary resource stores the raw contents of the file and can later be referenced by resources such as DocumentReference.

POST /Binary
Authorization: ID=<ApiId>,Secret=<ApiSecret>
Content-Type: application/json
Host: <FhirEndpoint>

The following fields are supported when creating a Binary resource:

FieldDescriptionExample
resourceTypeThe FHIR resource being created. This must always be Binary.Binary
contentTypeThe MIME type of the file being uploaded.application/pdf
dataThe contents of the file encoded as a Base64 string.JVBERi0xLjQKJcTl8uXrp...

The following example uploads a PDF document by creating a new Binary resource. The document contents are provided as a Base64-encoded string in the data field.

{
"resourceType": "Binary",
"contentType": "application/pdf",
"data": "JVBERi0xLjQKJcTl8uXrp..."
}

If successful, the server returns the newly created Binary resource, including its logical ID.

{
"resourceType": "Binary",
"id": "79bb3bb7-b754-481c-bbd4-472b4254bb4e",
"meta": {
"lastUpdated": "2026-08-04T01:15:42.075+00:00"
},
"contentType": "application/pdf",
"data": "JVBERi0xLjQKJcTl8uXrp..."
}

The returned id can be used to retrieve the Binary resource or referenced by another FHIR resource, such as a DocumentReference.

Get a Binary

The following example retrieves an existing Binary resource using its logical ID. The response includes the file's MIME type and its Base64-encoded contents.

GET /Binary/79bb3bb7-b754-481c-bbd4-472b4254bb4e
Authorization: ID=<ApiId>,Secret=<ApiSecret>
Host: <FhirEndpoint>

If the Binary resource exists, the server returns the resource along with the encoded file contents.

{
"resourceType": "Binary",
"id": "79bb3bb7-b754-481c-bbd4-472b4254bb4e",
"meta": {
"lastUpdated": "2026-08-04T01:15:42.075+00:00"
},
"contentType": "application/pdf",
"data": "JVBERi0xLjQKJcTl8uXrp..."
}

The value returned in the data field is Base64 encoded and can be decoded to recreate the original file.