Messages

Base Path: /actor/current/webmail/DIRECT/mailboxes/{mailboxAddress}/folders/{folderPath}/messages

Version: 3.5.0

The Messages API includes actions that can be carried out on a single message, such as retrieve a message, delete a message, update a draft, update message flags and so on.

Authorization: OAuth 2.0 Bearer token is required to access the resources of this API. Once signed up, credentials and URL to access the OAuth API can be found on My Apps Page.


Methods

Retrieve messages from a folder with optional filtering

GET /actor/current/webmail/DIRECT/mailboxes/{mailboxAddress}/folders/{folderPath}/messages/

Retrieves a paginated list of message summaries from a folder, for a given date range, in the sort order specified.


Parameters

Name

Type

Data Type

Description


Name:

from

required

Type:

query

Data Type:

string

Description:

Start date in a date range. Only yyyy-MM-dd'T'hh:mm:ss'Z' and yyyy-MM-dd'T'hh:mm:ss+hh:mm, which are part of the ISO 8601 standard, are supported. For example, 2015-10-01T17:53:03Z, where Z indicates that the date is in UTC with a zero offset.


Sample Value: 2017-01-01T01:01:01Z



Name:

to

required

Type:

query

Data Type:

string

Description:

End date in a date range. Only yyyy-MM-dd'T'hh:mm:ss'Z' and yyyy-MM-dd'T'hh:mm:ss+hh:mm, which are part of the ISO 8601 standard, are supported. For example, 2015-10-01T17:53:03+12:00, where +12:00 indicates that the time has 12 hours added to it to represent the local time (2015-10-01T05:53:03Z = 2015-10-01T17:53:03+12:00).


Sample Value: 2017-01-01T01:01:01Z



Name:

page

required

Type:

query

Data Type:

number

Description:

Page number to retrieve (the first page is given a value of 1). If page is not provided, it defaults to 0. For pagination to work, you must specify both page and perPage.


Sample Value: 1



Name:

perPage

required

Type:

query

Data Type:

number

Description:

Number of messages per page. Must be greater than 0. If perPage is not provided, it defaults to 0. For pagination to work, you must specify both perPage and page.


Sample Value: 20



Name:

sort

required

Type:

query

Data Type:

string

Description:

Sorting method to use -- RECENT, OLDEST, UNREAD, STARRED, SENDER and RECIPIENT. If sort is not provided, it defaults to RECENT.


Sample Value: OLDEST



Name:

preview

optional

Type:

query

Data Type:

boolean

Description:

Whether the payload should contain a 50-character preview of each message body.




Name:

search

optional

Type:

query

Data Type:

string

Description:

