Send Email (v1)
Use the Send Mail (v1) REST API to send an email to specified recipients, optionally attaching files from EPM Cloud. You can attach any file up to 10 MB in size, other than a snapshot, that is available in EPM Cloud environments. This API can be incorporated into REST API programs and scripts to notify users of various conditions or to send reports.
This topic describes the original version of this REST API. You can also use the simplified v2 version of the REST API. The v2 version contains all parameters in the payload and does not require URL encoding while calling the REST APIs. This makes the v2 API easier to use. The v2 version is backwards compatible.
The API is asynchronous and returns the Job ID. Use the job status URI to determine whether the process is complete. The presence of status -1 in the response indicates that the process is in progress. Any non-zero status except -1 indicates failure.
This REST API is version v1.
Required Roles
Service Administrator
REST Resource
POST /interop/rest/<api_version>/services/sendmail
Note:
Before using the REST resources, you must understand how to access the REST resources and other important concepts. See Implementation Best Practices for EPM Cloud REST APIs. Using this REST API requires prerequisites. See Prerequisites.
Table 9-106 Tasks
Task | Request | REST Resource |
---|---|---|
Trigger sendmail |
POST | /interop/rest/<api_version>/services/sendmail |
Retrieve sendmail status
|
GET | /interop/rest/<api_version>/services/jobs/777 |
Request
Supported Media Types: application/x-www-form-urlencoded
The following table summarizes the request parameters.
Table 9-107 Parameters
Name | Description | Type | Required | Default |
---|---|---|---|---|
api_version |
Specific API version | Path | Yes | None |
to |
The recipient email addresses separated by semi-colons | Form | Yes | None |
subject |
The subject for the email | Form | Yes | None |
body |
The body of the email providing details. | Form | Yes | None |
attachments |
One or more file names separated by commas to be added as
attachments to the email, for example,
outbox/Errorfile.txt or
inbox/Errorfile2.txt You can attach any file up to 10 MB in size, other than a snapshot, that is available in EPM Cloud environments. |
Form | No | None |
Sample Request Payload
to:abc@oracle.com
subject:EPM
body:EPM weekly email
attachments:apr/2021-08-10 11_30_25/2021-08-10 11_30_25.html
Response
Table 9-108 Parameters
Name | Description |
---|---|
details |
In the case of errors, details are published with the error string |
status |
See Migration Status Codes |
links |
Detailed information about the link |
href |
Links to API call or status API |
action |
The HTTP call type |
rel |
Possible values: self or Job Status . If the value is set to Job Status , you can use the href to get the status
|
data |
Parameters as key value pairs passed in the request |
items |
Details about the resource |
links |
Details of the first URL to be requested to get the job details; rel is "Job Details" |
Example of Response Body
{
"status": -1,
"items": null,
"links": [{
"rel": "self",
"href": "https://<BASE URL>/interop/rest/v1/services/sendmail",
"data": null,
"action": "POST"
}, {
"rel": "Job Status",
"href": "https://<BASE URL>/interop/rest/v1/services/jobs/1502357937045",
"data": null,
"action": "GET"
}],
"details": null
}
JobID is appended only to the API used to fetch the status of the progress.
Sample code:
public void sendMail() throws Exception {
String to = "RECIPIENT EMAIL ADDRESS";
String subject = "SUBJECT OF THE MAIL";
String body = "BODY OF THE MAIL";
String attachments = "NAME OF THE FILE TO BE ATTACHED";
String urlString = String.format("%s/interop/rest/v1/services/sendmail", serverUrl);
String params = "to=" + to + "&subject=" + subject + "&body=" + body + "&attachments=" +attachments;
String response = executeRequest(urlString, "POST", params, "application/x-www-form-urlencoded");
getJobStatus(fetchPingUrlFromResponse(response, "Job Status"), "GET");
}