Download File (PFS)
Overview
The Download File PFS endpoint allows Patient Facing Services consumer apps to download a file that has been included in the patient’s care record.
Downloading files is only available to patients who have “Full Record Access” (See: Care Record Levels of Access).
Making a Request
Method: GET
URL: https://{{medicusTenant}}.{{medicusBaseURL}}/pfs-api/v1/patient/{{patientId}}/file/{{careRecordElementType}}/{{careRecordElementId}}/{{fileId}}
Example of a fully formed URL: GET https://a10001.api.demo.medicus.health/pfs-api/v1/patient/eb8d8f70-360c-11ed-a5b3-060b232f1aa2/file/care-record-document/e148fc20-6b54-11ed-9b61-0a8d9fca48f6/e149121e-6b54-11ed-b412-0a8d9fca48f6
.
Determining the File’s URL
The Download File URI path can be easily obtained from the Retrieve Patient Journal payload in the file.url
key-value pair.
Request Headers
Header | Value | Description |
---|---|---|
|
| The JWT token provided by the Consumer |
URL Parameters
Parameter | Description | Validation Rules |
---|---|---|
| The Medicus Patient ID e.g. | Mandatory UUID |
| The care record element type that the document belongs to Values:
| Enum |
| The care record element ID | UUID |
| The ID of the file itself | UUID |
Example Request
GET /pfs-api/v1/patient/eb8d8f70-360c-11ed-a5b3-060b232f1aa2/file/care-record-document/e148fc20-6b54-11ed-9b61-0a8d9fca48f6/e149121e-6b54-11ed-b412-0a8d9fca48f6
Authorization: Bearer [token]
Response Details
Specific Response Codes
HTTP Code | Error Code | Scenario |
---|---|---|
| Request | |
|
| The file is suspected of containing malware. Unable to download. |
|
| No patient record exists with the specified Patient ID. |
|
| A care record with that type could not be found |
|
| A care record with that ID could not be found |
|
| A file with that ID could not be found |
|
| Access to this document isn’t allowed Reasons that document access isn’t allowed:
|
Specific Response Codes
Example Response (File Not Found):
HTTP/1.1 404 Not Found
Content-Type: application/json
{
"errors": [
{
"code": "FILE_NOT_FOUND"
"title": "File Not Found",
"detail": "No file exists with the specified ID."
}
]
}
Example Response (Successful Retrieval):
HTTP/1.1 200 OK
Content-Disposition: attachment; filename=fit-note-e32d646a-6756-11ed-a7cb-0a16dbecd4a8.pdf
Content-Type: application/pdf
Content-Length: 64559
Date: Thu, 24 Nov 2022 09:55:36 GMT