Get Messages from the Specified Folder

    Gets messages from the specified folder.

    Note

    • The API request shows email messages only in chronological order.

    API Type

    Service API

    Request URL

    https://apis.worksmobile.com/r/{API ID}/mail/v2/getMailList

    HTTP Method

    GET(Content-Type: application/x-www-form-urlencoded; charset=UTF-8)

    Request

    Parameter Type Required Description
    folderSN Integer N Serial number of the folder to get messages from.
    The following list shows serial numbers for the system folders.
    ● -1: All mailbox (default)
    ● 0: Inbox
    ● 1: Sent Mail
    ● 2:Tracking
    ● 3: Temporary
    ● 4: Trash
    ● 5: Spam Mail
    ● 6: Memo box
    A folder with the serial number greater than 100 is the one created by the user.
    page Integer N Page number to get
    Example) 1
    pageSize Integer N Number of messages to display on a page.
    If it is not specified, the value specified by the user is used.
    (the value set in Settings > General > Set view > Mail list > List number/ size)
    Example) 30 (default)
    type String N Type of messages to get
    ● "all": All messages (default)
    ● "mark": Messages marked as important
    (If isUnread is true, type is set to all.)
    ● "attach": Messages that contain file attachments
    (If isUnread is true, type is set to all.)
    ● "tome": Messages where my email address is in the To field
    (If isUnread is true, type is set to all.)
    sortField Integer N Sort by
    ● 1: Date (default)
    ● 3: From
    ● 4: To (not available if folderSN is -1)
    ● 5: Subject
    ● 6: Size
    ● 8: Marked Mail (sortType must be 0.)
    ● 9: Attached File (sortType must be 0.)
    sortType Integer N Sorting order
    ● 0: Descending (default)
    ● 1: Ascending
    isUnread Boolean N Indicates whether to get unread messages only.
    ● true: Get unread messages only
    ● false: Get all messages (default)
    previewMode Integer N Preview information
    ● 0: None (default)
    ● 1: Message body preview
    ● 2: Message body preview and attachment information
    ● 3: Attachment information

    Request Example

    https://apis.worksmobile.com/r/{API ID}/mail/v2/getMailList?folderSN=0&isUnread=false
    

    Response

    It returns HTTP status 200 with response data in JSON format if the API call is successful.

    Property Type Required Description
    currentTime Long Y Current time in UNIX timestamp format
    Example) 1409208669
    lastPage Integer Y Last page number
    Example) 3
    totalCount Integer Y Total number of messages
    Example) 100
    listCount Integer Y Total number of pages
    Example) 3
    unreadCount Integer Y Number of unread messages
    Example) 10
    pageSize Integer Y Number of messages to display on a page
    Example) 30
    folderName String Y Folder name
    Example) Sent Mail
    mailData List Y Information of messages to get
    mailData[].priority Integer Y Indicates whether Important is selected for the message (The red exclamation mark is added to the message’s subject)
    ● 3: Important message
    ● 1: General message
    mailData[].size Integer Y Message size (unit: byte)
    Example) 1024
    mailData[].threadCount String Y Number of messages sent and received in Thread View
    Example) 0
    mailData[].threadId String Y Thread message ID
    Example) a1903976041747540dbfc1dd0e99c86@example.com
    mailData[].status Integer Y Message status
    ● 0: Unread
    ● 1: Read
    ● 2: Unread important
    ● 3: Read important
    mailData[].subject String Y Message subject
    mailData[].mailSN Integer Y Message serial number
    Example) 1234
    mailData[].mimeSN String Y MIME serial number
    Example) 1408959094.599851.19650.619501
    mailData[].from Object Y Message sender list
    mailData[].from.name String Y Message sender name
    mailData[].from.email String Y Message sender's email address
    mailData[].toList List Y Message recipient list
    mailData[].toList[].name String Y Message recipient name
    mailData[].toList[].email String Y Message recipient’s email address
    mailData[].attachInfo List N Attachment information for preview
    ● It is shown only when previewMode is 2 or 3.
    mailData[].attachInfo[].contentSN Integer N Attachment serial number
    mailData[].attachInfo[].filename String N Attachment file name
    mailData[].attachInfo[].contentSize Long N Attachment file size (unit: byte)
    mailData[].attachInfo[].contentType String N Attachment file’s contentType
    mailData[].preview String N Preview text
    ● It is shown only when previewMode is 1 or 2.
    mailData[].receivedTime Long Y Received time in UNIX timestamp format.
    Example) 1408959094
    mailData[].attachCount Integer Y Number of attachments
    Example) 1
    mailData[].folderSN Integer Y Folder serial number
    Example) 6
    mailData[].toMe Boolean Y Indicates whether my email address is in the To field.
    ● true: It is in the To field.
    ● false: It is in the Cc field.
    mailData[].securityLevel String Y Message’s security level
    ● "SECRET": Confidential
    ● "IN_HOUSE": Restricted
    ● "NORMAL": General
    mailData[].sentTime Long Y Sent time in UNIX timestamp format
    Example) 1408959094
    mailData[].color String Y Background color of messages displayed
    Example) #ffffff
    mailData[].reSend Boolean Y Indicates whether to allow resending of a message.
    ● true: Allow
    ● false: Not allow
    mailData[].spamType String Y Spam message filter
    ● "SYSTEM_DEFINE": Created by the system
    ● "USER_DEFINE": Created by users
    ● "USER_REPORT": Reported as spam messages by users
    ● "USER_MOVE": Moved to Spam Mail by users.
    mailData[].unreadThreadCount Integer Y Number of unread thread messages in Thread View
    Example) 0

    Response Example

    {
            "currentTime": 1409126091,
            "lastPage": 1,
            "mailData": [
                {
                    "priority": 3,
                    "size": 1042,
                    "threadCount": 0,
                    "threadId": "<a1903976041747540dbfc1dd0e99c86@example.com>",
                    "status": 5,
                    "subject": "Hello",
                    "mailSN": 5,
                    "mimeSN": "1408959094.599851.19650.619501",
                    "from": {
                        "name": "Gildong Hong",
                        "email": "user01@example.com"
                    },
                    "toList": [
                        {
                            "name": "",
                            "email": "user01@example.com"
                        }
                    ],
                    "attachInfo": [{
                "contentSN": 2,
                "filename": "giphy.gif",
                "contentOffset": 2095,
                "contentSize": 786174,
                "contentType": "image/gif",
                "decodedSize": 589630
            }],
                    "preview": "Message body",
                    "receivedTime": 1408959094,
                    "attachCount": 0,
                    "folderSN": 6,
                    "toMe": false,
                    "securityLevel": "NORMAL",
                    "sentTime": 1408959094,
                    "iconType": 0,
                    "color": "#ffffff",
                    "reSend": true,
                    "spamType": null,
                    "unreadThreadCount": 0
                },
                {
                    "priority": 3,
                    "size": 196331,
                    "threadCount": 0,
                    "threadId": "<14363dcad647f36b603771dc9ea88ad0@example.com>",
                    "status": 5,
                    "subject": "Testing the load time of complex page...",
                    "mailSN": 2,
                    "mimeSN": "1408957487.49617.14930.64547",
                    "from": {
                        "name": "Gildong Hong",
                        "email": "user01@example.com"
                    },
                    "toList": [
                        {
                            "name": "",
                            "email": "user01@example.com"
                        }
                    ],
                    "attachInfo": [],
                    "preview": "",
                    "receivedTime": 1408957487,
                    "attachCount": 0,
                    "folderSN": 6,
                    "toMe": false,
                    "securityLevel": "NORMAL",
                    "sentTime": 1408957486,
                    "iconType": 0,
                    "color": "#ffffff",
                    "reSend": true,
                    "spamType": null,
                    "unreadThreadCount": 0
                },
                {
                    "priority": 3,
                    "size": 2079,
                    "threadCount": 0,
                    "threadId": "<67823c36f479f825abc761952852936@example.com>",
                    "status": 37,
                    "subject": "Test message",
                    "mailSN": 1,
                    "mimeSN": "1408951522.795266.30402.825668",
                    "from": {
                        "name": "Gildong Hong",
                        "email": "user01@example.com"
                    },
                    "toList": [
                        {
                            "name": "",
                            "email": "user01@example.com"
                        }
                    ],
                    "attachInfo": [],
                    "preview": "",
                    "receivedTime": 1408951522,
                    "attachCount": 0,
                    "folderSN": 101,
                    "toMe": false,
                    "securityLevel": "NORMAL",
                    "sentTime": 1408951522,
                    "iconType": 0,
                    "color": "#ffffff",
                    "reSend": true,
                    "spamType": null,
                    "unreadThreadCount": 0
                }
            ],
            "totalCount": 3,
            "listCount": 3,
            "unreadCount": 0,
            "pageSize": 30,
            "folderName": "All mailbox"
    
    }
    

    Error

    It returns an error code and message with HTTP status when the API call fails.

    Property Type Description
    code String Error code
    message String Error message
    HTTP status Error code Description
    400 INVALID_PARAMETER Invalid request parameters
    500 SYSTEM_ERROR Internal server error
    Error Example
    {
        "code": "INVALID_PARAMETER",
        "message": "Invalid request parameters",
        "domain": "mail"
    }