Skip to main content
Skip table of contents

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

Authorization

Bearer [token]

The JWT token provided by the Consumer

URL Parameters

Parameter

Description

Validation Rules

patientId

The Medicus Patient ID

e.g. e9af860e-cf8e-4272-b81a-a95cc8a531f7

Mandatory

UUID

careRecordElementType

The care record element type that the document belongs to

Values:

  • care-record-document

  • emed3-fit-note

  • referral-attachment

Enum

careRecordElementId

The care record element ID

UUID

fileId

The ID of the file itself

UUID

Example Request

CODE
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

200

Request

400

FILE_CONTAINS_MALWARE

The file is suspected of containing malware. Unable to download.

404

PATIENT_NOT_FOUND

No patient record exists with the specified Patient ID.

404

INVALID_CARE_RECORD_ELEMENT_TYPE

A care record with that type could not be found

404

CARE_RECORD_ELEMENT_NOT_FOUND

A care record with that ID could not be found

404

FILE_NOT_FOUND

A file with that ID could not be found

405

NOT_ALLOWED

Access to this document isn’t allowed

Reasons that document access isn’t allowed:

  • Hidden from Patient Facing Services

  • Marked as confidential from third parties

Specific Response Codes

Example Response (File Not Found):

JSON
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):

CODE
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
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.