Search string to filter the messages returned. If the search string is not provided, no filtering is applied to the list of messages returned. See Constructing an Advanced Search (https://doki.orionhealth.com/display/DSM2/Find+a+Message+in+a+Folder#FindaMessageinaFolder-ConstructinganAdvancedSearch) to learn more.


Sample Value: OLDEST



Name:

mailboxAddress

required

Type:

path

Data Type:

string

Description:

URL-encoded address of the mailbox.


Sample Value: developer.portal@example.com



Name:

folderPath

required

Type:

path

Data Type:

string

Description:

URL-encoded path of the folder or sub-folder. A period (.) separates the sub-folder from the folder.


Sample Value: Inbox


Responses


application/json+fhir

200

Successfully retrieved a list of messages from the specified folder.


application/json+fhir

400

The page number or sorting method requested is invalid.


application/json+fhir

401

Your API key or access token has expired or is invalid.


application/json+fhir

404

We cannot find a folder with that name.

Sample Request

curl -X GET "https://api.orionhealth.io/actor/current/webmail/DIRECT/mailboxes/developer.portal@example.com/folders/Inbox/messages/?from=2017-01-01T01:01:01Z&to=2017-01-01T01:01:01Z&page=1&perPage=20&sort=OLDEST&preview=false&search=OLDEST" \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <Access Token>'

Move messages

POST /actor/current/webmail/DIRECT/mailboxes/{mailboxAddress}/folders/{folderPath}/messages/move

Moves a selection of messages to another folder.


Parameters

Name

Type

Data Type

Description


Name:

body

required

Type:

body

Data Type:

Description:

Body of the request.

Sample Payload:

{
  "folderPath": "Trash",
  "messageUidList": [
    "1",
    "2",
    "3"
  ]
}




Name:

mailboxAddress

required

Type:

path

Data Type:

string

Description:

URL-encoded address of the mailbox.


Sample Value: developer.portal@example.com



Name:

folderPath

required

Type:

path

Data Type:

string

Description:

URL-encoded path of the folder or sub-folder. A period (.) separates the sub-folder from the folder.


Sample Value: Inbox


Responses


application/json+fhir

200

Successfully moved the selected messages to the specified folder.


application/json+fhir

400

Cannot move the selected messages, because the unique identifier of one or more messages is invalid.


application/json+fhir

401

Your API key or access token has expired or is invalid.


application/json+fhir

404

We cannot find a folder with that name.

Sample Request

curl -X POST "https://api.orionhealth.io/actor/current/webmail/DIRECT/mailboxes/developer.portal@example.com/folders/Inbox/messages/move" \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <Access Token>' \
-H 'Content-Type: application/json' \
-d '{"folderPath":"Trash","messageUidList":["1","2","3"]}'

Delete messages

POST /actor/current/webmail/DIRECT/mailboxes/{mailboxAddress}/folders/{folderPath}/messages/delete

Deletes a selection of messages and sends them to the Trash folder. If the messages selected are in the Trash or Drafts folder, they are permanently deleted.


Parameters

Name

Type

Data Type

Description


Name:

body

required

Type:

body

Data Type:

Description:

Body of the request.

Sample Payload:

{
  "messageUidList": [
    "4",
    "5",
    "6"
  ]
}




Name:

mailboxAddress

required

Type:

path

Data Type:

string

Description:

URL-encoded address of the mailbox.


Sample Value: developer.portal@example.com



Name:

folderPath

required

Type:

path

Data Type:

string

Description:

URL-encoded path of the folder or sub-folder. A period (.) separates the sub-folder from the folder.


Sample Value: Inbox


Responses


application/json+fhir

200

Successfully deleted the selected messages.


application/json+fhir

400

Cannot delete the selected messages, because the unique identifier of one or more messages is invalid.


application/json+fhir

401

Your API key or access token has expired or is invalid.


application/json+fhir

404

We cannot find a folder with that name.

Sample Request

curl -X POST "https://api.orionhealth.io/actor/current/webmail/DIRECT/mailboxes/developer.portal@example.com/folders/Inbox/messages/delete" \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <Access Token>' \
-H 'Content-Type: application/json' \
-d '{"messageUidList":["4","5","6"]}'

Retrieve message

GET /actor/current/webmail/DIRECT/mailboxes/{mailboxAddress}/folders/{folderPath}/messages/{messageUid}

Retrieves the contents of a message from a folder.


Parameters

Name

Type

Data Type

Description


Name:

messageUid

required

Type:

path

Data Type:

string

Description:

Unique identifier of the message.


Sample Value: 1



Name:

mailboxAddress

required

Type:

path

Data Type:

string

Description:

URL-encoded address of the mailbox.


Sample Value: developer.portal@example.com



Name:

folderPath

required

Type:

path

Data Type:

string

Description:

URL-encoded path of the folder or sub-folder. A period (.) separates the sub-folder from the folder.


Sample Value: Inbox


Responses


application/json+fhir

200

We found a message with that unique identifier.


application/json+fhir

400

Your request was invalid. A parameter, or the data in a parameter, may be incorrect.


application/json+fhir

401

Your API key or access token has expired or is invalid.


application/json+fhir

404

Cannot find a message with that unique identifier.

Sample Request

curl -X GET "https://api.orionhealth.io/actor/current/webmail/DIRECT/mailboxes/developer.portal@example.com/folders/Inbox/messages/1" \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <Access Token>'

Update draft

POST /actor/current/webmail/DIRECT/mailboxes/{mailboxAddress}/folders/{folderPath}/messages/{messageUid}

Updates an existing message in the Drafts folder or a sub-folder in the Drafts folder. This method deletes the old unique identifier, and assigns a new identifier every time a draft is updated.


Parameters

Name

Type

Data Type

Description


Name:

messageUid

required

Type:

path

Data Type:

string

Description:

Unique identifier of the draft message. Every time you update a draft, the old unique identifier is deleted and a new identifier is assigned.


Sample Value: 1



Name:

body

required

Type:

body

Data Type:

Description:

Body of the request.

Sample Payload:

{
  "to": [
    {
      "name": "example",
      "address": "example.portal@example.com"
    }
  ],
  "cc": [],
  "subject": "create draft example",
  "messageType": "FORWARD",
  "draft": true,
  "priority": "normal",
  "attachmentGroupId": null,
  "attachmentInfo": [],
  "content": {
    "alternatives": [
      {
        "contentType": "text/html",
        "value": "

example text inside draft email

" } ] }, "draftMessageDescriptor": { "folderDescriptor": { "mailboxDescriptor": { "providerIdentifier": "DIRECT", "mailboxIdentifier": "example.provider@example.com", "mailboxName": null, "shared": false, "sharingType": null }, "path": "Drafts", "role": "DRAFTS" }, "messageUid": "2" }, "patientIdentifier": null, "ccdaTransmission": false }




Name:

mailboxAddress

required

Type:

path

Data Type:

string

Description:

URL-encoded address of the mailbox.


Sample Value: developer.portal@example.com



Name:

folderPath

required

Type:

path

Data Type:

string

Description:

URL-encoded path of the folder or sub-folder. A period (.) separates the sub-folder from the folder.


Sample Value: Inbox


Responses


application/json+fhir

201

Successfully updated a draft message with that unique identifier.


application/json+fhir

400

Your request was invalid. A parameter, or the data in a parameter, may be incorrect.


application/json+fhir

401

Your API key or access token has expired or is invalid.


application/json+fhir

404

Cannot find a message with that unique identifier.


application/json+fhir

413

The total size of all the attachments exceeds 50 MB.

Sample Request

curl -X POST "https://api.orionhealth.io/actor/current/webmail/DIRECT/mailboxes/developer.portal@example.com/folders/Inbox/messages/1" \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <Access Token>' \
-H 'Content-Type: application/json' \
-d '{"to":[{"name":"example","address":"example.portal@example.com"}],"cc":[],"subject":"create draft example","messageType":"FORWARD","draft":true,"priority":"normal","attachmentGroupId":null,"attachmentInfo":[],"content":{"alternatives":[{"contentType":"text/html","value":"<p>example text inside draft email</p>"}]},"draftMessageDescriptor":{"folderDescriptor":{"mailboxDescriptor":{"providerIdentifier":"DIRECT","mailboxIdentifier":"example.provider@example.com","mailboxName":null,"shared":false,"sharingType":null},"path":"Drafts","role":"DRAFTS"},"messageUid":"2"},"patientIdentifier":null,"ccdaTransmission":false}'

Delete message

DELETE /actor/current/webmail/DIRECT/mailboxes/{mailboxAddress}/folders/{folderPath}/messages/{messageUid}

Deletes a message from a folder, or discards an unsent message.


Parameters

Name

Type

Data Type

Description


Name:

messageUid

required

Type:

path

Data Type:

string

Description:

Unique identifier of the message.


Sample Value: 12



Name:

mailboxAddress

required

Type:

path

Data Type:

string

Description:

URL-encoded address of the mailbox.


Sample Value: developer.portal@example.com



Name:

folderPath

required

Type:

path

Data Type:

string

Description:

URL-encoded path of the folder or sub-folder. A period (.) separates the sub-folder from the folder.


Sample Value: Inbox


Responses


application/json+fhir

200

We deleted a message with that unique identifier.


application/json+fhir

401

Your API key or access token has expired or is invalid.


application/json+fhir

404

Cannot find a message with that unique identifier.

Sample Request

curl -X DELETE "https://api.orionhealth.io/actor/current/webmail/DIRECT/mailboxes/developer.portal@example.com/folders/Inbox/messages/12" \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <Access Token>'

Update message flags

POST /actor/current/webmail/DIRECT/mailboxes/{mailboxAddress}/folders/{folderPath}/messages/{messageUid}/flags

Updates the flags of the selected message. There are two types of flags:

  • flagged – Provides a visual cue reminding you to follow up on a message.
  • read – Marks the message as read or unread.


Parameters

Name

Type

Data Type

Description


Name:

messageUid

required

Type:

path

Data Type:

string

Description:

Unique identifier of the message.


Sample Value: 1234



Name:

body

required

Type:

body

Data Type:

Description:

Body of the request.

Sample Payload:

{
  "flagged": true,
  "read": false
}




Name:

mailboxAddress

required

Type:

path

Data Type:

string

Description:

URL-encoded address of the mailbox.


Sample Value: developer.portal@example.com



Name:

folderPath

required

Type:

path

Data Type:

string

Description:

URL-encoded path of the folder or sub-folder. A period (.) separates the sub-folder from the folder.


Sample Value: Inbox


Responses


application/json+fhir

200

Successfully updated the flag(s) of a message with that unique identifier.


application/json+fhir

400

Your request was invalid. A parameter, or the data in a parameter, may be incorrect.


application/json+fhir

401

Your API key or access token has expired or is invalid.


application/json+fhir

404

Cannot find a message with that unique identifier.

Sample Request

curl -X POST "https://api.orionhealth.io/actor/current/webmail/DIRECT/mailboxes/developer.portal@example.com/folders/Inbox/messages/1234/flags" \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <Access Token>' \
-H 'Content-Type: application/json' \
-d '{"flagged":true,"read":false}'

Copy attachments

POST /actor/current/webmail/DIRECT/mailboxes/{mailboxAddress}/folders/{folderPath}/messages/{messageUid}/copy

Stores a new copy of the attachments, from a message, against a fileGroupId. Typically called when replying to or forwarding a message.


Parameters

Name

Type

Data Type

Description


Name:

messageUid

required

Type:

path

Data Type:

string

Description:

Unique identifier of the message.


Sample Value: 1234



Name:

body

required

Type:

body

Data Type:

Description:

Body of the request.

Sample Payload:

{
  "attachmentGroupId": "file_group_yui_3_17_2_1_1440995359278_225",
  "attachmentIdPrefix": "referencedMessageAttachment-",
  "isTransferOfCare": false
}




Name:

mailboxAddress

required

Type:

path

Data Type:

string

Description:

URL-encoded address of the mailbox.


Sample Value: developer.portal@example.com



Name:

folderPath

required

Type:

path

Data Type:

string

Description:

URL-encoded path of the folder or sub-folder. A period (.) separates the sub-folder from the folder.


Sample Value: Inbox


Responses


application/json+fhir

200

Successfully created a copy of the attachments.


application/json+fhir

400

Your request was invalid. A parameter, or the data in a parameter, may be incorrect.


application/json+fhir

401

Your API key or access token has expired or is invalid.

Sample Request

curl -X POST "https://api.orionhealth.io/actor/current/webmail/DIRECT/mailboxes/developer.portal@example.com/folders/Inbox/messages/1234/copy" \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <Access Token>' \
-H 'Content-Type: application/json' \
-d '{"attachmentGroupId":"file_group_yui_3_17_2_1_1440995359278_225","attachmentIdPrefix":"referencedMessageAttachment-","isTransferOfCare":false}'

Download attachment

GET /actor/current/webmail/DIRECT/mailboxes/{mailboxAddress}/folders/{folderPath}/messages/{messageUid}/attachment/{attachmentIndex}/download

Downloads a file, attached to a message, using the attachmentIndex.


Parameters

Name

Type

Data Type

Description


Name:

messageUid

required

Type:

path

Data Type:

string

Description:

Unique identifier of the message.


Sample Value: 12



Name:

attachmentIndex

required

Type:

path

Data Type:

string

Description:

Order in which the file is attached to the message.


Sample Value: 2



Name:

mailboxAddress

required

Type:

path

Data Type:

string

Description:

URL-encoded address of the mailbox.


Sample Value: developer.portal@example.com



Name:

folderPath

required

Type:

path

Data Type:

string

Description:

URL-encoded path of the folder or sub-folder. A period (.) separates the sub-folder from the folder.


Sample Value: Inbox


Responses


application/json+fhir

200

Successfully downloaded the message attachment.


application/json+fhir

401

Your API key or access token has expired or is invalid.


application/json+fhir

404

Cannot find an attachment with that index.

Sample Request

curl -X GET "https://api.orionhealth.io/actor/current/webmail/DIRECT/mailboxes/developer.portal@example.com/folders/Inbox/messages/12/attachment/2/download" \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <Access Token>'