Mail API Overview

    ​ The LINE WORKS Mail API (hereinafter "Mail API" or "API") uses HTTP and a REST endpoint structure. Responses are usually available in JSON (responses of some APIs are not formatted as JSON, though) and OAuth 2.0 is used as the authentication method. ​ The Mail API provides access to the LINE WORKS Mail data, which are commonly used features. ​

    API Common Information

    Supported Environment

    ​ LINE WORKS supports two environments: testing and live. However, the Mail API is available only in the live environment. ​

    • Live environment: https://apis.worksmobile.com ​

    Combine an HTTP method with the request URL to complete an operation. For example, here is the operation to send a message in the live environment. ​

    Example) Operation for sending a message

    -   POST https://apis.worksmobile.com/{API ID}/mail/sendMail
    

    ​ You can see a request URL for each API call in the corresponding API details section. ​

    Request Common

    ​ With each API call, you should include a LINE WORKS token and a consumer key in the request header. You can get the token when you log in to the LINE WORKS system; it is re-issued every time that you log in to the system. For testing purposes, use the testing environment to get the token. ​ For how to get a consumer key, see API Common Guide. ​ The code below shows how to set a LINE WORKS token and a consumer key in the request header. ​

    httpMethod.setRequestHeader("Authorization", "Bearer Works token");
    httpMethod.setRequestHeader("consumerKey", "consumer key");
    

    Response Common

    ​ It returns an error code and message when the API call fails. ​

    Property Type Required Description
    code String Y Error code
    message String Y Error message

    ​ An example is shown below.

    {"code":"024","message":"Authentication failed" }
    

    Error codes can be classified into a number of categories as follows: ​

    • 000-99: Errors associated with API authentication ​
    • 100-199: Errors associated with API executions such as parameters, authentication, etc. ​
    • 200-299: Errors associated with other service or system integration ​
    • 300-399: Service errors ​
    • 900-999: Unknown errors ​ Errors that occur frequently are described in the table below. ​
    Error Code Error Message Description
    024 Authentication failed API authentication failure
    100 Invalid parameter Parameter error
    200 Service fail Service such as Mail integration failure
    999 Unknown error Unknown error

    ​ You can see an error code and message for each API call in the corresponding API details section.