Skip to content

Latest commit

 

History

History
380 lines (287 loc) · 17.7 KB

IssueCommentsApi.md

File metadata and controls

380 lines (287 loc) · 17.7 KB

IssueCommentsApi

All URIs are relative to https://your-domain.atlassian.com

Method HTTP request Description
addComment POST /rest/api/3/issue/{issueIdOrKey}/comment Add comment
deleteComment DELETE /rest/api/3/issue/{issueIdOrKey}/comment/{id} Delete comment
getComment GET /rest/api/3/issue/{issueIdOrKey}/comment/{id} Get comment
getComments GET /rest/api/3/issue/{issueIdOrKey}/comment Get comments
getCommentsByIds POST /rest/api/3/comment/list Get comments by IDs
updateComment PUT /rest/api/3/issue/{issueIdOrKey}/comment/{id} Update comment

addComment

Comment addComment(body, issueIdOrKey, expand)

Add comment

Adds a comment to an issue. This operation can be accessed anonymously. Permissions required: * Browse projects and Add comments project permission for the project that the issue containing the comment is in. * If issue-level security is configured, issue-level security permission to view the issue.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.IssueCommentsApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

IssueCommentsApi apiInstance = new IssueCommentsApi();
Map<String, Object> body = new Map(); // Map<String, Object> | 
String issueIdOrKey = "issueIdOrKey_example"; // String | The ID or key of the issue.
String expand = "expand_example"; // String | Use [expand](#expansion) to include additional information about comments in the response. This parameter accepts `renderedBody`, which returns the comment body rendered in HTML.
try {
    Comment result = apiInstance.addComment(body, issueIdOrKey, expand);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling IssueCommentsApi#addComment");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body Map<String, Object>
issueIdOrKey String The ID or key of the issue.
expand String Use expand to include additional information about comments in the response. This parameter accepts `renderedBody`, which returns the comment body rendered in HTML. [optional]

Return type

Comment

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

deleteComment

deleteComment(issueIdOrKey, id)

Delete comment

Deletes a comment. Permissions required: * Browse projects project permission for the project that the issue containing the comment is in. * If issue-level security is configured, issue-level security permission to view the issue. * Delete all comments project permission to delete any comment or Delete own comments to delete comment created by the user, * If the comment has visibility restrictions, the user belongs to the group or has the role visibility is restricted to.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.IssueCommentsApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

IssueCommentsApi apiInstance = new IssueCommentsApi();
String issueIdOrKey = "issueIdOrKey_example"; // String | The ID or key of the issue.
String id = "id_example"; // String | The ID of the comment.
try {
    apiInstance.deleteComment(issueIdOrKey, id);
} catch (ApiException e) {
    System.err.println("Exception when calling IssueCommentsApi#deleteComment");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
issueIdOrKey String The ID or key of the issue.
id String The ID of the comment.

Return type

null (empty response body)

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

getComment

Comment getComment(issueIdOrKey, id, expand)

Get comment

Returns a comment. This operation can be accessed anonymously. Permissions required: * Browse projects project permission for the project containing the comment. * If issue-level security is configured, issue-level security permission to view the issue. * If the comment has visibility restrictions, the user belongs to the group or has the role visibility is restricted to.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.IssueCommentsApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

IssueCommentsApi apiInstance = new IssueCommentsApi();
String issueIdOrKey = "issueIdOrKey_example"; // String | The ID or key of the issue.
String id = "id_example"; // String | The ID of the comment.
String expand = "expand_example"; // String | Use [expand](#expansion) to include additional information about comments in the response. This parameter accepts `renderedBody`, which returns the comment body rendered in HTML.
try {
    Comment result = apiInstance.getComment(issueIdOrKey, id, expand);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling IssueCommentsApi#getComment");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
issueIdOrKey String The ID or key of the issue.
id String The ID of the comment.
expand String Use expand to include additional information about comments in the response. This parameter accepts `renderedBody`, which returns the comment body rendered in HTML. [optional]

Return type

Comment

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getComments

PageOfComments getComments(issueIdOrKey, startAt, maxResults, orderBy, expand)

Get comments

Returns all comments for an issue. This operation can be accessed anonymously. Permissions required: Comments are included in the response where the user has: * Browse projects project permission for the project containing the comment. * If issue-level security is configured, issue-level security permission to view the issue. * If the comment has visibility restrictions, belongs to the group or has the role visibility is role visibility is restricted to.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.IssueCommentsApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

IssueCommentsApi apiInstance = new IssueCommentsApi();
String issueIdOrKey = "issueIdOrKey_example"; // String | The ID or key of the issue.
Long startAt = 0L; // Long | The index of the first item to return in a page of results (page offset).
Integer maxResults = 50; // Integer | The maximum number of items to return per page.
String orderBy = "orderBy_example"; // String | [Order](#ordering) the results by a field. Accepts *created* to sort comments by their created date.
String expand = "expand_example"; // String | Use [expand](#expansion) to include additional information about comments in the response. This parameter accepts `renderedBody`, which returns the comment body rendered in HTML.
try {
    PageOfComments result = apiInstance.getComments(issueIdOrKey, startAt, maxResults, orderBy, expand);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling IssueCommentsApi#getComments");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
issueIdOrKey String The ID or key of the issue.
startAt Long The index of the first item to return in a page of results (page offset). [optional] [default to 0]
maxResults Integer The maximum number of items to return per page. [optional] [default to 50]
orderBy String Order the results by a field. Accepts created to sort comments by their created date. [optional] [enum: created, -created, +created]
expand String Use expand to include additional information about comments in the response. This parameter accepts `renderedBody`, which returns the comment body rendered in HTML. [optional]

Return type

PageOfComments

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getCommentsByIds

PageBeanComment getCommentsByIds(body, expand)

Get comments by IDs

Returns a paginated list of just the comments for a list of comments specified by comment IDs. This operation can be accessed anonymously. Permissions required: Comments are returned where the user: * has Browse projects project permission for the project containing the comment. * If issue-level security is configured, issue-level security permission to view the issue. * If the comment has visibility restrictions, belongs to the group or has the role visibility is restricted to.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.IssueCommentsApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

IssueCommentsApi apiInstance = new IssueCommentsApi();
IssueCommentListRequestBean body = new IssueCommentListRequestBean(); // IssueCommentListRequestBean | The list of comment IDs.
String expand = "expand_example"; // String | Use [expand](#expansion) to include additional information about comments in the response. This parameter accepts a comma-separated list. Expand options include:   *  `renderedBody` Returns the comment body rendered in HTML.  *  `properties` Returns the comment's properties.
try {
    PageBeanComment result = apiInstance.getCommentsByIds(body, expand);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling IssueCommentsApi#getCommentsByIds");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body IssueCommentListRequestBean The list of comment IDs.
expand String Use expand to include additional information about comments in the response. This parameter accepts a comma-separated list. Expand options include: * `renderedBody` Returns the comment body rendered in HTML. * `properties` Returns the comment's properties. [optional]

Return type

PageBeanComment

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

updateComment

Comment updateComment(body, issueIdOrKey, id, expand)

Update comment

Updates a comment. This operation can be accessed anonymously. Permissions required: * Browse projects project permission for the project that the issue containing the comment is in. * If issue-level security is configured, issue-level security permission to view the issue. * Edit all comments project permission to update any comment or Edit own comments to update comment created by the user. * If the comment has visibility restrictions, the user belongs to the group or has the role visibility is restricted to.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.IssueCommentsApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

IssueCommentsApi apiInstance = new IssueCommentsApi();
Map<String, Object> body = new Map(); // Map<String, Object> | 
String issueIdOrKey = "issueIdOrKey_example"; // String | The ID or key of the issue.
String id = "id_example"; // String | The ID of the comment.
String expand = "expand_example"; // String | Use [expand](#expansion) to include additional information about comments in the response. This parameter accepts `renderedBody`, which returns the comment body rendered in HTML.
try {
    Comment result = apiInstance.updateComment(body, issueIdOrKey, id, expand);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling IssueCommentsApi#updateComment");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body Map<String, Object>
issueIdOrKey String The ID or key of the issue.
id String The ID of the comment.
expand String Use expand to include additional information about comments in the response. This parameter accepts `renderedBody`, which returns the comment body rendered in HTML. [optional]

Return type

Comment

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json