If you haven’t already, review best practices for sending a file to your connection.
This article contains instructions for how to send a generic file with the Redox FHIR® API specifically. If you want to send results-related documents, learn how to send results or vitals.
You can either:
- embed a file directly in the DocumentReference$documentreference-create request; or
- upload a file to a Redox endpoint with the Binary resource, then include the URL reference in the DocumentReference$documentreference-create request.
You can embed a file within the DocumentReference resource, so long as the file fits within the size limit for the type of traffic. Check limits by traffic type.
- Encode the file as a base64 encoded string.
- Use DocumentReference$documentreference-create to send the uploaded file to your connection. Refer to the DocumentReference schema for all the requirements.
- In the headers:
- Replace {environmentFlag} with Development, Staging, or Production respectively.
- Replace {API_TOKEN} with your access token.API token
- Replace {destinationSlug} with the human-readable safe name for the intended destination.
- Populate the entry.resource.content.attachment fields to include the encoded file:
- In the contentType field, enter a valid MIME type. Learn more about MIME types for files.
- In the data field, insert the base64 encoded string for the file.
- (Optional) In the title field, enter the name of the file.Example: Embed a file in DocumentReference$documentreference-createbashAbbreviated code exampleCanada URL
- Send the populated request to your connection’s EHR system.
- To check if the embedded file sent successfully, log in to the Redox dashboard and check the log for the request. The embedded file displays in the log payload.
Our recommended method is to upload a file to the Redox endpoint using the FHIR® Binary resource. Then, refer to the file in DocumentReference$documentreference-create.
- Locate the file you want to upload.
- Upload your file to the Redox upload endpoint using the FHIR® Binary resource.Support for the FHIR Binary resource
- Replace {environmentFlag} with Development, Staging, or Production respectively.Development not available for free accounts
- Replace {API_TOKEN} with your access token.API token
- Add the Redox-source-Id header if you have more than one source in your environment.
- Keep redox in the slug. That portion routes the request to the appropriate Redox upload endpoint.Example: Upload a file to Redox with the Binary resourcebashCanada URL
- If the upload is successful, you receive a 201 Created status. The reference URL is in the location header of the Binary response.Example: Binary response with the reference URLjson
- Use DocumentReference$documentreference-create to send the uploaded file to your connection. Refer to the DocumentReference schema for all the requirements.
- Include the required entry.resource.content.attachment fields with the URL reference to the file you already uploaded:
- In the url field, enter the URL reference from the Binary response.
- In the contentType field, enter a valid MIME type. Learn more about MIME types for files.
- (Optional) In the title field, enter the name of the file.Example: Reference the uploaded file in DocumentReference$documentreference-createbashAbbreviated code exampleCanada URL
- Send the populated request to your connection’s EHR system.
- To check if the file uploaded successfully, log in to the Redox dashboard and check the log for the request. The uploaded file displays under the Process tab of the log.