Email This Issue provides two types of API components that makes it possible to integrate it with other addons or external services.
REST API
Send emails
The REST API is a RESTFul service method that will send emails.
Parameter | Value |
---|---|
REST path | $JIRA_BASE_URL/rest/jeti/1.0/email |
Request Method | POST |
Request Headers | Content-Type:application/json |
Authentication | What Jira REST API offers See details in the documentation |
Request Body | Email parameters in JSON |
Response |
|
Request Body Json
Request Body must be a well formatted Json object with the following structure.
FIelds in the Json object is explained below.
Field | Mandatory | Explanation | Example |
---|---|---|---|
issue | Numberic ID of the issue, or Issue Key | 10000 or TEST-1 | |
to,cc,bcc | Array of recipients:
| Participant examples:
Group examples:
Role exmaples:
Custom Field examples:
| |
emailSubject | Email Subject | ||
emailBody | Email Body | ||
addAttachments | Specifies how to select issue attachments to be added to the email | Value is one of:
| |
emailTemplate | Email template ID or name, email will be generated using this template. If not given, the template selected in the issue's Context will be used. | ||
emailOptions | Email options to control various aspects of the email.
| "emailOptions": { "addToWatchers":"true", "replyToMe":"true", "mailAsMe":"false", "addComments":"true", "suppressCommentEvent":"true", "emailFormat":"text", "commentVisibility":"g:jira-administrators", "richHtml":"false" } | |
payload | Key-Value map of values that will be added to the Velocity Context used to generate email body. Email template may refer to these values and may render them in the email. |
Request Statistics
The REST API is a RESTFul service method that will return the number of email items from the audit log.
Parameter | Value |
---|---|
REST path | $JIRA_BASE_URL/rest/jeti/1.0/email/stat |
Request Method | GET |
Request Headers | Content-Type:application/json |
Authentication | What Jira REST API offers See details in the documentation |
Query Parameters | issueKey - Key of the issue whose email audit log is queried |
Response Codes |
|
Response Data | Number of mail items matching the query |
Example | http://JIRA_URL/rest/jeti/1.0/email/stat?issueKey=<issue key> |
Request Email Items from the Audit Log
The REST API is a RESTFul service method that will return email items from the audit log matching the query parameters.
Parameter | Value |
---|---|
REST path | $JIRA_BASE_URL/rest/jeti/1.0/email/query |
Request Method | GET |
Request Headers | Content-Type:application/json |
Authentication | What Jira REST API offers See details in the documentation |
Authorization | Only those users may query the email items who are authorized to view them in the issue |
Query Parameters | issueKey - Key of the issue whose email audit log is queried |
Response Codes |
|
Response Data | JSON Array of email items matching the query |
Example | http://JIRA_URL/rest/jeti/1.0/email/stat?issueKey=<issue key> |
Response structure
[ { "issueId": 22900, "subject": "(IT-349) Új request by customer \"Hello WORLD\"", "body": <email body>, "to": <to recipients>, "cc":<cc recipients>, "from": <sender email address>, "format": <email format>, "actorUserKey": <user key>, "type": <type of email item>, "source": <trigger of the email>, "date": <date and time the email was sent or processed> },]
Queue Statistics SINCE 9.0.0
OSGi Component API
In case, your Jira add-on want to use JETI's email capabilities, you can build an integration between your add-on and Email This Issue.
Simply import the OSGi component Email This Issue publishes and call its methods.
API | Explanation |
---|---|
Component interface | com.metainf.jira.plugin.emailissue.api.EmailService |
Component method | void sendEmail(com.metainf.jira.plugin.emailissue.api.EmailDefinitionApi emailDefinition) throws Exception |
Component method | Collection<EmailLog> queryEmailLog(com.metainf.jira.plugin.emailissue.api.EmailLogQuery emailLogQuery) throws Exception |
Email Parameters
public class EmailDefinitionApi { private String issue; private List<String> to; //user keys and email addresses private List<String> cc; //user keys and email addresses private List<String> bcc; //user keys and email addresses private com.metainf.jira.plugin.emailissue.action.EmailOptions emailOptions; private String emailBody; //email body (will be injected in the template) private String emailSubject; //email subject (will be injected in the subject part of the template) private List<String> attachments; //issue attachment IDs private String addAttachments; private String emailTemplate; //name or ID of the Email template to use private Map<String, Object> payload; //arbitrary values that are injected into the Velocity Context in the template } public class EmailOptions { private boolean addToWatchers; //add recipient users to watchers, default: false private boolean replyToMe; //set the current user as the reply-to address, default: false private boolean mailAsMe; //set the sender address to the current user's email address, default: false private String emailFormat; //email format "text" or "html" private String emailPriority; //HIGH, NORMAL, LOW } public class EmailLogQuery { private Long issueId; private String issueKey; private String type; //EmailType private String source; private int top; private Date from; private Date to; }